Skip to content

Commit 52c420b

Browse files
author
jef
committedAug 19, 2009
fix spatialite provider (fixes #1883 & 1884)
git-svn-id: http://svn.osgeo.org/qgis/trunk@11438 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d2803b6 commit 52c420b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed
 

‎src/providers/spatialite/qgsspatialiteprovider.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ bool QgsSpatiaLiteProvider::featureAtId( int featureId, QgsFeature & feature, bo
269269
// iterate attributes
270270
bool fetched = false;
271271
int nAttr = 1;
272-
for ( QgsAttributeList::const_iterator it = mAttributesToFetch.constBegin(); it != mAttributesToFetch.constEnd(); it++ )
272+
for ( QgsAttributeList::const_iterator it = fetchAttributes.constBegin(); it != fetchAttributes.constEnd(); it++ )
273273
{
274274
if ( nAttr == ic )
275275
{
@@ -952,7 +952,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
952952
{
953953
// binding a TEXT value
954954
QString txt = it->toString();
955-
int len = txt.length();
955+
int len = txt.toUtf8().length() + 1;
956956
char *vl = new char [len];
957957
strcpy( vl, txt.toUtf8().constData() );
958958
sqlite3_bind_text( stmt, ++ia, vl, len, SQLITE_TRANSIENT );
@@ -967,8 +967,11 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
967967

968968
// performing actual row insert
969969
ret = sqlite3_step( stmt );
970+
970971
if ( ret == SQLITE_DONE || ret == SQLITE_ROW )
971-
;
972+
{
973+
numberFeatures++;
974+
}
972975
else
973976
{
974977
// some unexpected error occurred
@@ -1054,7 +1057,9 @@ bool QgsSpatiaLiteProvider::deleteFeatures( const QgsFeatureIds & id )
10541057
// performing actual row deletion
10551058
ret = sqlite3_step( stmt );
10561059
if ( ret == SQLITE_DONE || ret == SQLITE_ROW )
1057-
;
1060+
{
1061+
numberFeatures--;
1062+
}
10581063
else
10591064
{
10601065
// some unexpected error occurred

0 commit comments

Comments
 (0)
Please sign in to comment.