コード例 #1
0
ファイル: Database.cs プロジェクト: weimingtom/sharphsql_svn
        /// <summary>
        /// Database class constructor.
        /// </summary>
        /// <param name="name">The database name to open or create.</param>
        public Database(string name)
        {
            if (Trace.TraceEnabled)
            {
                Trace.Write();
            }

            _name    = name;
            _table   = new ArrayList();
            _access  = new Access();
            _channel = new Hashtable();
            _alias   = new Hashtable();
            _referentialIntegrity = true;

            Library.Register(_alias);

            _databaseInfo = new DatabaseInformation(this, _table, _access);

            bool    newdatabase = false;
            Channel sys         = new Channel(this, new User(null, null, true, null),
                                              true, false, 0);

            RegisterChannel(sys);

            if (name.Equals("."))
            {
                newdatabase = true;
            }
            else
            {
                _log        = new Log(this, sys, name);
                newdatabase = _log.Open();
            }

            if (newdatabase)
            {
                Execute("CREATE USER SA PASSWORD \"\" ADMIN", sys);
            }

            //_access.grant("PUBLIC", "CLASS \"SharpHSQL.Library\"", Access.ALL);
        }
コード例 #2
0
ファイル: Database.cs プロジェクト: furesoft/SharpHSQL
        /// <summary>
        /// Database class constructor.
        /// </summary>
        /// <param name="name">The database name to open or create.</param>
        public Database(string name)
        {
            if (TracingHelper.TraceEnabled)
            {
                TracingHelper.Write();
            }

            _name = name;
            _table = new ArrayList();
            _access = new Access();
            _channel = new Hashtable();
            _alias = new Hashtable();
            _referentialIntegrity = true;

            Library.Register(_alias);

            _databaseInfo = new DatabaseInformation(this, _table, _access);

            bool newdatabase = false;
            Channel sys = new Channel(this, new User(null, null, true, null),
                true, false, 0);

            RegisterChannel(sys);

            if (name.Equals("."))
            {
                newdatabase = true;
            }
            else
            {
                _log = new Log(this, sys, name);
                newdatabase = _log.Open();
            }

            if (newdatabase)
            {
                Execute("CREATE USER SA PASSWORD \"\" ADMIN", sys);
            }

            //_access.grant("PUBLIC", "CLASS \"SharpHSQL.Library\"", Access.ALL);
        }