Skip to content
Permalink
Browse files

ogr provider: use FROM8 macro getting name from layer definition

  • Loading branch information
brushtyler committed Jul 30, 2012
1 parent 9885341 commit ec87f7f8eb8b52dd2f48e5c0af984146a6a43ee8
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/providers/ogr/qgsogrprovider.cpp
@@ -707,7 +707,7 @@ bool QgsOgrProvider::nextFeature( QgsFeature& feature )
}

OGRFeatureDefnH featureDefinition = OGR_F_GetDefnRef( fet );
QString featureTypeName = featureDefinition ? QString( OGR_FD_GetName( featureDefinition ) ) : QString( "" );
QString featureTypeName = featureDefinition ? FROM8( OGR_FD_GetName( featureDefinition ) ) : QString( "" );
feature.setFeatureId( OGR_F_GetFID( fet ) );
feature.clearAttributeMap();
feature.setTypeName( featureTypeName );
@@ -1308,7 +1308,7 @@ bool QgsOgrProvider::createSpatialIndex()
{
QgsCPLErrorHandler handler;

QString layerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) );
QString layerName = FROM8( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) ) );

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 ) );
@@ -1322,7 +1322,7 @@ bool QgsOgrProvider::createSpatialIndex()

bool QgsOgrProvider::createAttributeIndex( int field )
{
QString layerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) );
QString layerName = FROM8( 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() );
@@ -1352,7 +1352,7 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds & id )
returnvalue = false;
}

QString layerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) );
QString layerName = FROM8( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) ) );

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 ) );
@@ -2229,7 +2229,7 @@ QVariant QgsOgrProvider::minimumValue( int index )
}
const QgsField& fld = attIt.value();

QString theLayerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrLayer ) );
QString theLayerName = FROM8( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrLayer ) ) );

QString sql = QString( "SELECT MIN(%1) FROM %2" )
.arg( quotedIdentifier( fld.name() ) )
@@ -2269,7 +2269,7 @@ QVariant QgsOgrProvider::maximumValue( int index )
}
const QgsField& fld = mAttributeFields[index];

QString theLayerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrLayer ) );
QString theLayerName = FROM8( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrLayer ) ) );

QString sql = QString( "SELECT MAX(%1) FROM %2" )
.arg( quotedIdentifier( fld.name() ) )

0 comments on commit ec87f7f

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