ORM 数据库核心类
常量 | |
---|---|
OOP_ORM_Finder_DB::VERSION |
string(5) "2.3.1" |
OOP_ORM_Finder_DB::PARAM_RETURN_FINDER |
string(6) "finder" |
OOP_ORM_Finder_DB::PARAM_RETURN_SINGLE |
string(6) "single" |
OOP_ORM_Finder_DB::PARAM_RETURN_GROUP |
string(5) "group" |
API - Module_OOP_ORM_Finder_DB
- OOP_ORM_Finder_DB::__construct
- OOP_ORM_Finder_DB::database - 获取数据库名称
- OOP_ORM_Finder_DB::tablename - 获取表名称
- OOP_ORM_Finder_DB::find - 获取数据
- OOP_ORM_Finder_DB::driver - 返回数据库对象
- OOP_ORM_Finder_DB::db - 返回数据库对象
- OOP_ORM_Finder_DB::where
- OOP_ORM_Finder_DB::order_by - Applies sorting with "ORDER BY ..."
- OOP_ORM_Finder_DB::offset - Start returning results after "OFFSET ..."
- OOP_ORM_Finder_DB::limit - Return up to "LIMIT ..." results
- OOP_ORM_Finder_DB::in - 设置 in
- OOP_ORM_Finder_DB::insert - 插入数据
- OOP_ORM_Finder_DB::update - 更新数据
- OOP_ORM_Finder_DB::delete - 删除数据
继承自父类的方法和变量
- OOP_ORM::get_orm_name - 获取对象名称
- OOP_ORM::create - 创建一条数据
- OOP_ORM::create_group_data - 返回ORM数据对象
- OOP_ORM::set_auto_where - 设置自动添加条件
- OOP_ORM::clear_auto_where - 清除自动添加条件
- OOP_ORM::id_field_name
- OOP_ORM::get_by_id - 根据ID获取对象
- OOP_ORM::get_by_ids - 根据IDs获取对象
- OOP_ORM::last_query - 返回最后查询语句
获取数据库名称
获取表名称
获取数据
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$sql |
string |
指定SQL语句,不传则使用QueryBulider构造 | null |
$use_master |
boolean |
查询是否用主数据库 | null |
OOP_ORM_Result
根据$bulider条件解析获取已缓存在PHP的数据
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$bulider |
array |
$bulider | |
$id_cache_data |
array |
$id_cache_data |
boolean
是否需要再次读取返回数据库对象
Database
返回数据库对象
兼容Model的写法
Database
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$column |
mixed |
Column name or array($column, $alias) or object | |
$value |
string |
Logic operator | null |
$op |
mixed |
Column value | string(1) "=" |
OOP_ORM_Finder_DB
Applies sorting with "ORDER BY ..."
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$column |
mixed |
Column name or array($column, $alias) or object | |
$direction |
string |
Direction of sorting | string(3) "ASC" |
Database
Start returning results after "OFFSET ..."
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$number |
integer |
Starting result number |
OOP_ORM_Finder_DB
Return up to "LIMIT ..." results
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$number |
integer |
Maximum results to return |
OOP_ORM_Finder_DB
设置 in
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$column |
string |
$key | |
$value |
array |
$value | |
$no_in |
unknown |
bool false |
Database
插入数据
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$value |
string |
$table | null |
更新数据
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$value |
string |
$table | null |
$where |
array |
$value | null |
int
作用的行数删除数据
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$where |
string |
$table | null |
int
作用的行数获取对象名称
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$type |
string |
$type |
创建一条数据 $is_field_key 是所传进来的数据的key是对象的键名还是字段的键名,true=字段的键名,false=对象的键名 差别在于: 由于ORM DATA的键名可以和数据库的字段名称不一样,所以在设置数据的时候需要指定是哪个数据,如果键名和数据库的字段名完全一样,这样的话则没有区别
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$data |
array |
数据 | null |
$is_field_key |
boolean |
数据的键名是否数据库字段,默认false | bool false |
返回ORM数据对象
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$array |
$array |
||
$is_field_key |
boolean |
数据的键名是否数据库字段,默认false | bool false |
OOP_ORM_Result
设置自动添加条件
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$auto_where |
array |
$auto_where |
清除自动添加条件
根据ID获取对象
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$id |
$id |
Int 对象ID | |
$use_master |
$use_master |
Boolean 是否使用主数据 | bool false |
根据IDs获取对象
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
$ids |
$use_master |
Boolean 是否使用主数据 | |
$use_master |
unknown |
bool false |
OOP_ORM_Result