Yorch MyDb: Execute queries on MySQL, SQLServer, PostgreSQL

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 184 All time: 8,484 This week: 242Up
Version License PHP version Categories
yorch-mydb 1.0.2Custom (specified...5PHP 5, Databases
Description Author

This package can execute queries on MySQL, SQLServer, PostgreSQL and ODBC.

There is a factory class that can instantiate driver classes that can access different database types.

The same class can also execute prepared queries and return results in arrays by calling the driver classes.

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

Picture of Yorch Ponce
Name: Yorch Ponce <contact>
Classes: 6 packages by
Country: Mexico Mexico
Age: 39
All time rank: 219324 in Mexico Mexico
Week rank: 63 Up1 in Mexico Mexico Up
Innovation award
Innovation award
Nominee: 1x

Details

MyDb

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 !!!

  Files folder image Files  
File Role Description
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file DriverDb.class.php Class Class source
Accessible without login Plain text file examples.php Example Example script
Accessible without login Plain text file LICENSE Lic. License
Plain text file MyDb.class.php Class Class source
Accessible without login Plain text file MyDbTest.php Test Unit test script
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:184
This week:0
All time:8,484
This week:242Up

For more information send a message to info at phpclasses dot org.