Extended MySQLi classes. All of the methods that can return error, should throw exceptions when and only error occurs.
There are also some custom methods added to make some tasks easier.
- Classes:
MySQLie
,MySQLie_stmt
- Namespace:
Mireiawen\MySQLie
- MySQL Native Driver (mysqlnd)
- PHP 7
You can clone or download the code from the GitHub repository or you can use composer: composer require mireiawen/mysqlie
Only the custom methods are listed here, the overridden methods should behave like the original methods, except that the errors are thrown.
The main MySQLie class
MySQLie::escape_identifier(string $name)
Escape an identifier name for the SQL query
- string
$name
- The identifier name to escape
- string - The escaped identifier name
MySQLie::escape_query_identifiers(string $sql, array $identifiers)
Escape the identifiers in the SQL query
- string $sql - SQL query with placeholders (
%s
) for the identifiers - string[] $identifiers - Array of the identifiers to be escaped and placed into the query
- string - The SQL query with identifiers escaped and placed into the query
MySQLie::foreign_key_checks(bool $state)
Set the foreign key checks on or off
- bool $state - TRUE to enable foreign key checks, FALSE to disable them
- In case of database errors
MySQLie::get_autocommit()
- bool - The current
AUTOCOMMIT
status, TRUE if it is on, FALSE if it is off
- In case of database errors
MySQLie::get_autoincrement(string $table)
Get the table auto increment value
- string
$table
- The name of the table to get theAUTO_INCREMENT
value from
- int - The value of the table
AUTO_INCREMENT
- In case of database errors
MySQLie::truncate(string $table)
Truncates the given table to zero rows
- string
$table
- Name of the table to be truncated
- In case of database errors
MySQLie_stmt::fetch_assoc()
Fetch the result as an associative array
- array - An array of result rows
- In case of database errors
MySQLie_stmt::fetch_first()
Fetch the first row of the statement and return the result as an associative array
- array - A result row as an associative array
- In case of database errors