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

svn_fdo at osgeo.org svn_fdo at osgeo.org
Mon Mar 26 16:48:26 EDT 2007


Author: badreddinekaroui
Date: 2007-03-26 16:48:26 -0400 (Mon, 26 Mar 2007)
New Revision: 2717

Modified:
   trunk/Utilities/SQLiteInterface/SQLiteBTree.cpp
   trunk/Utilities/SQLiteInterface/SQLiteBTree.h
   trunk/Utilities/SQLiteInterface/SQLiteDataBase.cpp
   trunk/Utilities/SQLiteInterface/SQLiteInterface.vcproj
Log:
See trac#53: upgrade the Sqlite library to the latest version 3.3.13 and add more unit tests


Modified: trunk/Utilities/SQLiteInterface/SQLiteBTree.cpp
===================================================================
--- trunk/Utilities/SQLiteInterface/SQLiteBTree.cpp	2007-03-26 20:46:30 UTC (rev 2716)
+++ trunk/Utilities/SQLiteInterface/SQLiteBTree.cpp	2007-03-26 20:48:26 UTC (rev 2717)
@@ -31,11 +31,17 @@
 {
     m_bOwner = true;
 }
-
+#ifdef SQLITE_3_1
 SQLiteBTree::SQLiteBTree( Btree *bt ) : m_pBt( bt )
 { 
     m_bOwner = false;
 }
+#else
+SQLiteBTree::SQLiteBTree( Btree *bt, sqlite3 *db ) : m_pBt( bt ), m_pDB( db )
+{ 
+    m_bOwner = false;
+}
+#endif
 
 SQLiteBTree::~SQLiteBTree(void)
 {
@@ -49,8 +55,11 @@
 int SQLiteBTree::open( const char* fileName, int nCache, int   flags )
 {
   int rc;
-  
+#ifdef SQLITE_3_1
   rc = sqlite3BtreeOpen(fileName, &m_pBt, flags);
+#else
+  rc = sqlite3BtreeOpen(fileName, m_pDB, &m_pBt, flags);
+#endif
   if( rc!=SQLITE_OK ){
     return rc;
   }

Modified: trunk/Utilities/SQLiteInterface/SQLiteBTree.h
===================================================================
--- trunk/Utilities/SQLiteInterface/SQLiteBTree.h	2007-03-26 20:46:30 UTC (rev 2716)
+++ trunk/Utilities/SQLiteInterface/SQLiteBTree.h	2007-03-26 20:48:26 UTC (rev 2717)
@@ -32,14 +32,19 @@
 {
 private:
     Btree       *m_pBt;
+#ifndef SQLITE_3_1
+	sqlite3     *m_pDB;
+#endif
     bool        m_bOwner;
 
 
 public:
     SQLiteBTree(void);
-
-    SQLiteBTree( Btree *bt );
-
+#ifdef SQLITE_3_1
+	SQLiteBTree( Btree *bt );
+#else
+	SQLiteBTree( Btree *bt, sqlite3 *db );
+#endif
     ~SQLiteBTree(void);
 
     /*

Modified: trunk/Utilities/SQLiteInterface/SQLiteDataBase.cpp
===================================================================
--- trunk/Utilities/SQLiteInterface/SQLiteDataBase.cpp	2007-03-26 20:46:30 UTC (rev 2716)
+++ trunk/Utilities/SQLiteInterface/SQLiteDataBase.cpp	2007-03-26 20:48:26 UTC (rev 2717)
@@ -43,7 +43,11 @@
 SQLiteBTree* SQLiteDataBase::BTree()
 {
     if( m_pBtree == NULL )
+#ifdef SQLITE_3_1
         m_pBtree = new SQLiteBTree( mpDB->aDb[0].pBt );
+#else   
+		m_pBtree = new SQLiteBTree( mpDB->aDb[0].pBt, mpDB );
+#endif
     return m_pBtree; 
 }
 
@@ -60,9 +64,13 @@
 
     if( sqlite3_open(fullPath, &mpDB) == SQLITE_OK )
     {
-        ExecuteNonQuery("create table fdo_master(name text, rootpage integer);"); // May fail is the table was already created
+        ExecuteNonQuery("create table fdo_master(name text, rootpage integer);"); // expected to fail if the table was already created
         sqlite3BtreeSetPageSize( mpDB->aDb[0].pBt, SQLiteDB_PAGESIZE, -1 );
-        sqlite3BtreeSetSafetyLevel( mpDB->aDb[0].pBt, 1);
+#ifdef SQLITE_3_1
+		sqlite3BtreeSetSafetyLevel( mpDB->aDb[0].pBt, 1);
+#else
+		sqlite3BtreeSetSafetyLevel( mpDB->aDb[0].pBt, 1, 1);
+#endif
         sqlite3BtreeSetAutoVacuum( mpDB->aDb[0].pBt, 0 );
 		sqlite3_busy_timeout(mpDB, 1000*60); // 60 seconds
 

Modified: trunk/Utilities/SQLiteInterface/SQLiteInterface.vcproj
===================================================================
--- trunk/Utilities/SQLiteInterface/SQLiteInterface.vcproj	2007-03-26 20:46:30 UTC (rev 2716)
+++ trunk/Utilities/SQLiteInterface/SQLiteInterface.vcproj	2007-03-26 20:48:26 UTC (rev 2717)
@@ -41,7 +41,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="$(FDOTHIRDPARTY)\Sqlite3.1.5\Src"
+				AdditionalIncludeDirectories="$(FDOTHIRDPARTY)\Sqlite3.3.13\Src"
 				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -110,7 +110,7 @@
 				EnableIntrinsicFunctions="true"
 				FavorSizeOrSpeed="1"
 				OmitFramePointers="true"
-				AdditionalIncludeDirectories="$(FDOTHIRDPARTY)\Sqlite3.1.5\Src"
+				AdditionalIncludeDirectories="$(FDOTHIRDPARTY)\Sqlite3.3.13\Src"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
 				StringPooling="true"
 				RuntimeLibrary="2"



More information about the fdo-commits mailing list