diff --git a/src/cs/isqlite3.cs b/src/cs/isqlite3.cs index a07751a5..28053a19 100644 --- a/src/cs/isqlite3.cs +++ b/src/cs/isqlite3.cs @@ -131,6 +131,7 @@ public interface ISQLite3Provider int sqlite3_bind_zeroblob(IntPtr stmt, int index, int size); string sqlite3_bind_parameter_name(IntPtr stmt, int index); int sqlite3_bind_blob(IntPtr stmt, int index, byte[] blob); + int sqlite3_bind_blob(IntPtr stmt, int index, byte[] blob, int nSize); int sqlite3_bind_double(IntPtr stmt, int index, double val); int sqlite3_bind_int(IntPtr stmt, int index, int val); int sqlite3_bind_int64(IntPtr stmt, int index, long val); diff --git a/src/cs/raw.cs b/src/cs/raw.cs index 34d6d0f1..68c7f406 100644 --- a/src/cs/raw.cs +++ b/src/cs/raw.cs @@ -713,7 +713,12 @@ static public string sqlite3_value_text(sqlite3_value val) static public int sqlite3_bind_blob(sqlite3_stmt stmt, int index, byte[] blob) { - return _imp.sqlite3_bind_blob(stmt.ptr, index, blob); + return sqlite3_bind_blob(stmt, index, blob, blob.Length); + } + + static public int sqlite3_bind_blob(sqlite3_stmt stmt, int index, byte[] blob, int nSize) + { + return _imp.sqlite3_bind_blob(stmt.ptr, index, blob, nSize); } static public int sqlite3_bind_double(sqlite3_stmt stmt, int index, double val) diff --git a/src/cs/sqlite3_bait.cs b/src/cs/sqlite3_bait.cs index bbd44904..fe2ed672 100644 --- a/src/cs/sqlite3_bait.cs +++ b/src/cs/sqlite3_bait.cs @@ -467,7 +467,12 @@ int ISQLite3Provider.sqlite3_bind_double(IntPtr stm, int paramIndex, double val) int ISQLite3Provider.sqlite3_bind_blob(IntPtr stm, int paramIndex, byte[] blob) { - throw new Exception(GRIPE); + throw new Exception(GRIPE); + } + + int ISQLite3Provider.sqlite3_bind_blob(IntPtr stm, int paramIndex, byte[] blob, int nSize) + { + throw new Exception(GRIPE); } int ISQLite3Provider.sqlite3_bind_zeroblob(IntPtr stm, int paramIndex, int size) @@ -615,9 +620,9 @@ int ISQLite3Provider.sqlite3_wal_checkpoint_v2(IntPtr db, string dbName, int eMo throw new Exception(GRIPE); } - int ISQLite3Provider.sqlite3_set_authorizer(IntPtr db, delegate_authorizer func, object v) - { - throw new Exception(GRIPE); + int ISQLite3Provider.sqlite3_set_authorizer(IntPtr db, delegate_authorizer func, object v) + { + throw new Exception(GRIPE); } int ISQLite3Provider.sqlite3_win32_set_directory(int typ, string path) diff --git a/src/cs/sqlite3_cppinterop.cs b/src/cs/sqlite3_cppinterop.cs index bdd98c5c..4e05bf6f 100644 --- a/src/cs/sqlite3_cppinterop.cs +++ b/src/cs/sqlite3_cppinterop.cs @@ -1277,10 +1277,15 @@ int ISQLite3Provider.sqlite3_bind_double(IntPtr stm, int paramIndex, double valu } int ISQLite3Provider.sqlite3_bind_blob(IntPtr stm, int paramIndex, byte[] blob) + { + return ((ISQLite3Provider)this).sqlite3_bind_blob(stm, paramIndex, blob, blob.Length); + } + + int ISQLite3Provider.sqlite3_bind_blob(IntPtr stm, int paramIndex, byte[] blob, int nSize) { GCHandle pinned = GCHandle.Alloc(blob, GCHandleType.Pinned); IntPtr ptr = pinned.AddrOfPinnedObject(); - int rc = SQLite3RuntimeProvider.sqlite3_bind_blob(stm.ToInt64(), paramIndex, ptr.ToInt64(), blob.Length, -1); + int rc = SQLite3RuntimeProvider.sqlite3_bind_blob(stm.ToInt64(), paramIndex, ptr.ToInt64(), nSize, -1); pinned.Free(); return rc; } diff --git a/src/cs/sqlite3_pinvoke.cs b/src/cs/sqlite3_pinvoke.cs index 895ddc11..f4970a19 100644 --- a/src/cs/sqlite3_pinvoke.cs +++ b/src/cs/sqlite3_pinvoke.cs @@ -1051,6 +1051,11 @@ int ISQLite3Provider.sqlite3_bind_blob(IntPtr stm, int paramIndex, byte[] blob) return NativeMethods.sqlite3_bind_blob(stm, paramIndex, blob, blob.Length, new IntPtr(-1)); } + int ISQLite3Provider.sqlite3_bind_blob(IntPtr stm, int paramIndex, byte[] blob, int nSize) + { + return NativeMethods.sqlite3_bind_blob(stm, paramIndex, blob, nSize, new IntPtr(-1)); + } + int ISQLite3Provider.sqlite3_bind_zeroblob(IntPtr stm, int paramIndex, int size) { return NativeMethods.sqlite3_bind_zeroblob(stm, paramIndex, size); diff --git a/src/cs/ugly.cs b/src/cs/ugly.cs index 93681acd..4168b73b 100644 --- a/src/cs/ugly.cs +++ b/src/cs/ugly.cs @@ -539,7 +539,12 @@ public static void bind_text(this sqlite3_stmt stmt, int index, string s) public static void bind_blob(this sqlite3_stmt stmt, int index, byte[] b) { - int rc = raw.sqlite3_bind_blob(stmt, index, b); + bind_blob(stmt, index, b, b.Length); + } + + public static void bind_blob(this sqlite3_stmt stmt, int index, byte[] b, int nSize) + { + int rc = raw.sqlite3_bind_blob(stmt, index, b, nSize); check_ok(rc); }