Build the database structure

@return false
962615
private function _buildStructure()
    {
        $this->_query('DROP INDEX tag_id_index');
        $this->_query('DROP INDEX tag_name_index');
        $this->_query('DROP INDEX cache_id_expire_index');
        $this->_query('DROP TABLE version');
        $this->_query('DROP TABLE cache');
        $this->_query('DROP TABLE tag');
        $this->_query('CREATE TABLE version (num INTEGER PRIMARY KEY)');
        $this->_query('CREATE TABLE cache (id TEXT PRIMARY KEY, content BLOB, lastModified INTEGER, expire INTEGER)');
        $this->_query('CREATE TABLE tag (name TEXT, id TEXT)');
        $this->_query('CREATE INDEX tag_id_index ON tag(id)');
        $this->_query('CREATE INDEX tag_name_index ON tag(name)');
        $this->_query('CREATE INDEX cache_id_expire_index ON cache(id, expire)');
        $this->_query('INSERT INTO version (num) VALUES (1)');
    }
81431
protected function buildModel()
    {
        $config = $this->getGeneratorConfig();
        $con = $this->getConnection();

        $this->log('Reading database structure...');

        $database = new Database($this->getDatabaseName());
        $database->setPlatform($config->getConfiguredPlatform($con));
        $database->setDefaultIdMethod(IDMethod::NATIVE);
        $parser = $config->getConfiguredSchemaParser($con);
        $nbTables = $parser->parse($database, $this);

        $this->log(sprintf('Successfully reverse engineered %d tables', $nbTables));

        return $database;
    }
1024907
public function build()
    {
        $this->readConfigs();

        $files = $this->getSiteFiles();

        $otherFiles = array_filter($files, function ($file) {
            return ! str_contains($file->getRelativePath(), '_blog');
        });

        if (@$this->configs['enableBlog']) {
            $blogPostsFiles = array_filter($files, function ($file) {
                return str_contains($file->getRelativePath(), '_blog');
            });

            $this->readBlogPostsData($blogPostsFiles);
        }

        $this->buildViewsData();

        $this->filesystem->cleanDirectory(KATANA_PUBLIC_DIR);

        if ($this->forceBuild) {
            $this->filesystem->cleanDirectory(KATANA_CACHE_DIR);
        }

        $this->handleSiteFiles($otherFiles);

        if (@$this->configs['enableBlog']) {
            $this->handleBlogPostsFiles($blogPostsFiles);
            $this->buildBlogPagination();
            $this->buildRSSFeed();
        }
    }
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;
    }
448858
public function build()
    {
        foreach ($this->datasource as $index => $val) {

            $option = $this->createOption();

            // inner will always be used
            $option->setInner($val);
            $option->setValue($this->index_is_value ? $index : $val);

            // in dependence of the data type is value to be selected $val or $inner
            if (!empty($this->selected)) {
                // A list of selected?
                if (is_array($this->selected)) {
                    if (array_search(($this->index_is_value ? $index : $val), $this->selected)) {
                        $option->isSelected(1);
                    }
                } // Or a value to look for?
                else {
                    if ($this->selected == ($this->index_is_value ? $index : $val)) {
                        $option->isSelected(1);
                    }
                }
            }
        }

        return parent::build();
    }
938361
protected function _buildSQL()
	{
		if( $this->_stmt !== null ) {
			return $this->_stmt;
		}

		$i = 1;
		foreach( $this->_parts as $part )
		{
			$this->_stmt .= $part;
			if( isset( $this->_binds[$i] ) ) {
				$this->_stmt .= $this->_binds[$i];
			}
			$i++;
		}

		return $this->_stmt;
	}
351710
private final function build() {
        $temp = false;
        $str  = "";
        $tok  = explode("?", $this->sql);        

        try {
            //saber si la longitud de paramtros ? si son mayores que cero.
            $this->int = count($tok)-1 > 0 ? count($tok)-1 : 0;
               
            //saber si la longitud de interrogantes es igual a la longitud de parametros.
            if ($this->cima <= $this->int && $this->cima >= 0 && $this->list->lenght() <= $this->int) {

                //reemplasar interrogantes por parametros.
                for ($i = 0; $i <= $this->cima; $i++) {
                    $str = $str.$tok[$i].$this->list->shift().' ';
                }

                //saber si el remplaso fue exitoso.
                if (strlen($str) > 0) {
                    $this->generate  = $str;
                    $temp = true;
                }

            } else {
                die('Error longitud no admitida. ');
            }
            
        } catch (\Exception $exc) {
            $temp = false;
            
        } finally {
            return $temp;
            
        }
    }
842178
public function create () : bool
	{
        $dbObject 	= Database::getInstance();
		$attributes = $this->sanitizedAttributes();
		$sqlQuery	= "INSERT INTO ".static::$tableName." (";
		$sqlQuery  .= join(", ", array_keys($attributes));
	  	$sqlQuery  .= ") VALUES ('";
		$sqlQuery  .= join("', '", array_values($attributes));
		$sqlQuery  .= "')";
		$result 	= $dbObject->query($sqlQuery);
    	$this->id 	= $dbObject->insertId();
    	return ($result) ? TRUE : FALSE;
	}
51433
protected function buildDataProperties()
    {
        $properties = '';
        $hasAutoincrement = false;

        foreach ($this->columns as $column) {
            $properties .= "\n" . $column->getProperty();
            $hasAutoincrement |= $column->isAutoIncrement();
        }

        if ($hasAutoincrement) {
            $properties = '
    /**
     * @var bool $hasAutoIncrement If data has auto increment value.
     */
    protected $hasAutoIncrement = true;' . $properties;
        }

        $this->vars['properties'] = $properties;
    }
592520
protected function build()
    {
        foreach ($this->keys as $tag => $code) {
            $this->tags["<{$tag}>"]    = $code;
            $this->tags["</{$tag}>"]   = $code;
            $this->tags["<\\/{$tag}>"] = $code;
        }
    }
1193357
public function build()
    {

        $query = $this->getQuery();
        $manager = new BuildManager($this->getBase()->getConnection());
        $manager->setPage($this->page);
        $manager->setQuery($query);
        $manager->setParams($this->string['parameters']);

        return $manager;
    }
294989
public function build()
    {
        parent::build();

        $options = $this->suppliedOptions;

        $model        = $this->config->getDataModel();
        $relationship = $model->{$options['field_name']}();
        $relatedModel = $relationship->getRelated();

        $options['table']       = $relationship->getTable();
        $options['column']      = $relationship->getQualifiedForeignPivotKeyName();
        $options['column2']     = $relationship->getQualifiedRelatedPivotKeyName();
        $options['foreign_key'] = $relatedModel->getKeyName();

        $this->suppliedOptions = $options;
    }
40078
public function build()
    {
        /**
         * Query to be returned.
         *
         * @var string
         */
        $query = '';

        /**
         * Clauses which were built already.
         *
         * It is required to keep track of built clauses because some fields,
         * for example `join` is used by multiple clauses (`JOIN`, `LEFT JOIN`,
         * `LEFT OUTER JOIN`, etc.). The same happens for `VALUE` and `VALUES`.
         *
         * A clause is considered built just after fields' value
         * (`$this->field`) was used in building.
         *
         * @var array
         */
        $built = [];

        /**
         * Statement's clauses.
         *
         * @var array
         */
        $clauses = $this->getClauses();

        foreach ($clauses as $clause) {
            /**
             * The name of the clause.
             *
             * @var string
             */
            $name = $clause[0];

            /**
             * The type of the clause.
             *
             * @see self::$CLAUSES
             *
             * @var int
             */
            $type = $clause[1];

            /**
             * The builder (parser) of this clause.
             *
             * @var Component
             */
            $class = Parser::$KEYWORD_PARSERS[$name]['class'];

            /**
             * The name of the field that is used as source for the builder.
             * Same field is used to store the result of parsing.
             *
             * @var string
             */
            $field = Parser::$KEYWORD_PARSERS[$name]['field'];

            // The field is empty, there is nothing to be built.
            if (empty($this->$field)) {
                continue;
            }

            // Checking if this field was already built.
            if ($type & 1) {
                if (! empty($built[$field])) {
                    continue;
                }
                $built[$field] = true;
            }

            // Checking if the name of the clause should be added.
            if ($type & 2) {
                $query = trim($query) . ' ' . $name;
            }

            // Checking if the result of the builder should be added.
            if ($type & 1) {
                $query = trim($query) . ' ' . $class::build($this->$field);
            }
        }

        return $query;
    }
401255
public function build()
    {
        $sql = [
            $this->from->build(),
            $this->where->build(),
            $this->orderBy->build(),
            $this->limit->build(),
        ];

        $this->values = $this->where->getValues();

        return implode(' ', array_filter($sql));
    }
418419
private function buildTable() {
        $result = $this->getDbAdapter()->query('SHOW CREATE TABLE `' . $this->getName() . '`')->fetchAll();
        $rawResult = $result[0]['Create Table'];
        $rawResult = $this->buildLines($rawResult);
        $rawResult = trim($rawResult);
        if(preg_match('@^ENGINE=(?P<engine>[^ ]+) (AUTO_INCREMENT=\d+ )?DEFAULT CHARSET=(?P<defaultCharset>[^ ]+) COLLATE=(?P<collate>[^ ]+)$@', $rawResult, $matches)) {
            $this->setEngine($matches['engine']);
            $this->setDefaultCharset($matches['defaultCharset']);
            $this->setCollate($matches['collate']);
        }
    }
23049
public function buildCriteria()
    {
        $criteria = new Criteria(StructureNodeParentTableMap::DATABASE_NAME);

        if ($this->isColumnModified(StructureNodeParentTableMap::COL_STRUCTURE_NODE_ID)) {
            $criteria->add(StructureNodeParentTableMap::COL_STRUCTURE_NODE_ID, $this->structure_node_id);
        }
        if ($this->isColumnModified(StructureNodeParentTableMap::COL_PARENT_ID)) {
            $criteria->add(StructureNodeParentTableMap::COL_PARENT_ID, $this->parent_id);
        }

        return $criteria;
    }
512658
protected function build() : string {
    $table = $this->table;
    $mode = $this->mode;
    $columns = $this->columns;
    $where = $this->where;
    $values = $this->values;
    $data = $this->data;

    $query = '';

    switch ($mode) {
      case 'select':
        if (!empty($where)) {
          $query = "SELECT {$columns} FROM `{$table}` WHERE {$where}";
        } else {
          $query = "SELECT {$columns} FROM `{$table}`";
        }
        break;

      case 'insert':
        $query = "INSERT INTO `{$table}` ({$columns}) VALUES ({$values})";
        break;

      case 'update':
        if (!empty($where)) {
          $query = "UPDATE `{$table}` SET {$data} WHERE {$where}";
        } else {
          $query = "UPDATE `{$table}` SET {$data}";
        }
        break;

      case 'delete':
        if (!empty($where)) {
          $query = "DELETE FROM `{$table}` WHERE {$where}";
        } else {
          $query = "DELETE FROM `{$table}`";
        }
        break;
    }

    return $query;
  }