Download the PHP package falseclock/dbd-php without Composer
On this page you can find all versions of the php package falseclock/dbd-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download falseclock/dbd-php
More information about falseclock/dbd-php
Files in falseclock/dbd-php
Package dbd-php
Short Description Database driver for PHP (PostgreSQL, MySQL, MSSQL, OData, YellowERP, 1С)
License MIT
Informations about the package dbd-php
PostgreSQL Database driver for PHP
Why not standard PDO?
Actually, development of this library was started before PHP 5.0. Being mostly Perl developer and inspired by DBI::DBD library I tried to develop the same functionality for PHP.
Basic feature list:
- Much comfortable and easier than PDO
- SQL injections protection
- DBD/DBI perl-like library
- Easy caching integration
- Better error handling
- Measurements and debugging
- Extendable by other drivers (only PostgreSQL fully ready)
- Automatic conversion of records to object with dbd-php-entity library
Getting instance
Very and very easy:
Basic methods
- connect
- do
- query
- prepare
- execute
- fetch
- fetchRow
- fetchRowSet
- fetchArraySet
- insert
- update
- begin
- commit
- rollback
- cache
- isAffected
- escape
- affectedRows
- entityInsert
- entitySelect
- entityUpdate
- entityDelete
-
disconnect
-
- *
connect
- *
connect — initiate connection to a database
Description
connect() opens a connection to a database using Option instance provided in construction.
do
do — Returns number of affected records (tuples)
Description
do() returns the number of tuples (instances/records/rows) affected by INSERT, UPDATE, and DELETE queries.
Since PostgreSQL 9.0 and above, the server returns the number of SELECTed rows. Older PostgreSQL return 0 for SELECT.
Parameters
statement
The SQL statement to be executed. Can have placeholders. Must contain only a single statement (multiple statements separated by semi-colons are not allowed). If any parameters are used, they are referred to as ?, ?, etc.
params
An array of parameter values to substitute for the ?, ?, etc. placeholders in the original prepared SQL statement string. The number of elements in the array must match the number of placeholders.
Example
query
query — quick statement execution
Description
query() do the same as do() method, but returns self instance.
Parameters
statement
The SQL statement to be executed. Can have placeholders. Must contain only a single statement (multiple statements separated by semi-colons are not allowed). If any parameters are used, they are referred to as ?, ?, etc.
params
An array of parameter values to substitute for the ?, ?, etc. placeholders in the original prepared SQL statement string. The number of elements in the array must match the number of placeholders.
Example
prepare
prepare — creates a prepared statement for later execution with execute() method. This feature allows commands that will be used repeatedly to be parsed and planned just once, rather than each time they are executed.
Description
prepare() returns the new DB driver instance.
Parameters
statement
The SQL statement to be executed. Can have placeholders. Must contain only a single statement (multiple statements separated by semi-colons are not allowed). If any parameters are used, they are referred to as ?, ?, etc.
Example
execute
execute — Sends a request to execute a prepared statement with given parameters, and waits for the result.
Description
execute() executes previously-prepared statement, instead of giving a query string. This feature allows commands that will be used repeatedly to be parsed and planned just once, rather than each time they are executed. The statement must have been prepared previously.
Parameters
params
An array of parameter values to substitute for the ?, ?, etc. placeholders in the original prepared query string. The number of elements in the array must match the number of placeholders.
Example
fetch
fetch — Fetch a column from first row.
Description
fetch() fetch a column from first row without fetching whole row and not reducing result. Calling fetchrow() or fetchrowset() will still return whole result set. Subsequent fetch() invoking will return next column in a row. Useful when you need to get value of column when it is a same in all rows.
Example
fetchrow
fetchRow — fetch a row as an associative array
Description
fetchRow() returns an associative array that corresponds to the fetched row (records).
Return Values
An array indexed associatively (by field name). Each value in the array is represented as a string. Database NULL values are returned as NULL.
FALSE is returned if row exceeds the number of rows in the set, there are no more rows, or on any other error.
Example
fetchrowset
fetchRowSet — fetch a full result as multidimensional array, where each element is an associative array that corresponds to the fetched row.
Description
Parameters
key
A column name to use as an index. If two or more columns will have the same value in a column, only last row will be stored in array.
Return Values
An associative array (in case if key provided) or indexed array if no key was provided. Each value in the array represented as an associative array (by field name). Values in a row Database NULL values are returned as NULL.
Example
insert
insert — makes new row insertion into the table. Returns self instance.
Description
Parameters
table
Database table name
values
An associative array where key is field name and value is a field value.
return
You can define which fields of the table you want return after successful insert
Example 1
Example 2
update
update — makes updates of the rows by giving parameters and prepared values. Returns self instance.
Description
Parameters
table
Database table name
values
An associative array where key is field name and value is a field value.
where
Specifies update condition. Can have placeholders.
args
Binds value for where condition. Strict if placeholders are exist in where parameter. Can be omitted if there are no any placeholders in where parameter.
return
You can define which fields of the table you want return after succesfull insert
Example 1
Example 2
Example 3
Example 4
begin
begin — Starts database transaction
Description
begin() enable transactions (by turning AutoCommit off) until the next call to rollback, AutoCommit will automatically be turned on again.
Example
commit
commit — Commit database transaction
Description
commit() makes permanent the most recent series of database changes if the database supports transactions and AutoCommit is off.
rollback
rollback — undo changes
Description
rollback() undo the most recent series of uncommitted database changes if the database supports transactions and AutoCommit is off.
cache
cache — cache select result
Description
cache() bla bla la
All versions of dbd-php with dependencies
psr/simple-cache Version ^1.0.1
openlss/lib-array2xml Version ^1.0.0
falseclock/dbd-php-entity Version ^3.0.0
ext-json Version *
ext-simplexml Version *
ext-dom Version *