Skip to content
Permalink
Browse files

fix #4227

  • Loading branch information
jef-n committed Jan 26, 2012
1 parent 956995c commit cfcfa0802fabbd42810c6139c00f2dc08f454c18
Showing with 9 additions and 9 deletions.
  1. +9 −9 src/providers/ogr/qgsogrprovider.cpp
@@ -354,7 +354,7 @@ bool QgsOgrProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
.arg( quotedIdentifier( FROM8( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) ) ) ) )
.arg( mSubsetString );
QgsDebugMsg( QString( "SQL: %1" ).arg( sql ) );
ogrLayer = OGR_DS_ExecuteSQL( ogrDataSource, TO8( sql ), NULL, NULL );
ogrLayer = OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( sql ).constData(), NULL, NULL );

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

void QgsOgrProvider::updateExtents()
{
if( extent_ )
if ( extent_ )
{
free( extent_ );
extent_ = 0;
@@ -1279,7 +1279,7 @@ bool QgsOgrProvider::createSpatialIndex()

QString sql = QString( "CREATE SPATIAL INDEX ON %1" ).arg( quotedIdentifier( layerName ) ); // quote the layer name so spaces are handled
QgsDebugMsg( QString( "SQL: %1" ).arg( sql ) );
OGR_DS_ExecuteSQL( ogrDataSource, TO8( sql ), OGR_L_GetSpatialFilter( ogrOrigLayer ), "" );
OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( sql ).constData(), OGR_L_GetSpatialFilter( ogrOrigLayer ), "" );

QFileInfo fi( mFilePath ); // to get the base name
//find out, if the .qix file is there
@@ -1291,9 +1291,9 @@ bool QgsOgrProvider::createAttributeIndex( int field )
{
QString layerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) );
QString dropSql = QString( "DROP INDEX ON %1" ).arg( quotedIdentifier( layerName ) );
OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( dropSql ).constData(), OGR_L_GetSpatialFilter( ogrOrigLayer ), "SQL" );
QString createSql = QString( "CREATE INDEX ON %1 USING %2" ).arg( quotedIdentifier( layerName ) ).arg( fields()[field].name() );
OGR_DS_ExecuteSQL( ogrDataSource, TO8( dropSql ), OGR_L_GetSpatialFilter( ogrOrigLayer ), "SQL" );
OGR_DS_ExecuteSQL( ogrDataSource, TO8( createSql ), OGR_L_GetSpatialFilter( ogrOrigLayer ), "SQL" );
OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( createSql ).constData(), OGR_L_GetSpatialFilter( ogrOrigLayer ), "SQL" );

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

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
QgsDebugMsg( QString( "SQL: %1" ).arg( sql ) );
OGR_DS_ExecuteSQL( ogrDataSource, TO8( sql ), NULL, NULL );
OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( sql ).constData(), NULL, NULL );

recalculateFeatureCount();

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

QgsDebugMsg( QString( "SQL: %1" ).arg( sql ) );
OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, TO8( sql ), NULL, "SQL" );
OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( sql ).constData(), NULL, "SQL" );
if ( l == 0 )
return QgsVectorDataProvider::uniqueValues( index, uniqueValues, limit );

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

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

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

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

0 comments on commit cfcfa08

Please sign in to comment.
You can’t perform that action at this time.