@param string $table
@param string $key

@return string
343608
public function get_field( $table, $key ) {
		return $this->app->utility->array_get( $this->app->utility->array_get( $this->get_columns( $table ), $key, [] ), 'name', $key );
	}
690701
function setBackReference( $table, $name, $key ) {

        $this->backReferences[ $table ][ $name ] = $key;

        return $this;

    }
1154784
public function addForeignKey($name, $table, $key)
    {
        //argument test
        Argument::i()
            ->test(1, 'string')         //Argument 1 must be a string
            ->test(2, 'string')         //Argument 2 must be a string
            ->test(3, 'string');    //Argument 3 must be a string
        
        $this->keys[$name] = array($table, $key);
        return $this;
    }
1065272
public function buildCache($table = null, $key = null, $cache = null)
    {
        if ($this->sql &&
            ($table === null || $this->setTableName($table)) &&
            ($key === null || $this->setKeyName($key)) &&
            ($cache === null || $this->setCacheName($cache))) {
            if ($this->sql->query("
                CREATE TABLE IF NOT EXISTS `{$this->table}` (
                    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
                    `{$this->key}` text NOT NULL,
                    `{$this->cache}` longtext NOT NULL,
                    `expire` timestamp NULL DEFAULT NULL,
                    `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                    PRIMARY KEY (`id`)
                );
            ")) {
                $this->initialized = true;

                /* Upgrade older cache tables for longer cache data */
                $this->sql->query("
                    ALTER TABLE `{$this->table}` CHANGE `{$this->cache}` `{$this->cache}` longtext NOT NULL;
                ");

                /* Upgrade older cached tables to include an expire column for each row */
                $this->sql->query("
                    ALTER TABLE `{$this->table}` ADD `expire` timestamp NULL DEFAULT NULL AFTER `{$this->cache};
                ");
            }
        }
        return $this->initialized;
    }
1249539
private static function collect($data, $table, $key)
    {
        $class = get_called_class();
        $object = new $class();
        $collection = new Collection();
        //
        if (Table::count($data) > 0) {
            foreach ($data as $row) {
                $rows[0] = $row;
                //
                $value =
                [
                    'name'        => $object->_model,
                    'prifixTable' => $object->_prifixTable,
                    'columns'     => $object->_columns,
                    'key'         => $object->_keyName,
                    'values'      => $rows,
                ];
                //
                $collection->add(new $class($value));
            }
        }
        //
        return $collection;
    }
732178
protected function getAddKeySQL($table, $keys)
	{
		$sql = 'ALTER TABLE ' . $this->db->quoteName($table) . ' ADD ' . $this->getKeySQL($keys);

		return $sql;
	}
1295908
public function delete($key)
    {
        $query = sprintf('DELETE FROM `%s` WHERE `key` = :key', $this->table);
        $stmt = $this->pdo->prepare($query);

        return $stmt->execute(array(
            ':'.ConstProviderInterface::CACHE_PARAM_KEY => $key,
        ));
    }
1128054
protected function getAddKeySql($table, $keys)
	{
		$sql = 'ALTER TABLE ' . $this->db->quoteName($table) . ' ADD ' . $this->getKeySql($keys);

		return $sql;
	}
148513
protected function createTable($tableName, $table) {
		$res = "\$this->schema->create('$tableName', function(\$table) {";

		foreach($table->getColumns() as $colName=>$col)
			$res .= $this->createColumn($colName, $col);

		foreach($table->getIndexes() as $index)
			$res .= $this->createIndex($index);

		foreach($table->getForeignKeys() as $key)
			$res .= $this->createForeignKey($key);

		$res .= "\n});\n\n";

		return $res;
	}
1149088
public function addForeignKey($name, $table, $key)
    {
        $this->keys[$name] = [$table, $key];
        return $this;
    }
991989
public static function filterCacheKey(string $key): string
    {
        $key = preg_replace('#[/-]#', '.', $key);
        $key = preg_replace('#[^A-Za-z0-9_\.]#', '_', $key);

        return strtolower($key);
    }
1336397
public function addForeignKey($name, $table, $key)
    {
        $this->addKeys[$name] = [$table, $key];
        return $this;
    }
1227263
public function currval($table, $pkey){
        $stmt = $this->query("SELECT currval('{$table}_{$pkey}_seq')");

        if (!$stmt)
            return false;

        $ret = $stmt->fetch(PDO::FETCH_NUM);
        if (!$ret){
            $stmt = null;
            return false;
        }

        $stmt = null;
        return $ret[0];
    }
1219874
public function getPrimaryKey($table)
    {
        $query = $this->getUtilityQuery();
        $results = $this->getColumns($table, "`Key` = 'PRI'");
        return isset($results[0]['Field']) ? $results[0]['Field'] : null;
    }
1260097
public function parseKey($key)
	{
		$segments = parent::parseKey($key);

		if (is_null($segments[0])) $segments[0] = '*';

		return $segments;
	}
1351603
function setPrimary( $table, $key ) {

        $this->primary[ $table ] = $key;

        // compound keys are never auto-generated,
        // so we can assume they are required
        if ( is_array( $key ) ) {

            foreach ( $key as $k ) {

                $this->setRequired( $table, $k );

            }

        }

        return $this;

    }
133836
public function getPrimaryKey($table)
    {
        //Argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        $query = $this->utility();
        $results = $this->getColumns($table, "`Key` = 'PRI'");
        return isset($results[0]['Field']) ? $results[0]['Field'] : null;
    }