titon / db
此包已被废弃且不再维护。没有推荐替代包。
Titon数据库包提供基本的数据库抽象层和对象关系映射器。
0.15.3
2014-06-19 06:22 UTC
Requires
- php: >=5.4.0
- ext-pdo: *
- titon/common: *
- titon/event: *
- titon/type: *
Requires (Dev)
- psr/log: *
- titon/cache: *
- titon/debug: *
- titon/test: dev-master
Suggests
- psr/log: Log queries using a Logger
- titon/cache: Cache query results using a Storage engine
- titon/db-mongodb: Enable MongoDB database access
- titon/db-mysql: Enable MySQL database access
- titon/db-postgresql: Enable PostgreSQL database access
- titon/db-sqlite: Enable SQLite database access
- dev-master
- 0.15.3
- 0.15.2
- 0.15.1
- 0.15.0
- 0.14.1
- 0.14.0
- 0.13.0
- 0.12.1
- 0.12.0
- 0.11.2
- 0.11.1
- 0.11.0
- 0.10.1
- 0.10.0
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.0
- 0.7.1
- 0.7.0
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.10
- 0.4.9
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.0
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
This package is auto-updated.
Last update: 2022-02-01 12:29:51 UTC
README
Titon数据库包提供与数据库引擎(称为驱动程序)交互的轻量级和底层接口。DB包包含强大的数据库抽象层(DBAL)、面向对象的查询构建器、强大的SQL方言格式化器、数据类型转换器、自定义查找类、行为、映射器、模式等。
$db = Titon\Db\Database::registry(); $db->addDriver('default', new Titon\Db\Mysql\MysqlDriver([ 'user' => 'root', 'pass' => 'pass' ])); $users = new Titon\Db\Repository(['table' => 'users']); $entities = $users->select()->where('status', 1)->orderBy('created_at', 'desc')->all();
支持的数据库引擎作为单独的驱动程序包打包,如下所示。
驱动程序
MySQL
- https://github.com/titon/db-mysqlPostgreSQL
- https://github.com/titon/db-postgresqlSQLite
- https://github.com/titon/db-sqliteMongoDB
- https://github.com/titon/db-mongodb
功能
Database
- 驱动程序管理器Repository
- 表表示,查询驱动程序,映射关系并返回实体Behavior
- 在数据库事件期间执行逻辑Entity
- 单条数据记录EntityCollection
- 实体集合Finder
- 选择查询格式化Driver
- 与数据库或远程服务交互Dialect
- 驱动程序特定SQL格式化Schema
- 存储库模式Type
- 数据类型映射ResultSet
- 结果集映射器
Query
- 面向对象查询构建器RawExpr
- 原始表达式构建器Expr
- 表达式构建器Func
- 函数构建器Join
- 连接构建器Predicate
- 子句构建器
依赖
通用
事件
类型
Cache
(可选)Psr\Log
(可选)
要求
- PHP 5.4.0
- PDO