Skip to content

Commit

Permalink
fix spatialite provider (fixes #1883 & 1884)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11438 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 19, 2009
1 parent 6631c67 commit 442d33b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -269,7 +269,7 @@ bool QgsSpatiaLiteProvider::featureAtId( int featureId, QgsFeature & feature, bo
// iterate attributes
bool fetched = false;
int nAttr = 1;
for ( QgsAttributeList::const_iterator it = mAttributesToFetch.constBegin(); it != mAttributesToFetch.constEnd(); it++ )
for ( QgsAttributeList::const_iterator it = fetchAttributes.constBegin(); it != fetchAttributes.constEnd(); it++ )
{
if ( nAttr == ic )
{
Expand Down Expand Up @@ -952,7 +952,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
{
// binding a TEXT value
QString txt = it->toString();
int len = txt.length();
int len = txt.toUtf8().length() + 1;
char *vl = new char [len];
strcpy( vl, txt.toUtf8().constData() );
sqlite3_bind_text( stmt, ++ia, vl, len, SQLITE_TRANSIENT );
Expand All @@ -967,8 +967,11 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )

// performing actual row insert
ret = sqlite3_step( stmt );

if ( ret == SQLITE_DONE || ret == SQLITE_ROW )
;
{
numberFeatures++;
}
else
{
// some unexpected error occurred
Expand Down Expand Up @@ -1054,7 +1057,9 @@ bool QgsSpatiaLiteProvider::deleteFeatures( const QgsFeatureIds & id )
// performing actual row deletion
ret = sqlite3_step( stmt );
if ( ret == SQLITE_DONE || ret == SQLITE_ROW )
;
{
numberFeatures--;
}
else
{
// some unexpected error occurred
Expand Down

0 comments on commit 442d33b

Please sign in to comment.