Download the PHP package davahome/database without Composer
On this page you can find all versions of the php package davahome/database. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package database
davahome/database
davahome/database is a small php library which provides a very simple PDO based MySQL wrapper. Its main functionality is to provide some additional functionality to the basic PDO object.
The DavaHome\Database\Adapter\MySQL
class is directly derived from PDO and provides all of its methods. There are some additional features like:
- PDO Statement Cache (Reuse of PDO statements if the query hasn't changed)
- Basic operations as methods (Like select, delete, and more)
Installation
Basic Operation Methods
These methods are forced by the DavaHome\Database\Adapter\AdapterInterface
and are supported by all database handlers
select
Select rows from database. The where statement is an associative array with tableColumn => value
convention.
update
Update existing rows in the database. The values are an associative array, exactly like the where
statement from the select method.
insert
Insert a new row into the database. The values are an associative array, exactly like the where
statement from the select method.
delete
Delete existing rows from the database. The where statement is identical to the select method.
Mysql
Example
Additional Mysql methods
createUuid
This method creates a uuid which can be used as non-incremental unique index. See the MySQL documentation for further information.
execute
Creates a prepared statement which will be executed directly
setIsolationLevel
Set the isolation level of transactions in the current connection
Advanced queries
To provide a more advanced functionality for the basic operation methods there are additional classes.
DirectValue
The DirectValue class allows to use MySQL functions or a increment-queries through the basic operation methods. All arguments given to the DirectValue class will be passed 1-2-1 into the query. There will be no escaping for those values!
CustomOperator
The CustomOperator class allows to override the default operator used by all basic operation methods (=
). You can also combine the CustomOperator with the DirectValue class.
All versions of database with dependencies
ext-pdo Version *
ext-json Version *