@@ -354,7 +354,7 @@ bool QgsOgrProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
354
354
.arg ( quotedIdentifier ( FROM8 ( OGR_FD_GetName ( OGR_L_GetLayerDefn ( ogrOrigLayer ) ) ) ) )
355
355
.arg ( mSubsetString );
356
356
QgsDebugMsg ( QString ( " SQL: %1" ).arg ( sql ) );
357
- ogrLayer = OGR_DS_ExecuteSQL ( ogrDataSource, TO8 ( sql ), NULL , NULL );
357
+ ogrLayer = OGR_DS_ExecuteSQL ( ogrDataSource, mEncoding -> fromUnicode ( sql ). constData ( ), NULL , NULL );
358
358
359
359
if ( !ogrLayer )
360
360
{
@@ -871,7 +871,7 @@ QgsRectangle QgsOgrProvider::extent()
871
871
872
872
void QgsOgrProvider::updateExtents ()
873
873
{
874
- if ( extent_ )
874
+ if ( extent_ )
875
875
{
876
876
free ( extent_ );
877
877
extent_ = 0 ;
@@ -1279,7 +1279,7 @@ bool QgsOgrProvider::createSpatialIndex()
1279
1279
1280
1280
QString sql = QString ( " CREATE SPATIAL INDEX ON %1" ).arg ( quotedIdentifier ( layerName ) ); // quote the layer name so spaces are handled
1281
1281
QgsDebugMsg ( QString ( " SQL: %1" ).arg ( sql ) );
1282
- OGR_DS_ExecuteSQL ( ogrDataSource, TO8 ( sql ), OGR_L_GetSpatialFilter ( ogrOrigLayer ), " " );
1282
+ OGR_DS_ExecuteSQL ( ogrDataSource, mEncoding -> fromUnicode ( sql ). constData ( ), OGR_L_GetSpatialFilter ( ogrOrigLayer ), " " );
1283
1283
1284
1284
QFileInfo fi ( mFilePath ); // to get the base name
1285
1285
// find out, if the .qix file is there
@@ -1291,9 +1291,9 @@ bool QgsOgrProvider::createAttributeIndex( int field )
1291
1291
{
1292
1292
QString layerName = OGR_FD_GetName ( OGR_L_GetLayerDefn ( ogrOrigLayer ) );
1293
1293
QString dropSql = QString ( " DROP INDEX ON %1" ).arg ( quotedIdentifier ( layerName ) );
1294
+ OGR_DS_ExecuteSQL ( ogrDataSource, mEncoding ->fromUnicode ( dropSql ).constData (), OGR_L_GetSpatialFilter ( ogrOrigLayer ), " SQL" );
1294
1295
QString createSql = QString ( " CREATE INDEX ON %1 USING %2" ).arg ( quotedIdentifier ( layerName ) ).arg ( fields ()[field].name () );
1295
- OGR_DS_ExecuteSQL ( ogrDataSource, TO8 ( dropSql ), OGR_L_GetSpatialFilter ( ogrOrigLayer ), " SQL" );
1296
- OGR_DS_ExecuteSQL ( ogrDataSource, TO8 ( createSql ), OGR_L_GetSpatialFilter ( ogrOrigLayer ), " SQL" );
1296
+ OGR_DS_ExecuteSQL ( ogrDataSource, mEncoding ->fromUnicode ( createSql ).constData (), OGR_L_GetSpatialFilter ( ogrOrigLayer ), " SQL" );
1297
1297
1298
1298
QFileInfo fi ( mFilePath ); // to get the base name
1299
1299
// find out, if the .idm file is there
@@ -1323,7 +1323,7 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds & id )
1323
1323
1324
1324
QString sql = QString ( " REPACK %1" ).arg ( layerName ); // don't quote the layer name as it works with spaces in the name and won't work if the name is quoted
1325
1325
QgsDebugMsg ( QString ( " SQL: %1" ).arg ( sql ) );
1326
- OGR_DS_ExecuteSQL ( ogrDataSource, TO8 ( sql ), NULL , NULL );
1326
+ OGR_DS_ExecuteSQL ( ogrDataSource, mEncoding -> fromUnicode ( sql ). constData ( ), NULL , NULL );
1327
1327
1328
1328
recalculateFeatureCount ();
1329
1329
@@ -2144,7 +2144,7 @@ void QgsOgrProvider::uniqueValues( int index, QList<QVariant> &uniqueValues, int
2144
2144
sql += QString ( " ORDER BY %1 ASC" ).arg ( fld.name () ); // quoting of fieldname produces a syntax error
2145
2145
2146
2146
QgsDebugMsg ( QString ( " SQL: %1" ).arg ( sql ) );
2147
- OGRLayerH l = OGR_DS_ExecuteSQL ( ogrDataSource, TO8 ( sql ), NULL , " SQL" );
2147
+ OGRLayerH l = OGR_DS_ExecuteSQL ( ogrDataSource, mEncoding -> fromUnicode ( sql ). constData ( ), NULL , " SQL" );
2148
2148
if ( l == 0 )
2149
2149
return QgsVectorDataProvider::uniqueValues ( index , uniqueValues, limit );
2150
2150
@@ -2181,7 +2181,7 @@ QVariant QgsOgrProvider::minimumValue( int index )
2181
2181
sql += QString ( " WHERE %1" ).arg ( mSubsetString );
2182
2182
}
2183
2183
2184
- OGRLayerH l = OGR_DS_ExecuteSQL ( ogrDataSource, TO8 ( sql ), NULL , " SQL" );
2184
+ OGRLayerH l = OGR_DS_ExecuteSQL ( ogrDataSource, mEncoding -> fromUnicode ( sql ). constData ( ), NULL , " SQL" );
2185
2185
2186
2186
if ( l == 0 )
2187
2187
return QgsVectorDataProvider::minimumValue ( index );
@@ -2221,7 +2221,7 @@ QVariant QgsOgrProvider::maximumValue( int index )
2221
2221
sql += QString ( " WHERE %1" ).arg ( mSubsetString );
2222
2222
}
2223
2223
2224
- OGRLayerH l = OGR_DS_ExecuteSQL ( ogrDataSource, TO8 ( sql ), NULL , " SQL" );
2224
+ OGRLayerH l = OGR_DS_ExecuteSQL ( ogrDataSource, mEncoding -> fromUnicode ( sql ). constData ( ), NULL , " SQL" );
2225
2225
if ( l == 0 )
2226
2226
return QgsVectorDataProvider::maximumValue ( index );
2227
2227
0 commit comments