method createDatabase documentation in bbn\Db\Engines
Creates a database
function(string $database)
{
/**
* Drops a database
*
* @param string $database
* @return bool
*/
public function dropDatabase(string $database): bool;
/**
* Drops a table
*
* @param string $table
* @param string $database or currently selected
* @return bool
*/
public function dropTable(string $table, string $database = ''): bool;
/**
* Gets the size of a database
*
* @param string $database
* @param string $type
* @return int Size in bytes
*/
public function dbSize(string $database = '', string $type = ''): int;
/**
* Gets the size of a table
*
* @param string $table
* @param string $type
* @return int Size in bytes
*/
public function tableSize(string $table, string $type = ''): int;
/**
* Gets the status of a table
*
* @param string $table
* @param string $database
* @return mixed
*/
public function status(string $table = '', string $database = '');
/**
* Returns a UUID
*
* @return string|null
*/
public function getUid(): ?string;
/**
* Starts fancy stuff.
*
* @return $this
*/
public function startFancyStuff(): self;
/**
* Stops fancy stuff.
*
* @return $this
*/
public function stopFancyStuff(): self;
/**
* @param array $args
* @param bool $force
* @return array|null
*/
public function processCfg(array $args, bool $force = false): ?array;
/**
* @param array $cfg
* @return array|null
*/
public function reprocessCfg(array $cfg): ?array;
/**
* Changes the value of last inserted id.
*
* @param string $id
* @return $this
*/
public function setLastInsertId($id = ''): self;
/**
* Return the last inserted ID.
*
* @return mixed
*/
public function lastId();
/**
* Return the last query for this connection.
*
* @return string|null
*/
public function last(): ?string;
/**
* Return the table's structure as an indexed array.
*
* @param null $table
* @param bool $force
* @return array|null
*/
public function modelize($table = null, bool $force = false): ?array;
/**
* @param array $cfg
* @return array
*/
public function getQueryValues(array $cfg): array;
/**
* @param array $where
* @param bool $full
* @return array|bool
*/
public function treatConditions(array $where, bool $full = true);
/**
* Enable the triggers' functions
*
* @return self
*/
public function enableTrigger(): self;
/**
* Disable the triggers' functions
*
* @return $this
*/
public function disableTrigger(): self;
/**
* @return bool
*/
public function isTriggerEnabled(): bool;
/**
* @return bool
*/
public function isTriggerDisabled(): bool;
/**
* @param callable $function
* @param array|string|null $kind
* @param array|string|null $moment
* @param null|string|array $tables
* @return self
*/
public function setTrigger(callable $function, $kind = null, $moment = null, $tables = '*' ): self;
/**
* @return array
*/
public function getTriggers(): array;
/**
* @param $tables
* @return array
*/
public function getFieldsList($tables): array;
/**
* @param string $col
* @param string $table
* @param string|null $db
* @return array
*/
public function getForeignKeys(string $col, string $table, string $db = null): array;
/**
* find_relations
*
* @param $column
* @param string $db
* @return array|bool
*/
public function findRelations($column, string $db = ''): ?array;
/**
* Return primary keys of a table as a numeric array.
*
* @param string $table The table's name
* @return array
*/
public function getPrimary(string $table): array;
/**
* Deletes all the queries recorded and returns their (ex) number.
*
* @return int
*/
public function flush(): int;
/**
* @return int
*/
public function countQueries(): int;
/**
* @param $statement
* @return mixed
*/
public function query($statement);
/**
* Executes the given query with given vars, and extracts the first cell's result.
*
* @return mixed
*/
public function getOne();
/**
* Return an array indexed on the first field of the request.
* The value will be an array if the request has more than two fields.
*
* @return array|null
*/
public function getKeyVal(): ?array;
/**
* Return an array with the values of single field resulting from the query.
*
* @param string query
* @param mixed values
* @return array
*/
public function getColArray(): array;
/**
* Return a count of identical values in a field as array, Reporting a structure type 'num' - 'val'.
*
* @param $table
* @param string|null $field
* @param array $where
* @param array $order
* @return array|null
*/
public function countFieldValues($table, string $field = null, array $where = [], array $order = []): ?array;
/**
* Return a numeric indexed array with the values of the unique column ($field) from the selected $table
*
* ```php
* X::dump($db->getColumnValues('table_users','surname',['id','>',1]));
* /*
* array [
* "Smith",
* "Jones",
* "Williams",
* "Taylor"
* ]
* ```
*
* @param string|array $table The table's name or a configuration array
* @param string|null $field The field's name
* @param array $where The "where" condition
* @param array $order The "order" condition
* @param int $limit
* @param int $start
* @return array
*/
public function getColumnValues($table, string $field = null, array $where = [], array $order = [], int $limit = 0, int $start = 0): ?array;
/**
* Return an indexed array with the first result of the query or false if there are no results.
*
* @param string $query
* @return array|false
*/
public function fetch(string $query);
/**
* Return an array of indexed array with all results of the query or false if there are no results.
*
* @param string $query
* @return array|false
*/
public function fetchAll(string $query);
/**
* @param $query
* @param int $num
* @return mixed
*/
public function fetchColumn($query, int $num = 0);
/**
* @param $query
* @return bool|\stdClass
*/
public function fetchObject($query);
/**
* @return array
*/
public function getCfg(): array;
/**
* Gets the created hash.
*
* @return string
*/
public function getHash(): string;
/**
* Checks if the database is ready to process a query.
* @return bool
*/
public function check(): bool;
/**
* Sets the error mode.
*
* @param string $mode
*/
public function setErrorMode(string $mode);
/**
* @return string
*/
public function getErrorMode(): string;
/**
* Returns the last error.
*
* @return string|null
*/
public function getLastError(): ?string;
/**
* Returns the current database selected by the current connection.
*
* @return string|null
*/
public function getCurrent(): ?string;
/**
* Returns the host of the current connection.
*
* @return string|null
*/
public function getHost(): ?string;
/**
* @return string
*/
public function getConnectionCode();
/**
* Return the last config for this connection.
*
* @return array|null
*/
public function getLastCfg(): ?array;
/**
* @param array $cfg The user's options
* @return array|null The final configuration
*/
}
Creates a database 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-2024
BBN Solutions