示例#1
0
        public static Database GetDatabase(string type, string path, LibCoreProperties props)
        {
            Database db = GetDatabaseObject(type, path, props);

            lock (db)
            {
                int state = db.GetState();
                if (state <= 4)
                {
                    switch (state)
                    {
                    case 1:
                        return(db);

                    case 4:
                        goto Label_004A;
                    }
                    return(db);
                }
                if (state != 8)
                {
                    if (state == 0x10)
                    {
                        if (LookupDatabaseObject(type, path) == null)
                        {
                            AddDatabaseObject(type, path, db);
                        }
                        db.Open();
                    }
                    return(db);
                }
Label_004A:
                throw Error.GetError(0x1c3, 0x17);
            }
            return(db);
        }
示例#2
0
        public static Session NewSession(string type, string path, string user, string password, LibCoreProperties props, string zoneString, int timeZoneSeconds)
        {
            Database database = GetDatabase(type, path, props);

            if (database == null)
            {
                return(null);
            }
            return(database.Connect(user, password, zoneString, timeZoneSeconds));
        }