NO

Author Topic: SQLite4 testing  (Read 2528 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
SQLite4 testing
« on: February 17, 2017, 07:01:34 PM »

SQLite4 here seem to be an abandoned project without win32 support :(
But it is possible to compile it with PellesC without optimizations.
If there are interest to that, let me know ;)
Code: [Select]
--- a\src\kvbt.c Fri Sep 19 20:48:23 2014
+++ b\src\kvbt.c Sat Feb 11 16:38:48 2017
@@ -392,3 +392,3 @@
   }
-  *ppKVStore = pNew;
+  *ppKVStore = (sqlite4_kvstore *)pNew;
   return rc;

--- a\src\lsmInt.h Fri Sep 19 20:48:23 2014
+++ b\src\lsmInt.h Tue Feb 14 23:40:04 2017
@@ -127,3 +127,7 @@
 /* The size of each shared-memory chunk */
+#ifdef _WIN32
+#define LSM_SHM_CHUNK_SIZE (64*1024)
+#else
 #define LSM_SHM_CHUNK_SIZE (32*1024)
+#endif
 
--- a\src\lsm_tree.c Fri Sep 19 20:48:23 2014
+++ b\src\lsm_tree.c Wed Feb 15 00:39:54 2017
@@ -292,9 +292,18 @@
 static int treeOffsetToChunk(u32 iOff){
+#ifdef _WIN32
+  assert( LSM_SHM_CHUNK_SIZE==(1<<16) );
+  return (int)(iOff>>16);
+#else
   assert( LSM_SHM_CHUNK_SIZE==(1<<15) );
   return (int)(iOff>>15);
+#endif
 }
 
+#ifdef _WIN32
+#define treeShmptrUnsafe(pDb, iPtr) \
+(&((u8*)((pDb)->apShm[(iPtr)>>16]))[(iPtr) & (LSM_SHM_CHUNK_SIZE-1)])
+#else
 #define treeShmptrUnsafe(pDb, iPtr) \
 (&((u8*)((pDb)->apShm[(iPtr)>>15]))[(iPtr) & (LSM_SHM_CHUNK_SIZE-1)])
-
+#endif
 /*
@@ -304,5 +313,9 @@
 static void *treeShmptr(lsm_db *pDb, u32 iPtr){
-
+#ifdef _WIN32
+  assert( (iPtr>>16)<pDb->nShm );
+  assert( pDb->apShm[iPtr>>16] );
+#else
   assert( (iPtr>>15)<pDb->nShm );
   assert( pDb->apShm[iPtr>>15] );
+#endif
 
@@ -363,3 +376,7 @@
     }
+#ifdef _WIN32
+    assert( LSM_SHM_CHUNK_SIZE==(1<<16) );
+#else
     assert( LSM_SHM_CHUNK_SIZE==(1<<15) );
+#endif
     nAvail = LSM_SHM_CHUNK_SIZE - (iPtr & (LSM_SHM_CHUNK_SIZE-1));
« Last Edit: February 17, 2017, 07:12:31 PM by TimoVJL »
May the source be with you