Download the PHP package emmanix2002/database-adapter without Composer
On this page you can find all versions of the php package emmanix2002/database-adapter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download emmanix2002/database-adapter
More information about emmanix2002/database-adapter
Files in emmanix2002/database-adapter
Package database-adapter
Short Description A simple package that abstracts away the process of connecting to a database using PDO and interacting with the connection
License MIT
Homepage https://github.com/emmanix2002/database-adapter
Informations about the package database-adapter
DatabaseAdapter
A simple package that abstracts away the process of connecting to a database using PDO
and interacting with the connection.
All code is written using PSR1 and PSR2 guidelines.
Install
Via Composer
Usage
We start by creating an instance of the class; it provides a utility create()
method that takes in the settings as an array and
fills in defaults where needed.
It is possible to change the defaults by calling the setDefault()
static method.
Usage: defaults
Usage: Querying
There are a few methods that help with querying, they are:
exec()
selectAll()
selectOne()
exec()
should be called directly for all queries that do not return an actual response i.e. every query excluding SELECT
statements. It is called by both select*()
methods, but it's much easier using them for SELECTing
as opposed to calling
exec()
yourself. exec()
uses prepared statements
on all queries passed to it.
Below are examples:
exec()
always returns a value; depending on the arguments passed:
true
: is returned if the query was successfully executed and the$isSelect
parameter is set toFALSE
false
: is returned if the query execution failed, irrespective of the value of the$isSelect
parameterarray
: is returned if the query was successful and the$isSelect
parameter is set toTRUE
.select*()
methods always set$isSelect
toTRUE
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Okeke Emmanuel
- All Contributors
License
The MIT License (MIT). Please see License File for more information.