Commit 0a348cc9 authored by Cédric Villemain's avatar Cédric Villemain Committed by Daniel Vrátil
Browse files

Map QString to text instead of Bytea with PostgreSQL backend

It's what suggested by QTSql.

It also happens to fix the recent issues raising around '\SEEN' errors
in SQL queries. It was visible because QTSql somewhat improve the postgresql
driver, and so... akonadi revealed its own bug.

REVIEW: 112976
BUG: 252120
BUG: 322931
FIXED-IN: 1.10.3
parent a678b5e7
......@@ -203,8 +203,6 @@ QString DbInitializerPostgreSql::sqlType(const QString& type, int size) const
return QLatin1String( "int8" );
if ( type == QLatin1String("QByteArray") )
return QLatin1String("BYTEA");
if ( type == QLatin1String("QString") )
return QLatin1String("BYTEA");
return DbInitializer::sqlType( type, size );
}
......@@ -258,11 +256,6 @@ QString DbInitializerPostgreSql::buildColumnStatement( const ColumnDescription &
QString DbInitializerPostgreSql::buildInsertValuesStatement( const TableDescription &tableDescription, const DataDescription &dataDescription ) const
{
QHash<QString, QString> data = dataDescription.data;
QMutableHashIterator<QString, QString> it( data );
while ( it.hasNext() ) {
it.next();
it.value().replace( QLatin1String("\\"), QLatin1String("\\\\") );
}
return QString::fromLatin1( "INSERT INTO %1 (%2) VALUES (%3)" )
.arg( tableDescription.name )
......
......@@ -170,4 +170,18 @@
<raw-sql backends="mysql,psql,odbc">UPDATE CollectionTable SET isVirtual = true WHERE resourceId IN (SELECT id FROM ResourceTable WHERE isVirtual = true)</raw-sql>
<raw-sql backends="sqlite">UPDATE CollectionTable SET isVirtual = 1 WHERE resourceId IN (SELECT id FROM ResourceTable WHERE isVirtual = 1)</raw-sql>
</update>
<update version="24" abortOnFailure="false">
<raw-sql backends="psql">ALTER TABLE CollectionTable ALTER remoteId TYPE text USING convert_from(remoteId,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE CollectionTable ALTER remoteRevision TYPE text USING convert_from(remoteRevision,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE CollectionTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE CollectionTable ALTER cachePolicyLocalParts TYPE text USING convert_from(cachePolicyLocalParts,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE CollectionTable ALTER queryString TYPE text USING convert_from(queryString,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE CollectionTable ALTER queryLanguage TYPE text USING convert_from(queryLanguage,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE FlagTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE MimeTypeTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE PartTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE PimItemTable ALTER remoteId TYPE text USING convert_from(remoteId,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE PimItemTable ALTER remoteRevision TYPE text USING convert_from(remoteRevision,'utf8');</raw-sql>
<raw-sql backends="psql">ALTER TABLE ResourceTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql>
</update>
</updates>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment