Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cs/isqlite3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion src/cs/raw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 9 additions & 4 deletions src/cs/sqlite3_bait.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion src/cs/sqlite3_cppinterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 5 additions & 0 deletions src/cs/sqlite3_pinvoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion src/cs/ugly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down