method getKeys documentation in bbn\Db\Languages\Mysql

Returns the keys of the given table.

function(string $table) { if (!$this->check()) { return null; } $r = []; if ($full = $this->tableFullName($table)) { $t = explode('.', $full); [$db, $table] = $t; $r = []; $indexes = $this->getRows('SHOW INDEX FROM ' . $this->tableFullName($full, 1)); $keys = []; $cols = []; foreach ($indexes as $i => $index) { $a = $this->getRow( <<getRow( << [$index['Column_name']], 'ref_db' => isset($a, $a['ref_db']) ? $a['ref_db'] : null, 'ref_table' => isset($a, $a['ref_table']) ? $a['ref_table'] : null, 'ref_column' => isset($a, $a['ref_column']) ? $a['ref_column'] : null, 'constraint' => isset($b, $b['name']) ? $b['name'] : null, 'update' => isset($b, $b['update']) ? $b['update'] : null, 'delete' => isset($b, $b['delete']) ? $b['delete'] : null, 'unique' => $index['Non_unique'] ? 0 : 1, ]; } else { $keys[$index['Key_name']]['columns'][] = $index['Column_name']; $keys[$index['Key_name']]['ref_db'] = $keys[$index['Key_name']]['ref_table'] = $keys[$index['Key_name']]['ref_column'] = null; } if (!isset($cols[$index['Column_name']])) { $cols[$index['Column_name']] = [$index['Key_name']]; } else { $cols[$index['Column_name']][] = $index['Key_name']; } } $r['keys'] = $keys; $r['cols'] = $cols; } return $r; }

Returns the keys of the given table. 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.