public BDB43(string file, string table, bool create, DBFormat format, bool allowDuplicates, Env environment) { this.env = environment; db_create(out dbp, environment.envptr, 0); funcs = (dbstruct)Marshal.PtrToStructure((IntPtr)((int)dbp + 268), typeof(dbstruct)); uint dbflags = DB_DIRECT_DB; if (allowDuplicates) { dbflags |= DB_DUP; // DB_DUPSORT; } funcs.set_flags(dbp, dbflags); int type = (int)format; uint flags = DB_DIRTY_READ; // | DB_AUTO_COMMIT; int chmod_mode = 0; if (create) { flags |= DB_CREATE; } // if file & database are null, db is held in-memory // on file is taken as UTF8 (is this call right?) int ret = funcs.open(dbp, env.Txn, file, table, type, flags, chmod_mode); CheckError(ret); binfmt = new Serializer(); }
public BDB43(string file, string table, bool create, DBFormat format, bool allowDuplicates, Env environment) { this.env = environment; db_create(out dbp, environment.envptr, 0); funcs = (dbstruct)Marshal.PtrToStructure((IntPtr)((int)dbp+268), typeof(dbstruct)); uint dbflags = DB_DIRECT_DB; if (allowDuplicates) dbflags |= DB_DUP; // DB_DUPSORT; funcs.set_flags(dbp, dbflags); int type = (int)format; uint flags = DB_DIRTY_READ; // | DB_AUTO_COMMIT; int chmod_mode = 0; if (create) flags |= DB_CREATE; // if file & database are null, db is held in-memory // on file is taken as UTF8 (is this call right?) int ret = funcs.open(dbp, env.Txn, file, table, type, flags, chmod_mode); CheckError(ret); binfmt = new Serializer(); }
public BDB46(string file, string table, bool create, DBFormat format, bool allowDuplicates, Env environment) { if (format == DBFormat.Recno) KeyType = DataType.UInt; this.env = environment; int offset = 296; if (IntPtr.Size == 8) offset = 504; db_create(out dbp, environment.envptr, 0); funcs = (dbstruct)Marshal.PtrToStructure((IntPtr)((int)dbp + offset), typeof(dbstruct)); this.m_Format = format; this.m_File = file; int type = (int)format; uint flags = DB_DIRTY_READ; // | DB_AUTO_COMMIT; int chmod_mode = 0; if (create) flags |= DB_CREATE; /* needed for my renumber stuff. this shit is so hacked, i dont even care about * maintaining compat at this point. oh well. * * -- Christian */ this.funcs.set_flags (dbp, DB_RENUMBER); // if file & database are null, db is held in-memory // on file is taken as UTF8 (is this call right?) int ret = funcs.open(dbp, env.Txn, file, table, type, flags, chmod_mode); CheckError(ret); binfmt = new Serializer(); }