コード例 #1
0
        public VistaDBLocalConnection(VistaDBDatabase db) : this()
        {
            if (!VistaDBAPI.ivsql_AssignDatabaseConnection(this.connectionID, db.DatabaseId, null, true, false, 0, null, db.CaseSensitive))
            {
                throw new VistaDBException(VistaDBErrorCodes.DatabaseNotOpened);
            }

            db.FreeDatabase();

            this.cultureID       = db.Locale;
            this.caseSensitivity = db.CaseSensitive;
            this.opened          = true;
        }
コード例 #2
0
        public VistaDBLocalConnection(int cultureID, bool caseSensitive) : this()
        {
            int dbID = VistaDBAPI.ivdb_CreateDatabase(null, null, false, false, (uint)cultureID,
                                                      (uint)VDBDatabaseParam.InMemory, null, 0, caseSensitive);

            try
            {
                if (!VistaDBAPI.ivsql_AssignDatabaseConnection(this.connectionID, dbID, null, true, false, 0, null, caseSensitive))
                {
                    throw new VistaDBException(VistaDBErrorCodes.DatabaseNotOpened);
                }

                this.cultureID       = cultureID;
                this.caseSensitivity = caseSensitivity;
                this.opened          = true;
            }
            catch
            {
                VistaDBAPI.ivdb_SelectDb(dbID);
                VistaDBAPI.ivdb_CloseDatabase();
                throw;
            }
        }