yorch/mydb

Abstract Class to manage RDBMS (MySQL, MSSQLServer, ODBC, PostgreSQL) connections

dev-master 2017-10-11 23:10 UTC

This package is auto-updated.

Last update: 2024-03-29 03:19:06 UTC


README

Description

Abstract Class to manage RDBMS (MySQL, MSSQLServer, ODBC, PostgreSQL) connections

Requirements

Developer Documentation

Execute phpdoc -d MyDb/

Installation

Create file composer.json

{ "require": { "yorch/mydb": "dev-master" } }

Execute composer.phar install

Example

// 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;

Notes

The SQL Server connection only works in MS Windows.

For PostgreSQL the parameters in SQL Query must be $#. example: 'SELECT * FROM MYTABLE WHERE ID = $1 AND DESCRIPTION = $2'

For ODBC connection, if the query insert uses ? parameters throw this error (COUNT field incorrect or syntax error).

Sorry, my english is bad :(.

References

http://es.wikipedia.org/wiki/Patr%C3%B3n_de_dise%C3%B1o

http://es.wikipedia.org/wiki/Singleton

http://es.wikipedia.org/wiki/Abstract_Factory

Donate

Donate

P.D. Let's go play !!!