[Mono.Data.Sqlite] Remove p/invokes to symbols that are not available on iOS version...
authorSebastien Pouliot <sebastien@xamarin.com>
Thu, 26 Nov 2015 16:45:04 +0000 (11:45 -0500)
committerSebastien Pouliot <sebastien@xamarin.com>
Thu, 26 Nov 2015 16:45:04 +0000 (11:45 -0500)
/usr/lib/libsqlite3.dylib: 77 symbols
[NOT FOUND] sqlite3_column_database_name
[NOT FOUND] sqlite3_column_database_name16
[NOT FOUND] sqlite3_column_origin_name
[NOT FOUND] sqlite3_column_origin_name16
[NOT FOUND] sqlite3_column_table_name
[NOT FOUND] sqlite3_column_table_name16
[NOT FOUND] sqlite3_key
[NOT FOUND] sqlite3_rekey

note: XI has unit tests that will detect if those symbols are added in a
future version of iOS.

mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3_UTF16.cs
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/UnsafeNativeMethods.cs

index d2ef1f6316506238873624a00af6f19eea7c7ec1..6f757238cd4139809efe4ca4230369ff3344c0bc 100644 (file)
@@ -499,6 +499,8 @@ namespace Mono.Data.Sqlite
 #if !SQLITE_STANDARD\r
       int len;\r
       return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name_interop(stmt._sqlite_stmt, index, out len), len);\r
+#elif MONOTOUCH\r
+      throw new NotImplementedException ();\r
 #else\r
       return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name(stmt._sqlite_stmt, index), -1);\r
 #endif\r
@@ -509,6 +511,8 @@ namespace Mono.Data.Sqlite
 #if !SQLITE_STANDARD\r
       int len;\r
       return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name_interop(stmt._sqlite_stmt, index, out len), len);\r
+#elif MONOTOUCH\r
+      throw new NotImplementedException ();\r
 #else\r
       return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name(stmt._sqlite_stmt, index), -1);\r
 #endif\r
@@ -519,6 +523,8 @@ namespace Mono.Data.Sqlite
 #if !SQLITE_STANDARD\r
       int len;\r
       return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name_interop(stmt._sqlite_stmt, index, out len), len);\r
+#elif MONOTOUCH\r
+      throw new NotImplementedException ();\r
 #else\r
       return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name(stmt._sqlite_stmt, index), -1);\r
 #endif\r
@@ -923,6 +929,17 @@ namespace Mono.Data.Sqlite
       return UnsafeNativeMethods.sqlite3_aggregate_context(context, 1);\r
     }\r
 \r
+#if MONOTOUCH\r
+       internal override void SetPassword(byte[] passwordBytes)\r
+       {\r
+               throw new NotImplementedException ();\r
+       }\r
+\r
+       internal override void ChangePassword(byte[] newPasswordBytes)\r
+       {\r
+               throw new NotImplementedException ();\r
+       }\r
+#else\r
     internal override void SetPassword(byte[] passwordBytes)\r
     {\r
       int n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length);\r
@@ -934,6 +951,7 @@ namespace Mono.Data.Sqlite
       int n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length);\r
       if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
     }\r
+#endif\r
                \r
 #if MONOTOUCH\r
     SQLiteUpdateCallback update_callback;\r
index 6ad8762b77667e80a0607906244496df5553ff61..16c7cdf3e66fe48ab168d96cce5cfa81f70c1819 100644 (file)
@@ -112,6 +112,8 @@ namespace Mono.Data.Sqlite
 #if !SQLITE_STANDARD\r
       int len;\r
       return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16_interop(stmt._sqlite_stmt, index, out len), len);\r
+#elif MONOTOUCH\r
+      throw new NotImplementedException ();\r
 #else\r
       return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16(stmt._sqlite_stmt, index), -1);\r
 #endif\r
@@ -122,6 +124,8 @@ namespace Mono.Data.Sqlite
 #if !SQLITE_STANDARD\r
       int len;\r
       return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16_interop(stmt._sqlite_stmt, index, out len), len);\r
+#elif MONOTOUCH\r
+      throw new NotImplementedException ();\r
 #else\r
       return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16(stmt._sqlite_stmt, index), -1);\r
 #endif\r
@@ -132,6 +136,8 @@ namespace Mono.Data.Sqlite
 #if !SQLITE_STANDARD\r
       int len;\r
       return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16_interop(stmt._sqlite_stmt, index, out len), len);\r
+#elif MONOTOUCH\r
+      throw new NotImplementedException ();\r
 #else\r
       return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16(stmt._sqlite_stmt, index), -1);\r
 #endif\r
index 4b440b951ed56cd07ede1b2c0f6aa3a3ebc21615..ba16a1763ff92b3141d7515bf8f463affd6c2ab4 100644 (file)
@@ -200,6 +200,8 @@ namespace Mono.Data.Sqlite
 #endif\r
     internal static extern IntPtr sqlite3_bind_parameter_name(IntPtr stmt, int index);\r
 \r
+// Apple does not include those symbols in it's libsqlite3\r
+#if !MONOTOUCH\r
 #if !PLATFORM_COMPACTFRAMEWORK\r
     [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]\r
 #else\r
@@ -213,6 +215,7 @@ namespace Mono.Data.Sqlite
     [DllImport(SQLITE_DLL)]\r
 #endif\r
     internal static extern IntPtr sqlite3_column_database_name16(IntPtr stmt, int index);\r
+#endif\r
 \r
 #if !PLATFORM_COMPACTFRAMEWORK\r
     [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]\r
@@ -242,6 +245,7 @@ namespace Mono.Data.Sqlite
 #endif\r
     internal static extern IntPtr sqlite3_column_name16(IntPtr stmt, int index);\r
 \r
+#if !MONOTOUCH\r
 #if !PLATFORM_COMPACTFRAMEWORK\r
     [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]\r
 #else\r
@@ -269,6 +273,7 @@ namespace Mono.Data.Sqlite
     [DllImport(SQLITE_DLL)]\r
 #endif\r
     internal static extern IntPtr sqlite3_column_table_name16(IntPtr stmt, int index);\r
+#endif // !MONOTOUCH\r
 \r
 #if !PLATFORM_COMPACTFRAMEWORK\r
     [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]\r
@@ -646,6 +651,7 @@ namespace Mono.Data.Sqlite
 #endif\r
     internal static extern void sqlite3_result_text16(IntPtr context, string strName, int nLen, IntPtr pvReserved);\r
 \r
+#if !MONOTOUCH\r
 #if !PLATFORM_COMPACTFRAMEWORK\r
     [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]\r
 #else\r
@@ -659,6 +665,7 @@ namespace Mono.Data.Sqlite
     [DllImport(SQLITE_DLL)]\r
 #endif\r
     internal static extern int sqlite3_rekey(IntPtr db, byte[] key, int keylen);\r
+#endif\r
 \r
 #if !PLATFORM_COMPACTFRAMEWORK\r
     [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]\r