Skip to content

Commit cfcfa08

Browse files
committed
fix #4227
1 parent 956995c commit cfcfa08

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/providers/ogr/qgsogrprovider.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ bool QgsOgrProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
354354
.arg( quotedIdentifier( FROM8( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) ) ) ) )
355355
.arg( mSubsetString );
356356
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 );
358358

359359
if ( !ogrLayer )
360360
{
@@ -871,7 +871,7 @@ QgsRectangle QgsOgrProvider::extent()
871871

872872
void QgsOgrProvider::updateExtents()
873873
{
874-
if( extent_ )
874+
if ( extent_ )
875875
{
876876
free( extent_ );
877877
extent_ = 0;
@@ -1279,7 +1279,7 @@ bool QgsOgrProvider::createSpatialIndex()
12791279

12801280
QString sql = QString( "CREATE SPATIAL INDEX ON %1" ).arg( quotedIdentifier( layerName ) ); // quote the layer name so spaces are handled
12811281
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 ), "" );
12831283

12841284
QFileInfo fi( mFilePath ); // to get the base name
12851285
//find out, if the .qix file is there
@@ -1291,9 +1291,9 @@ bool QgsOgrProvider::createAttributeIndex( int field )
12911291
{
12921292
QString layerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) );
12931293
QString dropSql = QString( "DROP INDEX ON %1" ).arg( quotedIdentifier( layerName ) );
1294+
OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( dropSql ).constData(), OGR_L_GetSpatialFilter( ogrOrigLayer ), "SQL" );
12941295
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" );
12971297

12981298
QFileInfo fi( mFilePath ); // to get the base name
12991299
//find out, if the .idm file is there
@@ -1323,7 +1323,7 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds & id )
13231323

13241324
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
13251325
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 );
13271327

13281328
recalculateFeatureCount();
13291329

@@ -2144,7 +2144,7 @@ void QgsOgrProvider::uniqueValues( int index, QList<QVariant> &uniqueValues, int
21442144
sql += QString( " ORDER BY %1 ASC" ).arg( fld.name() ); // quoting of fieldname produces a syntax error
21452145

21462146
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" );
21482148
if ( l == 0 )
21492149
return QgsVectorDataProvider::uniqueValues( index, uniqueValues, limit );
21502150

@@ -2181,7 +2181,7 @@ QVariant QgsOgrProvider::minimumValue( int index )
21812181
sql += QString( " WHERE %1" ).arg( mSubsetString );
21822182
}
21832183

2184-
OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, TO8( sql ), NULL, "SQL" );
2184+
OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( sql ).constData(), NULL, "SQL" );
21852185

21862186
if ( l == 0 )
21872187
return QgsVectorDataProvider::minimumValue( index );
@@ -2221,7 +2221,7 @@ QVariant QgsOgrProvider::maximumValue( int index )
22212221
sql += QString( " WHERE %1" ).arg( mSubsetString );
22222222
}
22232223

2224-
OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, TO8( sql ), NULL, "SQL" );
2224+
OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( sql ).constData(), NULL, "SQL" );
22252225
if ( l == 0 )
22262226
return QgsVectorDataProvider::maximumValue( index );
22272227

0 commit comments

Comments
 (0)