internal DB_ENV env() { global::System.IntPtr cPtr = libdb_csharpPINVOKE.DB_env(swigCPtr); DB_ENV ret = (cPtr == global::System.IntPtr.Zero) ? null : new DB_ENV(cPtr, false); return(ret); }
private static int doRepTransport(IntPtr envp, IntPtr controlp, IntPtr recp, IntPtr lsnp, int envid, uint flags) { DB_ENV dbenv = new DB_ENV(envp, false); DBT control = new DBT(controlp, false); DBT rec = new DBT(recp, false); DB_LSN tmplsn = new DB_LSN(lsnp, false); LSN dblsn = new LSN(tmplsn.file, tmplsn.offset); return dbenv.api2_internal.transportHandler( DatabaseEntry.fromDBT(control), DatabaseEntry.fromDBT(rec), dblsn, envid, flags); }
private static void doThreadID(IntPtr env, IntPtr pid, IntPtr tid) { DB_ENV dbenv = new DB_ENV(env, false); DbThreadID id = dbenv.api2_internal.threadIDHandler(); /* * Sometimes the library doesn't care about either pid or tid * (usually tid) and will pass NULL instead of a valid pointer. */ if (pid != IntPtr.Zero) Marshal.WriteInt32(pid, id.processID); if (tid != IntPtr.Zero) Marshal.WriteInt32(tid, (int)id.threadID); }
private static int doBackupWrite(IntPtr env, uint off_gbytes, uint off_bytes, uint usize, IntPtr buf, IntPtr handle) { int ret, size; long offset = off_gbytes * GIGABYTE + off_bytes; DB_ENV dbenv = new DB_ENV(env, false); if (usize > Int32.MaxValue) size = Int32.MaxValue; else size = (int)usize; byte[] data = new byte[size]; Marshal.Copy(buf, data, 0, (int)size); ret = dbenv.api2_internal.backupObj.Write(data, offset, (int)size); if (ret == 0 && usize > Int32.MaxValue) { size = (int)(usize - Int32.MaxValue); /* * There's no need to re-allocate data, it's already as large as * we could possibly need it to be. Advance buf beyond what was * just copied and write the remaining data. */ buf = new IntPtr(buf.ToInt64() + Int32.MaxValue); Marshal.Copy(buf, data, 0, (int)size); ret = dbenv.api2_internal.backupObj.Write(data, offset, (int)size); } return ret; }
/* Called by Databases with private environments. */ internal DatabaseEnvironment(DB_ENV dbenvp) { dbenv = dbenvp; initialize(); }
private static string doThreadName(IntPtr env, int pid, uint tid, ref string buf) { DB_ENV dbenv = new DB_ENV(env, false); DbThreadID id = new DbThreadID(pid, tid); string ret = dbenv.api2_internal.threadNameHandler(id); try { buf = ret; } catch (NullReferenceException) { /* * The library may give us a NULL pointer in buf and there's no * good way to test for that. Just ignore the exception if * we're not able to set buf. */ } return ret; }
private static int doRepView(IntPtr envp, string name, ref int result, uint flags) { DB_ENV dbenv = new DB_ENV(envp, false); return dbenv.api2_internal.replicationViewHandler(name, ref result, flags); }
private static void doNotify(IntPtr env, uint eventcode, byte[] event_info) { DB_ENV dbenv = new DB_ENV(env, false); dbenv.api2_internal.notifyHandler( (NotificationEvent)eventcode, event_info); }
internal DB(DB_ENV env, uint flags) : this(libdb_csharpPINVOKE.new_DB(DB_ENV.getCPtr(env), flags), true) { }
private static void doErrFeedback(IntPtr env, string pfx, string msg) { DB_ENV dbenv = new DB_ENV(env, false); dbenv.api2_internal.errFeedbackHandler( dbenv.api2_internal._pfx, msg); }
private static void doFeedback(IntPtr env, int opcode, int percent) { DB_ENV dbenv = new DB_ENV(env, false); dbenv.api2_internal.feedbackHandler( (EnvironmentFeedbackEvent)opcode, percent); }
private static int doBackupClose(IntPtr env, string dbname, IntPtr handle) { DB_ENV dbenv = new DB_ENV(env, false); return dbenv.api2_internal.backupObj.Close(dbname); }
private static int doBackupOpen(IntPtr env, string dbname, string target, IntPtr handle) { DB_ENV dbenv = new DB_ENV(env, false); return dbenv.api2_internal.backupObj.Open(dbname, target); }
internal static IntPtr __os_umalloc(DB_ENV dbenv, uint size) { return libdb_csharpPINVOKE.__os_umalloc(DB_ENV.getCPtr(dbenv), size); }
internal static void __os_ufree(DB_ENV dbenv, IntPtr ptr) { libdb_csharpPINVOKE.__os_ufree(DB_ENV.getCPtr(dbenv), ptr); }
internal static uint alloc_dbt_arr(DB_ENV dbenv, int num_dbt, out IntPtr ptr) { uint ret = libdb_csharpPINVOKE.alloc_dbt_arr(DB_ENV.getCPtr(dbenv), num_dbt, out ptr); return ret; }
private DatabaseEnvironment(uint flags) { dbenv = new DB_ENV(flags); initialize(); }
internal DB(DB_ENV env, uint flags) : this(libdb_csharpPINVOKE.new_DB(DB_ENV.getCPtr(env), flags), true) { }
internal static HandleRef getCPtr(DB_ENV obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
internal static IntPtr __os_umalloc(DB_ENV dbenv, uint size) { return(libdb_csharpPINVOKE.__os_umalloc(DB_ENV.getCPtr(dbenv), size)); }
private static int doIsAlive(IntPtr env, int pid, uint tid, uint flags) { DB_ENV dbenv = new DB_ENV(env, false); DbThreadID id = new DbThreadID(pid, tid); bool procOnly = (flags == DbConstants.DB_MUTEX_PROCESS_ONLY); return dbenv.api2_internal.isAliveHandler(id, procOnly) ? 1 : 0; }
internal static HandleRef getCPtr(DB_ENV obj) { return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr); }
internal static void __os_ufree(DB_ENV dbenv, IntPtr ptr) { libdb_csharpPINVOKE.__os_ufree(DB_ENV.getCPtr(dbenv), ptr); }
private static void doMessageDispatch(IntPtr env, IntPtr channel, IntPtr requestp, uint nrequest, uint cb_flags) { DB_ENV dbenv = new DB_ENV(env, false); DbChannel dbchannel = new DbChannel(new DB_CHANNEL(channel, false)); bool need_response = (cb_flags == DbConstants.DB_REPMGR_NEED_RESPONSE); IntPtr[] reqp = new IntPtr[nrequest]; Marshal.Copy(requestp, reqp, 0, (int)nrequest); DatabaseEntry[] requests = new DatabaseEntry[nrequest]; for (int i = 0; i < nrequest; i++) { requests[i] = DatabaseEntry.fromDBT(new DBT(reqp[i], false)); } dbenv.api2_internal.messageDispatchHandler( dbchannel, ref requests, out nrequest, need_response); }
internal static uint alloc_dbt_arr(DB_ENV dbenv, int num_dbt, out IntPtr ptr) { uint ret = libdb_csharpPINVOKE.alloc_dbt_arr(DB_ENV.getCPtr(dbenv), num_dbt, out ptr); return(ret); }
private static void doMsgFeedback(IntPtr env, string msg) { DB_ENV dbenv = new DB_ENV(env, false); dbenv.api2_internal.msgFeedbackHandler(msg); }