Author: mhabersack
Date: 2007-02-20 16:55:23 -0500 (Tue, 20 Feb 2007)
New Revision: 73218

Modified:
   trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/ChangeLog
   trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/SQLite3.cs
   
trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/UnsafeNativeMethods.cs
Log:
handle missing api in sqlite3 library

Modified: 
trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/ChangeLog 
2007-02-20 21:14:32 UTC (rev 73217)
+++ trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/ChangeLog 
2007-02-20 21:55:23 UTC (rev 73218)
@@ -1,5 +1,9 @@
 2007-02-20  Marek Habersack  <[EMAIL PROTECTED]>
 
+       * SQLite3.cs: handle sqlite3_prepare_v2 absent from the library,
+       it's a new API, added in Nov 2006 to sqlite3 upstream, so it's
+       likely it won't be found on many systems.
+
        * SQLiteCommand.cs: Added a backward compatibility method.
 
 2007-02-16  Marek Habersack  <[EMAIL PROTECTED]>

Modified: 
trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/SQLite3.cs
===================================================================
--- 
trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/SQLite3.cs    
    2007-02-20 21:14:32 UTC (rev 73217)
+++ 
trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/SQLite3.cs    
    2007-02-20 21:55:23 UTC (rev 73218)
@@ -231,7 +231,12 @@
       {
         while (n == 17 && retries < 3)
         {
-          n = UnsafeNativeMethods.sqlite3_prepare_v2(_sql, psql, b.Length - 1, 
out stmt, out ptr);
+               try {
+                       n = UnsafeNativeMethods.sqlite3_prepare_v2(_sql, psql, 
b.Length - 1, out stmt, out ptr);
+               } catch (EntryPointNotFoundException) {
+                       n = UnsafeNativeMethods.sqlite3_prepare (_sql, psql, 
b.Length - 1, out stmt, out ptr);
+               }
+               
           retries++;
 
           if (n == 1)

Modified: 
trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/UnsafeNativeMethods.cs
===================================================================
--- 
trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/UnsafeNativeMethods.cs
    2007-02-20 21:14:32 UTC (rev 73217)
+++ 
trunk/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient_2.0/UnsafeNativeMethods.cs
    2007-02-20 21:55:23 UTC (rev 73218)
@@ -89,6 +89,9 @@
     internal static extern int sqlite3_prepare_v2(IntPtr db, IntPtr pSql, int 
nBytes, out IntPtr stmt, out IntPtr ptrRemain);
 
     [DllImport(SQLITE_DLL)]
+    internal static extern int sqlite3_prepare(IntPtr db, IntPtr pSql, int 
nBytes, out IntPtr stmt, out IntPtr ptrRemain);
+         
+    [DllImport(SQLITE_DLL)]
     internal static extern int sqlite3_bind_blob(IntPtr stmt, int index, 
Byte[] value, int nSize, IntPtr nTransient);
 
     [DllImport(SQLITE_DLL)]

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to