function getIndexSQL(knjdb_index $index) { $sql = "CREATE INDEX " . $this->knjdb->conn->sep_col . $index->get("name") . $this->knjdb->conn->sep_col . " ON " . $this->knjdb->conn->sep_table . $index->getTable()->get("name") . $this->knjdb->conn->sep_table . " ("; $first = true; foreach ($index->getColumns() as $column) { if ($first == true) { $first = false; } else { $sql .= ", "; } $sql .= $this->knjdb->conn->sep_col . $column->get("name") . $this->knjdb->conn->sep_col; } $sql .= ");\n"; return $sql; }
function removeIndex(knjdb_table $table, knjdb_index $index){ $sql = "DROP INDEX " . $this->knjdb->conn->sep_index . $index->get("name") . $this->knjdb->conn->sep_index . " ON " . $this->knjdb->conn->sep_table . $table->get("name") . $this->knjdb->conn->sep_table; $this->knjdb->query($sql); unset($table->indexes[$index->get("name")]); }