Build a fixture record using the passed in values.

@param  string $tableName
@param  array $records
@return array
545969
public function buildRecords($tableName, array $records)
    {
        $insertedRecords = array();
        $this->tables[$tableName] = $tableName;

        foreach ($records as $recordName => $recordValues) {
            // Generate a hash for this record's primary key.  We'll simply hash the name of the
            // fixture into an integer value so that related fixtures don't have to rely on
            // an auto-incremented primary key when creating foreign keys.
            $recordValues = $this->setForeignKeys($recordValues);
            $recordValues = array_merge($recordValues, array('id' => $this->generateKey($recordName)));

            $fields = implode(', ', array_keys($recordValues));
            $values = array_values($recordValues);
            $placeholders = rtrim(str_repeat('?, ', count($recordValues)), ', ');
            $sql = "INSERT INTO $tableName ($fields) VALUES ($placeholders)";

            $sth = $this->db->prepare($sql);
            $sth->execute($values);

            $insertedRecords[$recordName] = (object) $recordValues;
        }

        return $insertedRecords;
    }
1190549
public function listTableDetails($tableName)
    {
        $columns     = $this->listTableColumns($tableName);
        $foreignKeys = [];
        if ($this->_platform->supportsForeignKeyConstraints()) {
            $foreignKeys = $this->listTableForeignKeys($tableName);
        }
        $indexes = $this->listTableIndexes($tableName);

        return new Table($tableName, $columns, $indexes, $foreignKeys);
    }
961012
protected function getRecord($tableName, $where = null)
    {
        $record = $this->database->table($tableName)->order('RAND()');
        return $where ?
            $record->where($where)->limit(1)->fetch() :
            $record->limit(1)->fetch();
    }
1127845
public function getTable($tableName)
    {
        if (is_array($tableName)) {
            list($tableName, $entitySuffix) = $tableName;
        } else {
            $entitySuffix = null;
        }

        if ($entitySuffix !== null) {
            $tableName .= '_' . $entitySuffix;
        }

        if (!isset($this->_tables[$tableName])) {
            $this->_tables[$tableName] = $this->_resources->getTableName(
                $tableName,
                ResourceConnection::DEFAULT_CONNECTION
            );
        }

        return $this->_tables[$tableName];
    }
798708
public function getTableColumns($tableName): array
    {
        $schema  = $this->getSchema();
        $columns = $schema->listTableColumns($tableName);

        return $columns;
    }
899478
protected function processFixture($fixture)
    {
        $tableName = basename($fixture, '.php');
        $records = include $fixture;

        if (!is_array($records)) {
            throw new Exceptions\InvalidFixtureDataException(
                "Invalid fixture: $fixture, please ensure this file returns an array of data.",
                1
            );

        }

        $this->fixtures[$tableName] = $this->driver->buildRecords($tableName, $records);
    }
1008643
public function buildRecords($tableName, array $records)
    {
        $insertedRecords = array();
        $this->tables[$tableName] = $tableName;

        foreach ($records as $recordName => $recordValues) {
            $model = $this->generateModelName($tableName);
            $record = $this->createModel($this->generateModelName($tableName));

            foreach ($recordValues as $columnName => $columnValue) {
                $camelKey = $this->camelCase($columnName);

                if (is_callable($columnValue)) {
                    $columnValue = call_user_func($columnValue, $recordValues);
                }

                // If a column name exists as a method on the model, we will just assume
                // it is a relationship and we'll generate the primary key for it and store
                // it as a foreign key on the model.
                if (method_exists($record, $camelKey)) {
                    $this->insertRelatedRecords($recordName, $record, $camelKey, $columnValue);

                    continue;
                }

                $record->$columnName = $columnValue;
            }

            $primaryKeyName = $record->getKeyName();
            list($table, $label) = $this->parseRecordLabel(
                $recordName[0] === "."
                ? $tableName . $recordName
                : $recordName
            );
            $record->$primaryKeyName = $this->generateKey($label, $table);
            $record->save();
            $insertedRecords[$label] = $record;
        }

        return $insertedRecords;
    }
575786
public function insert($tableName, array $data)
    {
        $query = sprintf("INSERT INTO $tableName (%s) VALUES (%s)",
            implode(', ', array_keys($data)), 
            implode(', ', array_fill(0, count($data), '?'))
        );

        $stmt = $this->prepare($query);
        $stmt->execute(array_values($data));
        return $stmt;
    }
175005
public function unlockMyRecords($tableName)
    {
        $results = $this->lockedRecordsByUser($tableName, Auth::user()->id);

        foreach($results as $result)
        {
            $this->unpopulateLockFields($result->id);
        }
    }
133216
public function getTable($tablename) {
        $i = $this->findTableInArray($tablename);
        if ($i !== null) {
            return $this->tables[$i];
        }
        return null;
    }
76494
public function listTableColumns(string $tableName) : array
    {
        $tableName = $this->tableMaybeInvalid($tableName);
        return $this
            ->getSchemaManager()
            ->listTableColumns($tableName);
    }
109536
public function GetTableColumnsMeta($tableName, $columnNames) {
        $tableColumnsMetadata = array();
        foreach ($columnNames as $columnName) {
            $this->setDbConfigList(array());
            $dbConfig = new \Puzzlout\Framework\Dal\DbStatementConfig(null, \Puzzlout\Framework\Dal\DbExecutionType::COLUMNMETAS, new \Puzzlout\Framework\Dal\DbQueryFilters());
            $dbConfig->setQuery("SHOW COLUMNS FROM `$tableName` WHERE `Field` = '$columnName';");
            $this->addDbConfigItem($dbConfig);
            $tableColumnsMetadata[$columnName] = $this->BindParametersAndExecute();
        }
        return $tableColumnsMetadata;
    }
574039
public function hasTable($tableName)
    {
        $dbMetadata = Source\Factory::createSourceFromAdapter($this->db);
        $tableNames = $dbMetadata->getTableNames();

        return in_array($tableName, $tableNames);
    }
30242
public function getTableKeys($tableName) {
		
		$keys = array();
		
		$fields = $this->describeTable($tableName);
		
		foreach ($fields as $field) {
			if ('PRI' == $field->Key) {
				$keys[] = $field->Field;
			}
		}
		
		return $keys;
		
	}
903487
public function createMany(array $records, array $joinings = [])
    {
        $instances = [];

        foreach ($records as $key => $record) {
            $instances[] = $this->create($record, (array) ($joinings[$key] ?? []), false);
        }

        $this->touchIfTouching();

        return $instances;
    }
301840
public function getTableColumnList($tableName) {

        if (!array_key_exists($tableName, $this->tableList)) {

            $this->addColumnMap($tableName, $this->getColumnMappingsFromConfig($tableName));
        }

        return $this->tableList[$tableName];
    }
824295
public function table($tableName)
    {
        return new Table(
            $this->dbManager,
            $this->connectionName,
            $tableName,
            $this->getStructure($this->connectionName)
        );
    }