int ISQLite3Provider.sqlite3_blob_open(IntPtr db, string sdb, string table, string col, long rowid, int flags, out IntPtr blob) { // TODO null string? GCHandle sdb_pinned = GCHandle.Alloc(util.to_utf8(sdb), GCHandleType.Pinned); IntPtr sdb_ptr = sdb_pinned.AddrOfPinnedObject(); // TODO null string? GCHandle table_pinned = GCHandle.Alloc(util.to_utf8(table), GCHandleType.Pinned); IntPtr table_ptr = table_pinned.AddrOfPinnedObject(); // TODO null string? GCHandle col_pinned = GCHandle.Alloc(util.to_utf8(col), GCHandleType.Pinned); IntPtr col_ptr = col_pinned.AddrOfPinnedObject(); byte[] buf8 = new byte[8]; GCHandle buf8_pinned = GCHandle.Alloc(buf8, GCHandleType.Pinned); IntPtr buf8_ptr = buf8_pinned.AddrOfPinnedObject(); int result = SQLite3RuntimeProvider.sqlite3_blob_open(db.ToInt64(), sdb_ptr.ToInt64(), table_ptr.ToInt64(), col_ptr.ToInt64(), rowid, flags, buf8_ptr.ToInt64()); sdb_pinned.Free(); table_pinned.Free(); col_pinned.Free(); blob = new IntPtr(Marshal.ReadInt64(buf8_ptr)); buf8_pinned.Free(); return(result); }
static void scalar_function_hook_bridge(IntPtr context, int num_args, IntPtr argsptr) { IntPtr p = new IntPtr(SQLite3RuntimeProvider.sqlite3_user_data(context.ToInt64())); scalar_function_hook_info hi = scalar_function_hook_info.from_ptr(p); hi.call(context, num_args, argsptr); }
IntPtr SQLiteProvider.Sqlite3Errmsg(IntPtr db) { #if NETFX_CORE return(NativeMethods.sqlite3_errmsg(db)); #elif WINDOWS_PHONE return(new IntPtr(SQLite3RuntimeProvider.sqlite3_errmsg(db.ToInt64()))); #endif }
void ISQLite3Provider.sqlite3_result_error(IntPtr ctx, string val) { GCHandle pinned = GCHandle.Alloc(util.to_utf8(val), GCHandleType.Pinned); IntPtr ptr = pinned.AddrOfPinnedObject(); SQLite3RuntimeProvider.sqlite3_result_error(ctx.ToInt64(), ptr.ToInt64(), -1); pinned.Free(); }
int SQLiteProvider.Sqlite3ClearBindings(IntPtr stm) { #if NETFX_CORE return(NativeMethods.sqlite3_clear_bindings(stm)); #elif WINDOWS_PHONE return(SQLite3RuntimeProvider.sqlite3_clear_bindings(stm.ToInt64())); #endif }
int SQLiteProvider.Sqlite3Finalize(IntPtr stm) { #if NETFX_CORE return(NativeMethods.sqlite3_finalize(stm)); #elif WINDOWS_PHONE return(SQLite3RuntimeProvider.sqlite3_finalize(stm.ToInt64())); #endif }
int SQLiteProvider.Sqlite3ColumnCount(IntPtr stm) { #if NETFX_CORE return(NativeMethods.sqlite3_column_count(stm)); #elif WINDOWS_PHONE return(SQLite3RuntimeProvider.sqlite3_column_count(stm.ToInt64())); #endif }
IntPtr SQLiteProvider.Sqlite3ColumnDatabaseName(IntPtr stm, int columnIndex) { #if NETFX_CORE return(NativeMethods.sqlite3_column_database_name(stm, columnIndex)); #elif WINDOWS_PHONE return(new IntPtr(SQLite3RuntimeProvider.sqlite3_column_database_name(stm.ToInt64(), columnIndex))); #endif }
int SQLiteProvider.Sqlite3ColumnBytes(IntPtr stm, int columnIndex) { #if NETFX_CORE return(NativeMethods.sqlite3_column_bytes(stm, columnIndex)); #elif WINDOWS_PHONE return(SQLite3RuntimeProvider.sqlite3_column_bytes(stm.ToInt64(), columnIndex)); #endif }
int SQLiteProvider.Sqlite3BindParameterIndex(IntPtr stm, IntPtr paramName) { #if NETFX_CORE return(NativeMethods.sqlite3_bind_parameter_index(stm, paramName)); #elif WINDOWS_PHONE return(SQLite3RuntimeProvider.sqlite3_bind_parameter_index(stm.ToInt64(), paramName.ToInt64())); #endif }
IntPtr SQLiteProvider.Sqlite3BindParameterName(IntPtr stm, int paramIndex) { #if NETFX_CORE return(NativeMethods.sqlite3_bind_parameter_name(stm, paramIndex)); #elif WINDOWS_PHONE return(new IntPtr(SQLite3RuntimeProvider.sqlite3_bind_parameter_name(stm.ToInt64(), paramIndex))); #endif }
int SQLiteProvider.Sqlite3BindInt(IntPtr stm, int paramIndex, int value) { #if NETFX_CORE return(NativeMethods.sqlite3_bind_int(stm, paramIndex, value)); #elif WINDOWS_PHONE return(SQLite3RuntimeProvider.sqlite3_bind_int(stm.ToInt64(), paramIndex, value)); #endif }
int SQLiteProvider.Sqlite3CloseV2(IntPtr db) { #if NETFX_CORE return(NativeMethods.sqlite3_close_v2(db)); #elif WINDOWS_PHONE return(SQLite3RuntimeProvider.sqlite3_close_v2(db.ToInt64())); #endif }
int SQLiteProvider.Sqlite3BindBlob(IntPtr stm, int paramIndex, byte[] value, int length, IntPtr destructor) { #if NETFX_CORE return(NativeMethods.sqlite3_bind_blob(stm, paramIndex, value, length, destructor)); #elif WINDOWS_PHONE return(SQLite3RuntimeProvider.sqlite3_bind_blob(stm.ToInt64(), paramIndex, value, length, destructor.ToInt64())); #endif }
void ISQLite3Provider.sqlite3_result_blob(IntPtr ctx, byte[] blob) { GCHandle pinned = GCHandle.Alloc(blob, GCHandleType.Pinned); IntPtr ptr = pinned.AddrOfPinnedObject(); SQLite3RuntimeProvider.sqlite3_result_blob(ctx.ToInt64(), ptr.ToInt64(), blob.Length, -1); pinned.Free(); }
int SQLiteProvider.Sqlite3BindParameterCount(IntPtr stm) { #if NETFX_CORE return(NativeMethods.sqlite3_bind_parameter_count(stm)); #elif WINDOWS_PHONE return(SQLite3RuntimeProvider.sqlite3_bind_parameter_count(stm.ToInt64())); #endif }
int ISQLite3Provider.sqlite3_blob_write(IntPtr blob, byte[] b, int bOffset, int n, int offset) { GCHandle pinned = GCHandle.Alloc(b, GCHandleType.Pinned); IntPtr ptr = pinned.AddrOfPinnedObject(); int rc = SQLite3RuntimeProvider.sqlite3_blob_write(blob.ToInt64(), ptr.ToInt64() + bOffset, n, offset); pinned.Free(); return(rc); }
int ISQLite3Provider.sqlite3_bind_blob(IntPtr stm, int paramIndex, byte[] blob) { 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); pinned.Free(); return(rc); }
int ISQLite3Provider.sqlite3_complete(string sql) { // TODO null string? GCHandle pinned = GCHandle.Alloc(util.to_utf8(sql), GCHandleType.Pinned); IntPtr ptr = pinned.AddrOfPinnedObject(); int rc = SQLite3RuntimeProvider.sqlite3_complete(ptr.ToInt64()); pinned.Free(); return(rc); }
static void agg_function_hook_bridge_final(IntPtr context) { IntPtr agg = new IntPtr(SQLite3RuntimeProvider.sqlite3_aggregate_context(context.ToInt64(), 8)); // TODO error check agg nomem IntPtr p = new IntPtr(SQLite3RuntimeProvider.sqlite3_user_data(context.ToInt64())); agg_function_hook_info hi = agg_function_hook_info.from_ptr(p); hi.call_final(context, agg); }
int ISQLite3Provider.Sqlite3PrepareV2(IntPtr db, IntPtr sql, int length, out IntPtr stm, IntPtr tail) { long stmPtr; var result = SQLite3RuntimeProvider.sqlite3_prepare_v2(db.ToInt64(), sql.ToInt64(), length, out stmPtr, tail.ToInt64()); stm = new IntPtr(stmPtr); return(result); }
int ISQLite3Provider.Sqlite3Open(IntPtr filename, out IntPtr db, int flags) { long databasePtr; var result = SQLite3RuntimeProvider.sqlite3_open_v2(filename.ToInt64(), out databasePtr, flags, IntPtr.Zero.ToInt64()); db = new IntPtr(databasePtr); return(result); }
int ISQLite3Provider.sqlite3_bind_parameter_index(IntPtr stm, string paramName) { // TODO null string? GCHandle pinned = GCHandle.Alloc(util.to_utf8(paramName), GCHandleType.Pinned); IntPtr ptr = pinned.AddrOfPinnedObject(); int result = SQLite3RuntimeProvider.sqlite3_bind_parameter_index(stm.ToInt64(), ptr.ToInt64()); pinned.Free(); return(result); }
int ISQLite3Provider.sqlite3_bind_text(IntPtr stm, int paramIndex, string t) { // TODO null string? GCHandle pinned = GCHandle.Alloc(util.to_utf8(t), GCHandleType.Pinned); IntPtr ptr = pinned.AddrOfPinnedObject(); int result = SQLite3RuntimeProvider.sqlite3_bind_text(stm.ToInt64(), paramIndex, ptr.ToInt64(), -1, -1); pinned.Free(); return(result); }
public int Sqlite3Open(IntPtr filename, out IntPtr db) { #if NETFX_CORE return(NativeMethods.sqlite3_open(filename, out db)); #elif WINDOWS_PHONE long databasePtr; var result = SQLite3RuntimeProvider.sqlite3_open(filename.ToInt64(), out databasePtr); db = new IntPtr(databasePtr); return(result); #endif }
int SQLiteProvider.Sqlite3PrepareV2(IntPtr db, IntPtr sql, int length, out IntPtr stm, IntPtr tail) { #if NETFX_CORE return(NativeMethods.sqlite3_prepare_v2(db, sql, length, out stm, tail)); #elif WINDOWS_PHONE long stmPtr; var result = SQLite3RuntimeProvider.sqlite3_prepare_v2(db.ToInt64(), sql.ToInt64(), length, out stmPtr, tail.ToInt64()); stm = new IntPtr(stmPtr); return(result); #endif }
byte[] ISQLite3Provider.sqlite3_value_blob(IntPtr p) { IntPtr blobPointer = new IntPtr(SQLite3RuntimeProvider.sqlite3_value_blob(p.ToInt64())); if (blobPointer == IntPtr.Zero) { return(null); } var length = SQLite3RuntimeProvider.sqlite3_value_bytes(p.ToInt64()); byte[] result = new byte[length]; Marshal.Copy(blobPointer, (byte[])result, 0, length); return(result); }
byte[] ISQLite3Provider.sqlite3_column_blob(IntPtr stm, int columnIndex) { IntPtr blobPointer = new IntPtr(SQLite3RuntimeProvider.sqlite3_column_blob(stm.ToInt64(), columnIndex)); if (blobPointer == IntPtr.Zero) { return(null); } var length = SQLite3RuntimeProvider.sqlite3_column_bytes(stm.ToInt64(), columnIndex); byte[] result = new byte[length]; Marshal.Copy(blobPointer, (byte[])result, 0, length); return(result); }
int ISQLite3Provider.sqlite3__vfs__delete(string vfs, string pathname, int syncDir) { GCHandle pinned_vfs = GCHandle.Alloc(util.to_utf8(vfs), GCHandleType.Pinned); IntPtr ptr_vfs = pinned_vfs.AddrOfPinnedObject(); GCHandle pinned_pathname = GCHandle.Alloc(util.to_utf8(pathname), GCHandleType.Pinned); IntPtr ptr_pathname = pinned_pathname.AddrOfPinnedObject(); int rc = SQLite3RuntimeProvider.sqlite3__vfs__delete(ptr_vfs.ToInt64(), ptr_pathname.ToInt64(), syncDir); pinned_vfs.Free(); pinned_pathname.Free(); return(rc); }
IntPtr ISQLite3Provider.sqlite3_backup_init(IntPtr destDb, string destName, IntPtr sourceDb, string sourceName) { // TODO null string? GCHandle dest_pinned = GCHandle.Alloc(util.to_utf8(destName), GCHandleType.Pinned); IntPtr dest_ptr = dest_pinned.AddrOfPinnedObject(); // TODO null string? GCHandle source_pinned = GCHandle.Alloc(util.to_utf8(sourceName), GCHandleType.Pinned); IntPtr source_ptr = source_pinned.AddrOfPinnedObject(); IntPtr result = new IntPtr(SQLite3RuntimeProvider.sqlite3_backup_init(destDb.ToInt64(), dest_ptr.ToInt64(), sourceDb.ToInt64(), source_ptr.ToInt64())); dest_pinned.Free(); source_pinned.Free(); return(result); }