method createIndex documentation in bbn\Db\Languages\Sqlite

Creates an index

function(string $table, $column, bool $unique = false, $length = NULL, $order = NULL) { if (!\is_array($column)) { $column = [$column]; } $name = bbn\Str::encodeFilename($table); foreach ($column as $i => $c){ if (!bbn\Str::checkName($c)) { $this->error("Illegal column $c"); } $name .= '_'.$c; $column[$i] = '`'.$column[$i].'`'; if (!empty($length[$i]) && \is_int($length[$i]) && $length[$i] > 0) { $column[$i] .= '('.$length[$i].')'; } } $name = bbn\Str::cut($name, 50); if ($table = $this->tableFullName($table, 1)) { $query = 'CREATE '.( $unique ? 'UNIQUE ' : '' )."INDEX `$name` ON $table ( ".implode(', ', $column); if (($order === "ASC") || ($order === "DESC")) { $query .= ' '. $order .' );'; } else { $query .= ' );'; } X::log(['index', $query],'vito'); return (bool)$this->rawQuery($query); } return false; }

Creates an index 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.