dev-master
9999999-dev https://github.com/yorch81/MyDbAbstract Class to manage RDBMS (MySQL, MSSQLServer, ODBC, PostgreSQL) connections
Apache-2.0
The Requires
- php >=5.4.0
- monolog/monolog 1.13.1
postgresql mysql odbc sql server abstract layer
Wallogit.com
2017 © Pedro Peláez
Abstract Class to manage RDBMS (MySQL, MSSQLServer, ODBC, PostgreSQL) connections
Abstract Class to manage RDBMS (MySQL, MSSQLServer, ODBC, PostgreSQL) connections, (*1)
Execute phpdoc -d MyDb/, (*2)
Create file composer.json, (*3)
{ "require": { "yorch/mydb": "dev-master" } }, (*4)
Execute composer.phar install, (*5)
// Mysql Example
$provider = 'MySQLDb';
$hostname = '';
$username = '';
$password = '';
$dbname = '';
$dbMySQL = MyDb::getInstance($provider, $hostname, $username, $password, $dbname, 3306);
$query = sprintf("SELECT 1 AS %s", $dbMySQL->escape($provider));
// Associate
print_r($dbMySQL->executeCommand($query));
// Enumerate
print_r($dbMySQL->executeCommand($query, null, MyDb::ENUM));
$dbMySQL = null;
The SQL Server connection only works in MS Windows., (*6)
For PostgreSQL the parameters in SQL Query must be $#. example: 'SELECT * FROM MYTABLE WHERE ID = $1 AND DESCRIPTION = $2', (*7)
For ODBC connection, if the query insert uses ? parameters throw this error (COUNT field incorrect or syntax error)., (*8)
Sorry, my english is bad :(., (*9)
http://es.wikipedia.org/wiki/Patr%C3%B3n_de_dise%C3%B1o, (*10)
http://es.wikipedia.org/wiki/Singleton, (*11)
http://es.wikipedia.org/wiki/Abstract_Factory, (*12)
P.D. Let's go play !!!, (*14)
Abstract Class to manage RDBMS (MySQL, MSSQLServer, ODBC, PostgreSQL) connections
Apache-2.0
postgresql mysql odbc sql server abstract layer