예제 #1
0
        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);
        }
예제 #2
0
 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);
 }
예제 #3
0
        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);
        }
예제 #4
0
 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;
 }
예제 #5
0
 /* Called by Databases with private environments. */
 internal DatabaseEnvironment(DB_ENV dbenvp)
 {
     dbenv = dbenvp;
     initialize();
 }
예제 #6
0
 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;
 }
예제 #7
0
 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);
 }
예제 #8
0
        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);
        }
예제 #9
0
 internal DB(DB_ENV env, uint flags) : this(libdb_csharpPINVOKE.new_DB(DB_ENV.getCPtr(env), flags), true)
 {
 }
예제 #10
0
 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);
 }
예제 #11
0
 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);
 }
예제 #12
0
 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);
 }
예제 #13
0
 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);
 }
예제 #14
0
 internal static IntPtr __os_umalloc(DB_ENV dbenv, uint size)
 {
     return libdb_csharpPINVOKE.__os_umalloc(DB_ENV.getCPtr(dbenv), size);
 }
예제 #15
0
 internal static void __os_ufree(DB_ENV dbenv, IntPtr ptr)
 {
     libdb_csharpPINVOKE.__os_ufree(DB_ENV.getCPtr(dbenv), ptr);
 }
예제 #16
0
 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;
 }
예제 #17
0
 private DatabaseEnvironment(uint flags)
 {
     dbenv = new DB_ENV(flags);
     initialize();
 }
예제 #18
0
파일: DB.cs 프로젝트: mcandre/db
 internal DB(DB_ENV env, uint flags)
     : this(libdb_csharpPINVOKE.new_DB(DB_ENV.getCPtr(env), flags), true)
 {
 }
예제 #19
0
 internal static HandleRef getCPtr(DB_ENV obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
예제 #20
0
 internal static IntPtr __os_umalloc(DB_ENV dbenv, uint size)
 {
     return(libdb_csharpPINVOKE.__os_umalloc(DB_ENV.getCPtr(dbenv), size));
 }
예제 #21
0
 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;
 }
예제 #22
0
 internal static HandleRef getCPtr(DB_ENV obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
예제 #23
0
 internal static void __os_ufree(DB_ENV dbenv, IntPtr ptr)
 {
     libdb_csharpPINVOKE.__os_ufree(DB_ENV.getCPtr(dbenv), ptr);
 }
예제 #24
0
 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);
 }
예제 #25
0
        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);
        }
예제 #26
0
 private static void doMsgFeedback(IntPtr env, string msg)
 {
     DB_ENV dbenv = new DB_ENV(env, false);
     dbenv.api2_internal.msgFeedbackHandler(msg);
 }