Download the PHP package simplecomplex/database without Composer
On this page you can find all versions of the php package simplecomplex/database. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download simplecomplex/database
More information about simplecomplex/database
Files in simplecomplex/database
Package database
Short Description Database abstraction for transparent MariaDB, MS SQL interaction.
License MIT
Homepage https://github.com/simplecomplex/php-database
Informations about the package database
(PHP) Database
- Database engine specifics
- Examples - MariaDB/MySQL
- Examples - MS SQL
- Requirements
Scope
Compact cross-engine relational database abstraction which handles common engine-specific peculiarities.
Features
- uniform classes and methods across database engines
- client - query - result architecture
- chainable methods
- a database broker to keep track of all created clients
- extensive error handling/logging and defensive code style
Client
- auto-reconnects, when reasonable
- safe transaction handling
- all connection options supported
Query
- auto-detects parameter types when no type string (i|d|s|b) given
- ?-parameter substitution in non-prepared statements
Result
- affected rows, insert ID, number of rows, number of columns
- fetch array/object, fetch all rows
- moving to next set/row
MariaDB/MySQL features
- multiple selecting queries, append query
- result mode use; store only for non-prepared statement
- number of rows not supported for prepared statement (because use)
MS SQL features
- automated typed arguments handling (SQLSRV_PARAM_IN etc.)
- automated insert ID retrieval
- result mode (SQLSRV_CURSOR_FORWARD etc.) defense against wrong use
Database engine specifics
MariaDB/MySQL (PHP MySQLi/mysqlnd)
A MariaDB/MySQL multi-query is an SQL string containing more queries delimited by semicolon.
Every query may be a SELECT (or likewise) producing a result set.
PHP's MySQLi extension only offers native ?-parameter substitution for prepared statements,
however the ** method mends that (somewhat); for simple statements.
Still, go for prepared statements if security is the major concern**.
The MySQLi extension encompasses around 100 functions/methods/properties. Fairly confusing; this abstraction only utilizes a dozen or so of them.
MS SQL (PHP Sqlsrv)
PHP's Sqlsrv offers native ?-parameter substitution for simple statements as well as prepared statements.
There's no MS SQL result mode which supports (INSERT) affected-rows as well as (SELECT) num-rows.
So care should be taken to use 'forward' when inserting and 'static' or 'keyset' when selecting;
use **** option .
MS SQL/Sqlsrv has no direct means for getting insert ID, but supports likewise via a 'magic' query
appended to an INSERT statement.
+ handles the issue transparently when **** receives the option .
The Sqlsrv extension is a well-made tight no-nonsense API consisting of 20-odd functions.
Examples
MariaDB/MySQL
MS SQL
Requirements
MariaDB equires the mysqlnd driver (PHP default since v. 5.4), or better.
Suggestions
- PHP MySQLi extension, if using MariaDB/MySQL database
- PHP (PECL) Sqlsrv extension, if using MS SQL database
- SimpleComplex Inspect Great for logging; better variable dumps and traces.
All versions of database with dependencies
ext-ctype Version *
psr/log Version ^1.0
simplecomplex/time Version ^1 || dev-develop
simplecomplex/utils Version ^2.2 || dev-develop
simplecomplex/validate Version ^2.5 || dev-develop