PHP Classes
elePHPant
Icontem

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    
Last Updated Ratings Unique User Downloads Download Rankings
2017-10-12 (9 days ago) RSS 2.0 feedNot enough user ratingsTotal: 165 This week: 9All time: 8,305 This week: 85Up
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

Name: Yorch Ponce <contact>
Classes: 6 packages by
Country: Mexico Mexico
Age: 36
All time rank: 263329 in Mexico Mexico
Week rank: 60 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:165
This week:9
All time:8,305
This week:85Up