mtoolkit / mtoolkit-model
MToolkit 框架的模型模块
0.0.3
2017-11-07 15:41 UTC
Requires
- php: >=5.3.0
- mtoolkit/mtoolkit-core: 0.0.3
Requires (Dev)
- phpunit/phpunit: 5.1.*
This package is not auto-updated.
Last update: 2024-09-13 14:47:19 UTC
README
MToolkit 框架的 模型模块。
摘要
#简介 该模块提供表示 x 维度模型的类,作为列表或表格。还有一个关于 SQL 模型的子模块:执行查询、检索结果集等...
MDbConnection
它提供了一个简单的单例方式来存储数据库连接。用法
// Add a new connection string MDbConnection::addDbConnection( new \PDO( 'mysql:host=127.0.0.1;dbname=test_db', 'root', 'password' ) ); // Retrieve the database connection $connection = MDbConnection::getDbConnection();
MPDOQuery 和 MPDOResult
用法
$query = "SELECT item_01 FROM table_01"; $connection = MDbConnection::getDbConnection(); $sql = new MPDOQuery( $query, $connection ); $sql->bindValue( $key ); $sql->exec(); $result = $sql->getResult();