Exemplo n.º 1
0
        public bool TryOpenTable(string name, out EsentTable table)
        {
            CheckState();
            _tablesValid = false;
            var success = EsentTable.TryOpen(this, name, out table);

            if (success)
            {
                Holding.Add(table);
            }
            return(success);
        }
Exemplo n.º 2
0
        internal static EsentTable Create(EsentDatabase database, string name, int pages, int density)
        {
            var table = new EsentTable
            {
                Database = database,
                Name     = name
            };

            Api.JetCreateTable(database.Session.JetId, database.JetId, name, pages, density, out table.JetId);
            table.Opened = true;
            return(table);
        }
Exemplo n.º 3
0
        internal static EsentColumn Create <T>(EsentTable table, string name, Encoding encoding, int?max, object defaultValue, Option option)
        {
            var columnType = typeof(T);
            var column     = new EsentColumn
            {
                Table        = table,
                Name         = name,
                ColumnType   = columnType,
                Encoding     = encoding,
                Max          = max,
                DefaultValue = defaultValue,
                JetDef       = { grbit = (ColumndefGrbit)option }
            };
            var defaultValueBytes = ValueProcessor.GetBytes(defaultValue, encoding);
            var defaultValueSize  = defaultValueBytes?.Length ?? 0;

            Api.JetAddColumn(table.Database.Session.JetId, table.JetId, name, column.JetDef, defaultValueBytes, defaultValueSize, out column.JetId);
            return(column);
        }
Exemplo n.º 4
0
 public void DropTable(string name)
 {
     CheckState();
     _tablesValid = false;
     EsentTable.Drop(this, name);
 }
Exemplo n.º 5
0
 internal static void Drop(EsentTable table, string name)
 {
     Api.JetDeleteIndex(table.Database.Session.JetId, table.JetId, name);
 }
Exemplo n.º 6
0
 internal static void SetCurrent(EsentTable table, string name)
 {
     Api.JetSetCurrentIndex(table.Database.Session.JetId, table.JetId, name);
 }