This is used for creating new database objects such as tables.
@throws  HsqlException
767922
void checkDDLWrite() {

        checkReadWrite();

        if (isProcessingScript || isProcessingLog) {
            return;
        }

        if (database.isFilesReadOnly()) {
            throw Error.error(ErrorCode.DATABASE_IS_READONLY);
        }
    }
1323142
private void init()
    {
        jdbcProperties = new Properties();
        dbcpProperties = new Properties();
        setFetchSize(0);
        this.setTestOnBorrow(true);
        this.setTestOnReturn(false);
        this.setTestWhileIdle(false);
        this.setLogAbandoned(false);
        this.setRemoveAbandoned(false);
    }
1042307
private void createTables(Collection<HTableDescriptor> tableDescriptors)
      throws InterruptedException {
    try {
      Set<String> tablesCreated = Sets.newHashSet();
      Multimap<String, HTableDescriptor> pendingTableUpdates = ArrayListMultimap
          .create();
      for (HTableDescriptor tableDescriptor : tableDescriptors) {
        String tableName = Bytes.toString(tableDescriptor.getName());
        if (tablesCreated.contains(tableName)) {
          // We have to wait for the table async creation to modify
          // Just add the required columns to be added
          pendingTableUpdates.put(tableName, tableDescriptor);
        } else {
          LOG.info("Creating table " + tableName);
          hbaseAdmin.createTableAsync(tableDescriptor, new byte[][] {});
          tablesCreated.add(tableName);
        }
      }

      // Wait for the tables to be online
      for (int waitCount = 0;
           waitCount < MAX_SECOND_WAIT_FOR_TABLE_CREATION; waitCount++) {
        Iterator<String> iterator = tablesCreated.iterator();
        while (iterator.hasNext()) {
          String table = iterator.next();
          if (hbaseAdmin.isTableAvailable(table)) {
            // Perform any updates scheduled on the table
            if (pendingTableUpdates.containsKey(table)) {
              for (HTableDescriptor tableDescriptor : pendingTableUpdates
                  .get(table)) {
                // Add the new columns - synchronous calls
                modifyTable(table, tableDescriptor);
              }
            }
            iterator.remove();
          }
        }
        // If all tables are available, then break
        if (tablesCreated.isEmpty()) {
          break;
        }
        // Sleep for a second before checking again
        Thread.sleep(1000);
      }
    } catch (IOException e) {
      throw new DatasetException(e);
    }
  }
974787
@Override
    void start() throws InitializationException {
        if (hsqlServer == null) {
            hsqlServer = new Server();
            hsqlServer.setLogWriter(null);
            hsqlServer.setSilent(true);
            hsqlServer.setDatabaseName(0, EMBEDED_DB_NAME);
            hsqlServer.setDatabasePath(0, "file:" + EMBEDED_DB_FILE_NAME + ";user=" + getUname() + ";password="
                    + getPassword());
            hsqlServer.start();
        }
    }
4097
public function initialize()
	{
		//throw exception if no database type has been set
		if( ! $this->type )
		{
			//Throw exception
			throw new DbException("Invalid database type provided");
			
		}

		//check the type of  database provided returning instance
		//set the parameter to check in switch clause
		switch ($this->type ) 
		{
			case 'mysql':

				return new MySQL($this->options);

				break;
			
			default:

				throw new DbException("Valid database type provided");
				

				break;
		}

	}
1150694
protected void createSequence(PersistenceBroker broker, FieldDescriptor field,
                                  String sequenceName, long maxKey) throws Exception
    {
        Statement stmt = null;
        try
        {
            stmt = broker.serviceStatementManager().getGenericStatement(field.getClassDescriptor(), Query.NOT_SCROLLABLE);
            stmt.execute(sp_createSequenceQuery(sequenceName, maxKey));
        }
        catch (Exception e)
        {
            log.error(e);
            throw new SequenceManagerException("Could not create new row in "+SEQ_TABLE_NAME+" table - TABLENAME=" +
                    sequenceName + " field=" + field.getColumnName(), e);
        }
        finally
        {
            try
            {
                if (stmt != null) stmt.close();
            }
            catch (SQLException sqle)
            {
                if(log.isDebugEnabled())
                    log.debug("Threw SQLException while in createSequence and closing stmt", sqle);
                // ignore it
            }
        }
    }
1237259
public function createTable()
    {
        $bean = R::xdispense($this->tableName);
        R::store($bean);
        R::trash($bean);
    }
305935
private void createTables() throws SQLException {
        Statement stmt = this.conn.createStatement();

        stmt.execute(DbConstants.DROP_METADATA_STATEMENT);
        stmt.execute(DbConstants.DROP_INDEX_STATEMENT);
        stmt.execute(DbConstants.DROP_CATEGORY_MAP_STATEMENT);
        stmt.execute(DbConstants.DROP_DATA_STATEMENT);
        stmt.execute(DbConstants.DROP_CATEGORIES_STATEMENT);

        stmt.execute(DbConstants.CREATE_CATEGORIES_STATEMENT);
        stmt.execute(DbConstants.CREATE_DATA_STATEMENT);
        stmt.execute(DbConstants.CREATE_CATEGORY_MAP_STATEMENT);
        stmt.execute(DbConstants.CREATE_INDEX_STATEMENT);
        stmt.execute(DbConstants.CREATE_METADATA_STATEMENT);

        stmt.close();
    }
987548
public void () {

        HsqlArrayList set = new HsqlArrayList();

        Expression.collectAllExpressions(set, this, subqueryExpressionSet,
                                         emptyExpressionSet);

        if (!set.isEmpty()) {
            throw Error.error(ErrorCode.X_0A000,
                              "subquery in check constraint");
        }
    }
974644
private void prepareStatements() throws DatabaseException {
        for (PreparedStatementCveDb key : values()) {
            PreparedStatement preparedStatement = null;
            try {
                final String statementString = statementBundle.getString(key.name());
                if (key == INSERT_VULNERABILITY || key == INSERT_CPE) {
                    preparedStatement = connection.prepareStatement(statementString, new String[]{"id"});
                } else {
                    preparedStatement = connection.prepareStatement(statementString);
                }
            } catch (SQLException ex) {
                throw new DatabaseException(ex);
            } catch (MissingResourceException ex) {
                if (!ex.getMessage().contains("key MERGE_PROPERTY")) {
                    throw new DatabaseException(ex);
                }
            }
            if (preparedStatement != null) {
                preparedStatements.put(key, preparedStatement);
            }
        }
    }
1049659
private void createTables(Connection conn) throws DatabaseException {
        LOGGER.debug("Creating database structure");

        try (InputStream is = FileUtils.getResourceAsStream(DB_STRUCTURE_RESOURCE)) {
            final String dbStructure = IOUtils.toString(is, StandardCharsets.UTF_8);

            Statement statement = null;
            try {
                statement = conn.createStatement();
                statement.execute(dbStructure);
            } catch (SQLException ex) {
                LOGGER.debug("", ex);
                throw new DatabaseException("Unable to create database statement", ex);
            } finally {
                DBUtils.closeStatement(statement);
            }
        } catch (IOException ex) {
            throw new DatabaseException("Unable to create database schema", ex);
        }
    }
693023
private function Load()
	{
		$sql = "show tables";
		$rs = $this->Server->Connection->Select($sql);
		
		// first pass load all the tables.  this will initialize each object.  we have to
		// do this first so that we can correctly determine and store "Set" information
		while ($row = $this->Server->Connection->Next($rs))
		{
			$this->Tables[$row["Tables_in_" . $this->Name]] = new DBTable($this,$row);
		}
		
		// now load all the keys and constraints for each table
		foreach ($this->Tables as $table)
		{
			$table->LoadKeys();
		}

		$this->Server->Connection->Release($rs);
		
		$sql = "show table status from `" . $this->Name . "`";
		$rs2 = $this->Server->Connection->Select($sql);
		
		// load the extra data
		while ($row = $this->Server->Connection->Next($rs2))
		{
			$this->Tables[$row["Name"]]->Engine = $row["Engine"]; 
			$this->Tables[$row["Name"]]->Comment = $row["Comment"];
		}
		$this->Server->Connection->Release($rs2);
	}
1373904
public function createTable()
    {
        phpCAS::traceBegin();

        // initialize this PGTStorage object if it hasn't been initialized yet
        if ( !$this->isInitialized() ) {
            $this->init();
        }

        // initialize the PDO object for this method
        $pdo = $this->_getPdo();
        $this->_setErrorMode();

        try {
            $pdo->beginTransaction();

            $query = $pdo->query($this->createTableSQL());
            $query->closeCursor();

            $pdo->commit();
        }
        catch(PDOException $e) {
            // attempt rolling back the transaction before throwing a phpCAS error
            try {
                $pdo->rollBack();
            }
            catch(PDOException $e) {
            }
            phpCAS::error('error creating PGT storage table: ' . $e->getMessage());
        }

        // reset the PDO object
        $this->_resetErrorMode();

        phpCAS::traceEnd();
    }
1051183
public function init()
    {
        $this->createTableSQLCollector->init();
        $this->dropTableSQLCollector->init();
        $this->alterTableSQLCollector->init();

        $this->dropSequenceQueries = array();
        $this->dropViewQueries = array();
        $this->createViewQueries = array();
        $this->createSequenceQueries = array();
        $this->renameSchemaQueries = array();
    }
297527
protected function createDatabase()
    {
        /** @var Container $container */
        $container = $this->console->container;

        $dbService = $container->get(DatabaseService::class);
        $config    = $dbService->getDbConfig();

        // Auto create database
        $name = $config['name'];

        $config['name'] = null;

        $db = $dbService->createConnection('_preset', $config->toArray());

        $db->getDatabase($name)->create(true);

        $db->select($name);

        $config['name'] = $name;
    }
521929
public Table defineLocalTable(HsqlName tableName, HsqlName[] colNames, Type[] colTypes) {
        // I'm not sure the table type, here TableBase.CACHED_TABLE, matters
        // all that much.
    	assert(localTables != null);
        Table newTable = TableUtil.newTable(database, TableBase.CACHED_TABLE, tableName);
        TableUtil.setColumnsInSchemaTable(newTable, colNames, colTypes);
        newTable.createPrimaryKey(new int[0]);
        localTables.put(tableName.name, newTable);
        return newTable;
    }
1296622
public function create() {
        $migration = $this->getMessages();
        if (!$migration) {
            $this->db()->insert($this->table, array('migration' => get_class($this), 'state' => false));
        } else {
            throw new \Exception('Migration ' .  get_class($this) . ' already created');
        }
    }