[fdo-commits] r685 - trunk/Utilities/SQLiteInterface

svn_fdo at osgeo.org svn_fdo at osgeo.org
Mon Jan 29 15:15:02 EST 2007


Author: badreddinekaroui
Date: 2007-01-29 15:15:02 -0500 (Mon, 29 Jan 2007)
New Revision: 685

Modified:
   trunk/Utilities/SQLiteInterface/SQLiteTable.cpp
Log:
Merge change 608 from branch 3.2.x to the trunk

Modified: trunk/Utilities/SQLiteInterface/SQLiteTable.cpp
===================================================================
--- trunk/Utilities/SQLiteInterface/SQLiteTable.cpp	2007-01-29 20:00:50 UTC (rev 684)
+++ trunk/Utilities/SQLiteInterface/SQLiteTable.cpp	2007-01-29 20:15:02 UTC (rev 685)
@@ -547,8 +547,8 @@
 
     if (key->get_size() == 0)
     {
-        // new record
-        mMykey = m_nextKey++;
+        sync_id_pool();
+        mMykey = m_nextKey;
         key->set_size( sizeof(SQLiteRecNumbDef) );
         key->set_data(&mMykey );
     }
@@ -655,24 +655,29 @@
 
     m_pDb->close_all_read_cursors(); // all read cursors need to be closed before a write cursor is aquired.
 
-    if( mCacheSize && mTabCache->get(txnid, key, &data, flags ) == 0 )
+    if( mTabCache )
     {
-        mTabCache->del( key );
+        mTabCache->flush();
+        mCacheSize = 0;
     }
-
     if( m_pDb->BTree()->cursor(  mRootDataPage, &pCur, 1, mCmpHandler ) )
         return SQLITE_ERROR;
 
     rc = pCur->move_to( key->get_size(), (unsigned char*)key->get_data(), found );
     if( found )
     { 
-        if( m_pDb->begin_transaction( ) == SQLITE_OK ) 
+        if( ! m_pDb->transaction_started() )
         {
+            if( m_pDb->begin_transaction( ) == SQLITE_OK ) 
+            {
+                rc = pCur->delete_current();
+                m_pDb->commit();
+            }
+            else 
+                rc = SQLITE_ERROR;
+        }
+        else
             rc = pCur->delete_current();
-            m_pDb->commit();
-        }
-        else 
-            rc = SQLITE_ERROR;
     }
     pCur->close();
     delete pCur;
@@ -707,6 +712,7 @@
 	if( mTabCache )
     {
         mTabCache->flush();
+        sync_id_pool();
         mCacheSize = 0;
     }
 }



More information about the fdo-commits mailing list