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@11438 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 19, 2009
1 parent d2803b6 commit 52c420b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Original file line number Diff line number Diff line change
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 52c420b

Please sign in to comment.