Skip to content

Commit 76ceea8

Browse files
author
jef
committed
fix #2250
git-svn-id: http://svn.osgeo.org/qgis/trunk@12404 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 1c6d7b5 commit 76ceea8

File tree

1 file changed

+30
-32
lines changed

1 file changed

+30
-32
lines changed

src/providers/spatialite/qgsspatialiteprovider.cpp

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ bool QgsSpatiaLiteProvider::featureAtId( int featureId, QgsFeature & feature, bo
225225
const QString & fieldname = fld.name();
226226
sql += ", \"";
227227
sql += fieldname;
228-
sql += "\"";
228+
sql += "\"";
229229
}
230230
if ( fetchGeometry )
231231
{
@@ -526,7 +526,7 @@ void QgsSpatiaLiteProvider::select( QgsAttributeList fetchAttributes, QgsRectang
526526
const QString & fieldname = fld.name();
527527
sql += ", \"";
528528
sql += fieldname;
529-
sql += "\"";
529+
sql += "\"";
530530
}
531531
if ( fetchGeometry )
532532
{
@@ -872,14 +872,12 @@ void QgsSpatiaLiteProvider::uniqueValues( int index, QList < QVariant > &uniqueV
872872
uniqueValues.append( QString( "%1" ).arg( sqlite3_column_double( stmt, 0 ) ) );
873873
break;
874874
case SQLITE_TEXT:
875-
txt = ( const char * ) sqlite3_column_text( stmt, 0 );
876-
uniqueValues.append( txt );
875+
uniqueValues.append( QString::fromUtf8(( const char * ) sqlite3_column_text( stmt, 0 ) ) );
877876
break;
878877
default:
879-
txt = "";
880-
uniqueValues.append( txt );
878+
uniqueValues.append( "" );
881879
break;
882-
};
880+
}
883881
}
884882
else
885883
{
@@ -952,7 +950,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
952950

953951
sql += ", \"";
954952
sql += fieldname;
955-
sql += "\"";
953+
sql += "\"";
956954
values += ", ?";
957955
}
958956

@@ -1033,7 +1031,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
10331031
// performing actual row insert
10341032
ret = sqlite3_step( stmt );
10351033

1036-
if ( ret == SQLITE_DONE || ret == SQLITE_ROW )
1034+
if ( ret == SQLITE_DONE || ret == SQLITE_ROW )
10371035
{
10381036
numberFeatures++;
10391037
}
@@ -1254,29 +1252,29 @@ bool QgsSpatiaLiteProvider::changeAttributeValues( const QgsChangedAttributesMap
12541252
sql += ",";
12551253
else
12561254
first = false;
1257-
1258-
QVariant::Type type = siter->type();
1259-
if ( siter->toString().isEmpty() )
1260-
{
1261-
// assuming to be a NULL value
1262-
type = QVariant::Invalid;
1263-
}
1264-
1265-
if ( type == QVariant::Invalid )
1266-
{
1267-
// binding a NULL value
1268-
sql += QString( "\"%1\"=NULL" ).arg( fieldName );
1269-
}
1270-
else if ( type == QVariant::Int || type == QVariant::Double )
1271-
{
1272-
// binding a NUMERIC value
1273-
sql += QString( "\"%1\"=%2" ).arg( fieldName ).arg( siter->toString() );
1274-
}
1275-
else
1276-
{
1277-
// binding a TEXT value
1278-
sql += QString( "\"%1\"=%2" ).arg( fieldName ).arg( quotedValue( siter->toString() ) );
1279-
}
1255+
1256+
QVariant::Type type = siter->type();
1257+
if ( siter->toString().isEmpty() )
1258+
{
1259+
// assuming to be a NULL value
1260+
type = QVariant::Invalid;
1261+
}
1262+
1263+
if ( type == QVariant::Invalid )
1264+
{
1265+
// binding a NULL value
1266+
sql += QString( "\"%1\"=NULL" ).arg( fieldName );
1267+
}
1268+
else if ( type == QVariant::Int || type == QVariant::Double )
1269+
{
1270+
// binding a NUMERIC value
1271+
sql += QString( "\"%1\"=%2" ).arg( fieldName ).arg( siter->toString() );
1272+
}
1273+
else
1274+
{
1275+
// binding a TEXT value
1276+
sql += QString( "\"%1\"=%2" ).arg( fieldName ).arg( quotedValue( siter->toString() ) );
1277+
}
12801278
}
12811279
sql += QString( " WHERE ROWID=%1" ).arg( fid );
12821280

0 commit comments

Comments
 (0)