method modelize documentation in bbn\Db\Languages\Sql
Return the table's structure as an indexed array.
Example
X::dump($db->modelize("table_users"));
// (array) [keys] => Array ( [PRIMARY] => Array ( [columns] => Array ( [0] => userid [1] => userdataid ) [ref_db] => [ref_table] => [ref_column] => [unique] => 1 ) [table_users_userId_userdataId_info] => Array ( [columns] => Array ( [0] => userid [1] => userdataid [2] => info ) [ref_db] => [ref_table] => [ref_column] => [unique] => 0 ) ) [cols] => Array ( [userid] => Array ( [0] => PRIMARY [1] => table_users_userId_userdataId_info ) [userdataid] => Array ( [0] => PRIMARY [1] => table_users_userId_userdataId_info ) [info] => Array ( [0] => table_users_userId_userdataId_info ) ) [fields] => Array ( [userid] => Array ( [position] => 1 [null] => 0 [key] => PRI [default] => [extra] => [signed] => 1 [maxlength] => 11 [type] => int ) [userdataid] => Array ( [position] => 2 [null] => 0 [key] => PRI [default] => [extra] => [signed] => 1 [maxlength] => 11 [type] => int ) [info] => Array ( [position] => 3 [null] => 1 [key] => [default] => NULL [extra] => [signed] => 0 [maxlength] => 200 [type] => varchar ) )
function($table = NULL, bool $force = false)
{
$r = [];
$tables = false;
if (empty($table) || ($table === '*')) {
$tables = $this->getTables();
}
elseif (\is_string($table)) {
$tables = [$table];
}
elseif (\is_array($table)) {
$tables = $table;
}
if (\is_array($tables)) {
foreach ($tables as $t) {
if ($full = $this->tableFullName($t)) {
$r[$full] = $this->_get_cache($full, 'columns', $force);
}
}
if (\count($r) === 1) {
return end($r);
}
return $r;
}
return null;
}
Return the table's structure as an indexed array. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions