yorch/mydb
Composer 安装命令:
composer require yorch/mydb
包简介
Abstract Class to manage RDBMS (MySQL, MSSQLServer, ODBC, PostgreSQL) connections
README 文档
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
P.D. Let's go play !!!
统计信息
- 总下载量: 112
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-03-30