Class Model

Description

Implements interfaces:

  • IteratorAggregate (internal interface)

ThinkPHP Model模型类 抽象类

实现了ORM和ActiveRecords模式

Located in /Think/Core/Model.class.php (line 34)

Base
   |
   --Model
Variable Summary
Method Summary
static mixed getInstance ()
Model __construct ([mixed $data = ''])
int add ([mixed $data = null], [boolean $autoLink = false], [boolean $multi = false])
boolen addAll ([mixed $dataList = ''], [boolean $autoLink = false])
boolean addConnect (mixed $config, mixed $linkNum, [boolean $eqType = true])
integer avg (string $field, [mixed $condition = ''])
Model cache ( $cache, boolean $lock)
void cacheLockVersion (mixed $data)
array checkCondition (mixed $data)
array checkFields (string $fields)
array checkGroup (string $group)
mixed checkLockVersion ( &$data, [ &$where = ''], array $data, mixed $where)
array checkOrder (string $order)
boolen clear ()
boolean commit ()
integer count ([mixed $condition = ''], [string $field = '*'])
mixed create ([mixed $data = ''], [boolean $batch = false], string $type)
mixed createAll ([mixed $dataList = ''], string $type)
void delBlobFields ( &$data, [string $field = ''], mixed $data)
boolean delConnect (integer $linkNum)
boolen delete ([mixed $data = null], [integer $limit = ''], [string $order = ''], [boolean $autoLink = false])
boolen deleteAll ([mixed $condition = ''], [boolean $autoLink = false])
boolen deleteBy (string $field, mixed $value, [integer $limit = ''], [string $order = ''], [boolean $autoLink = false])
boolen deleteById (integer $id, [boolean $autoLink = false])
boolen deleteByIds (integer $ids, [integer $limit = ''], [string $order = ''], [boolean $autoLink = false])
false execute ([string $sql = ''])
Model field (string $field)
mixed find ([mixed $condition = ''], [string $fields = '*'], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
ArrayObject|ResultIterator findAll ([mixed $condition = ''], [string $fields = '*'], [string $order = ''], [string $limit = ''], [string $group = ''], [string $having = ''], [string $join = ''], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
mixed first ([mixed $condition = ''], [string $order = ''], [string $fields = '*'], [boolean $relation = false])
void flush ()
void getBlobFields ( &$data, [string $field = ''], mixed $data)
mixed getBy (string $field, mixed $value, [string $fields = '*'], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
mixed getByAll (string $field, mixed $value, [string $fields = '*'], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = true])
mixed getById (int $id, [string $fields = '*'], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
mixed getByIds (mixed $ids, [string $fields = '*'], [ $order = ''], [ $limit = ''], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
mixed getCol (ArrayObject $rs, string $field)
mixed getCols (ArrayObject $rs, string $field, [ $sepa = ' '], string $spea)
string getDbFields ()
string getError ()
mixed getField (string $field, [mixed $condition = ''])
array getFields (string $field, [mixed $condition = ''], [ $sepa = ' '], string $spea)
Iterate getIterator ()
string getLastInsID ()
string getLastSql ()
void getListBlobFields ( &$resultSet, [string $field = ''], mixed $resultSet)
string getModelName ()
mixed getN ([integer $position = 0], [mixed $condition = ''], [string $order = ''], [string $fields = '*'], [boolean $relation = false])
string getPk ()
mixed getRelation ( &$result, [array $relation = array()], mixed $result)
mixed getRelations ( &$resultSet, [array $relation = array()], mixed $result)
string getRelationTableName (mixed $relation)
string getTableName ()
Model group (string $group)
Model having (string $having)
Model join (array $join)
mixed last ([mixed $condition = ''], [string $order = ''], [string $fields = '*'], [boolean $relation = false])
Model lazy (boolean $lazy)
Model limit (array $limit)
Model lock (boolean $lock)
integer max (string $field, [mixed $condition = ''])
integer min (string $field, [mixed $condition = ''])
mixed opRelation (string $opType, mixed $data, [array $relation = array()])
Model order (string $order)
ArrayObject|ResultIterator query (string $sql, [boolean $cache = false], [boolean $lazy = false])
boolean rollback ()
mixed rsToVo (mixed $resultSet, [Boolean $returnList = false], [Integer $position = 0], [boolean $relation = ''])
boolen save ([mixed $data = null], [mixed $where = ''], [boolean $autoLink = false], [integer $limit = 0], [string $order = ''])
void saveBlobFields ( &$data, mixed $data)
boolean setDec (string $field, [mixed $condition = ''], [integer $step = 1])
boolean setField (string $field, string $value, [mixed $condition = ''])
boolean setInc (string $field, [mixed $condition = ''], [integer $step = 1])
Model sql (string $sql)
void startLazy ()
void startLock ()
void startTrans ()
void stopLazy ()
void stopLock ()
integer sum (string $field, [mixed $condition = ''])
boolean switchConnect (integer $linkNum)
Model table (mixed $table)
array toArray ()
ArrayObject|ResultIterator topN (integer $count, [mixed $condition = ''], [string $fields = '*'], [string $order = ''], [string $group = ''], [string $having = ''], [string $join = ''], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
Model where (mixed $where)
mixed xFind ([mixed $condition = ''], [string $fields = '*'], [boolean $cache = false], [boolean $lazy = false])
ArrayObject|ResultIterator xFindAll ([mixed $condition = ''], [string $fields = '*'], [string $order = ''], [string $limit = ''], [string $group = ''], [string $having = ''], [string $join = ''], [boolean $cache = false], boolean $lazy)
void _after_create ( &$data)
void _after_delete ( &$where)
void _after_operation ( &$data)
void _after_query ( &$result)
void _after_read ( &$condition,  $result)
void _after_update ( &$data,  $where)
void _after_validation ( &$data,  $type)
void _before_create ( &$data)
void _before_delete ( &$where)
void _before_operation ( &$data)
void _before_query ( &$sql)
void _before_read ( &$condition)
void _before_update ( &$data,  $where)
void _before_validation ( &$data,  $type)
boolean _facade (mixed $data)
void _initialize ()
Variables
mixed $aggregation = array() (line 76)
  • access: protected
mixed $autoAddRelations = false (line 91)
  • access: protected
mixed $autoCreateTimestamps = array('create_at','create_on','cTime') (line 96)
  • access: protected
mixed $autoDelRelations = false (line 90)
  • access: protected
mixed $autoReadRelations = false (line 92)
  • access: protected
mixed $autoSaveRelations = false (line 89)
  • access: protected
mixed $autoTimeFormat = '' (line 98)
  • access: protected
mixed $autoUpdateTimestamps = array('update_at','update_on','mTime') (line 97)
  • access: protected
mixed $blobFields = null (line 100)
  • access: protected
mixed $blobValues = null (line 101)
  • access: protected
mixed $composite = false (line 78)
  • access: protected
mixed $data = array() (line 64)
  • access: protected
mixed $dataList = array() (line 70)
  • access: protected
mixed $db = null (line 40)
  • access: protected
mixed $error = '' (line 73)
  • access: protected
mixed $fields = array() (line 58)
  • access: protected
mixed $lazyQuery = false (line 93)
  • access: protected
mixed $name = '' (line 49)
  • access: protected
mixed $optimLock = 'lock_version' (line 85)
  • access: protected
mixed $options = array() (line 67)
  • access: protected
mixed $pessimisticLock = false (line 87)
  • access: protected
mixed $staticModel = false (line 80)
  • access: protected
mixed $tableName = '' (line 52)
  • access: protected
mixed $tablePrefix = '' (line 43)
  • access: protected
mixed $tableSuffix = '' (line 46)
  • access: protected
mixed $trueTableName = '' (line 55)
  • access: protected
mixed $type = array() (line 61)
  • access: protected
mixed $viewModel = false (line 82)
  • access: protected
mixed $_db = array() (line 37)
  • access: protected
Methods
static getInstance (line 164)

取得模型实例对象

  • return: 返回数据模型实例
  • access: public
static mixed getInstance ()
Constructor __construct (line 113)

架构函数

取得DB类的实例对象 数据表字段检查

  • access: public
Model __construct ([mixed $data = ''])
  • mixed $data: 要创建的数据对象内容
add (line 792)

新增数据 支持数组、HashMap对象、std对象、数据对象

  • throws: ThinkExecption
  • access: public
int add ([mixed $data = null], [boolean $autoLink = false], [boolean $multi = false])
  • mixed $data: 数据
  • boolean $autoLink: 自动关联写入
  • boolean $multi: 多数据写入
addAll (line 1096)

批量新增数据

  • throws: ThinkExecption
  • access: public
boolen addAll ([mixed $dataList = ''], [boolean $autoLink = false])
  • mixed $dataList: 数据列表
  • boolean $autoLink: 自动关联操作
addConnect (line 2991)

增加数据库连接

  • access: public
boolean addConnect (mixed $config, mixed $linkNum, [boolean $eqType = true])
  • mixed $config: 数据库连接信息
  • mixed $linkNum: 创建的连接序号
  • boolean $eqType: 是否相同类型连接
avg (line 2183)

统计某个字段的平均值

  • throws: ThinkExecption
  • access: public
integer avg (string $field, [mixed $condition = ''])
  • string $field: 字段名
  • mixed $condition: 条件
cache (line 3221)

查询SQL组装lock

  • access: public
Model cache ( $cache, boolean $lock)
  • boolean $lock: 是否锁定
  • $cache
cacheLockVersion (line 2284)

记录乐观锁

  • throws: ThinkExecption
  • access: protected
void cacheLockVersion (mixed $data)
  • mixed $data: 数据对象
checkCondition (line 920)

检查条件中的视图字段

  • throws: ThinkExecption
  • access: public
array checkCondition (mixed $data)
  • mixed $data: 条件表达式
checkFields (line 968)

检查fields表达式中的视图字段

  • throws: ThinkExecption
  • access: public
array checkFields (string $fields)
  • string $fields: 字段
checkGroup (line 1054)

检查Group表达式中的视图字段

  • throws: ThinkExecption
  • access: public
array checkGroup (string $group)
  • string $group: 字段
checkLockVersion (line 1172)

检查乐观锁

  • throws: ThinkExecption
  • access: protected
mixed checkLockVersion ( &$data, [ &$where = ''], array $data, mixed $where)
  • array $data: 当前数据
  • mixed $where: 查询条件
  • &$data
  • &$where
checkOrder (line 1014)

检查Order表达式中的视图字段

  • throws: ThinkExecption
  • access: public
array checkOrder (string $order)
  • string $order: 字段
clear (line 1610)

清空表数据

  • throws: ThinkExecption
  • access: public
boolen clear ()
commit (line 2892)

提交事务

  • throws: ThinkExecption
  • access: public
boolean commit ()
count (line 2087)

统计满足条件的记录个数

  • throws: ThinkExecption
  • access: public
integer count ([mixed $condition = ''], [string $field = '*'])
  • mixed $condition: 条件
  • string $field: 要统计的字段 默认为*
create (line 2381)

创建数据对象 但不保存到数据库

  • throws: ThinkExecption
  • access: public
mixed create ([mixed $data = ''], [boolean $batch = false], string $type)
  • mixed $data: 创建数据
  • string $type: 创建类型
  • boolean $batch: 批量创建
createAll (line 2422)

创建数据列表对象 但不保存到数据库

  • throws: ThinkExecption
  • access: public
mixed createAll ([mixed $dataList = ''], string $type)
  • mixed $dataList: 数据列表
  • string $type: 创建类型
delBlobFields (line 717)

删除File方式的字段

  • access: public
void delBlobFields ( &$data, [string $field = ''], mixed $data)
  • mixed $data: 保存的数据
  • string $field: 查询的字段
  • &$data
delConnect (line 3016)

删除数据库连接

  • access: public
boolean delConnect (integer $linkNum)
  • integer $linkNum: 创建的连接序号
delete (line 1551)

根据条件删除表数据

如果成功返回删除记录个数

  • throws: ThinkExecption
  • access: public
boolen delete ([mixed $data = null], [integer $limit = ''], [string $order = ''], [boolean $autoLink = false])
  • mixed $data: 删除条件
  • integer $limit: 要删除的记录数
  • string $order: 删除的顺序
  • boolean $autoLink: 是否关联删除
deleteAll (line 1583)

根据条件删除数据

  • throws: ThinkExecption
  • access: public
boolen deleteAll ([mixed $condition = ''], [boolean $autoLink = false])
  • mixed $condition: 删除条件
  • boolean $autoLink: 是否关联删除
deleteBy (line 1530)

根据某个字段删除数据

  • access: public
boolen deleteBy (string $field, mixed $value, [integer $limit = ''], [string $order = ''], [boolean $autoLink = false])
  • string $field: 字段名称
  • mixed $value: 字段值
  • integer $limit: 要删除的记录数
  • string $order: 删除的顺序
  • boolean $autoLink: 是否关联删除
deleteById (line 1489)

根据主键删除数据

  • access: public
boolen deleteById (integer $id, [boolean $autoLink = false])
  • integer $id: 主键值
  • boolean $autoLink: 是否关联删除
deleteByIds (line 1509)

根据多个主键删除数据

  • access: public
boolen deleteByIds (integer $ids, [integer $limit = ''], [string $order = ''], [boolean $autoLink = false])
  • integer $ids: 多个主键值
  • integer $limit: 要删除的记录数
  • string $order: 删除的顺序
  • boolean $autoLink: 是否关联删除
execute (line 1879)

执行SQL语句

  • return: | integer
  • throws: ThinkExecption
  • access: public
false execute ([string $sql = ''])
  • string $sql: SQL指令
field (line 3125)

查询SQL组装 field

  • access: public
Model field (string $field)
  • string $field
find (line 1730)

根据条件得到一条记录

  • throws: ThinkExecption
  • access: public
mixed find ([mixed $condition = ''], [string $fields = '*'], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
  • mixed $condition: 条件
  • string $fields: 字段名,默认为*
  • boolean $cache: 是否读取缓存
  • mixed $relation: 是否关联查询
  • boolean $lazy: 是否惰性查询
findAll (line 1783)

查找记录

  • throws: ThinkExecption
  • access: public
ArrayObject|ResultIterator findAll ([mixed $condition = ''], [string $fields = '*'], [string $order = ''], [string $limit = ''], [string $group = ''], [string $having = ''], [string $join = ''], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
  • mixed $condition: 条件
  • string $fields: 查询字段
  • string $order: 排序
  • string $limit
  • string $group
  • string $having
  • string $join
  • boolean $cache: 是否读取缓存
  • mixed $relation: 是否关联查询
  • boolean $lazy: 是否惰性查询
first (line 2249)

获取满足条件的第一条记录

  • access: public
mixed first ([mixed $condition = ''], [string $order = ''], [string $fields = '*'], [boolean $relation = false])
  • mixed $condition: 条件
  • string $fields: 字段名,默认为*
  • string $order: 排序
  • boolean $relation: 是否读取关联
flush (line 588)

强制刷新数据表信息

  • access: public
void flush ()
getBlobFields (line 658)

获取数据的文本字段

  • access: public
void getBlobFields ( &$data, [string $field = ''], mixed $data)
  • mixed $data: 查询的数据
  • string $field: 查询的字段
  • &$data
getBy (line 1685)

根据某个字段得到一条记录

  • throws: ThinkExecption
  • access: public
mixed getBy (string $field, mixed $value, [string $fields = '*'], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
  • string $field: 字段名称
  • mixed $value: 字段的值
  • string $fields: 字段名,默认为*
  • boolean $cache: 是否缓存查询
  • mixed $relation: 是否关联查询
  • boolean $lazy: 是否惰性查询
getByAll (line 1708)

根据某个字段获取全部记录

  • throws: ThinkExecption
  • access: public
mixed getByAll (string $field, mixed $value, [string $fields = '*'], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = true])
  • string $field: 字段名称
  • mixed $value: 字段的值
  • string $fields: 字段名,默认为*
  • boolean $cache: 是否缓存查询
  • mixed $relation: 是否关联查询
  • boolean $lazy: 是否惰性查询
getById (line 1637)

根据主键得到一条记录

  • throws: ThinkExecption
  • access: public
mixed getById (int $id, [string $fields = '*'], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
  • int $id: 主键的值
  • string $fields: 字段名,默认为*
  • boolean $cache: 是否缓存
  • mixed $relation: 是否关联读取
  • boolean $lazy: 是否惰性查询
getByIds (line 1659)

根据主键范围得到多个记录

  • throws: ThinkExecption
  • access: public
mixed getByIds (mixed $ids, [string $fields = '*'], [ $order = ''], [ $limit = ''], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
  • mixed $ids: 主键的范围 如 1,3,4,7 array(1,2,3)
  • string $fields: 字段名,默认为*
  • boolean $cache: 是否缓存
  • mixed $relation: 是否关联读取
  • boolean $lazy: 是否惰性查询
  • $order
  • $limit
getCol (line 2026)

获取查询结果中的某个字段值

  • throws: ThinkExecption
  • access: public
mixed getCol (ArrayObject $rs, string $field)
  • ArrayObject $rs: 查询结果
  • string $field: 字段名
getCols (line 2052)

获取查询结果中的多个字段值

  • throws: ThinkExecption
  • access: public
mixed getCols (ArrayObject $rs, string $field, [ $sepa = ' '], string $spea)
  • ArrayObject $rs: 查询结果
  • string $field: 字段名用逗号分割多个
  • string $spea: 多字段分割符号
  • $sepa
getDbFields (line 2948)

返回数据库字段信息

  • access: public
string getDbFields ()
getError (line 2935)

返回当前错误信息

  • access: public
string getError ()
getField (line 1906)

获取一条记录的某个字段值

  • throws: ThinkExecption
  • access: public
mixed getField (string $field, [mixed $condition = ''])
  • string $field: 字段名
  • mixed $condition: 查询条件
getFields (line 1931)

获取数据集的个别字段值

  • throws: ThinkExecption
  • access: public
array getFields (string $field, [mixed $condition = ''], [ $sepa = ' '], string $spea)
  • string $field: 字段名称
  • mixed $condition: 条件
  • string $spea: 多字段分割符号
  • $sepa
getIterator (line 742)

获取Iterator因子

  • access: public
Iterate getIterator ()

Implementation of:
IteratorAggregate::getIterator
getLastInsID (line 2961)

返回最后插入的ID

  • access: public
string getLastInsID ()
getLastSql (line 2974)

返回最后执行的sql语句

  • access: public
string getLastSql ()
getListBlobFields (line 637)

获取数据集的文本字段

  • access: public
void getListBlobFields ( &$resultSet, [string $field = ''], mixed $resultSet)
  • mixed $resultSet: 查询的数据
  • string $field: 查询的字段
  • &$resultSet
getModelName (line 2723)

得到当前的数据对象名称

  • access: public
string getModelName ()
getN (line 2209)

查询符合条件的第N条记录

  1. 表示第一条记录 -1 表示最后一条记录

  • access: public
mixed getN ([integer $position = 0], [mixed $condition = ''], [string $order = ''], [string $fields = '*'], [boolean $relation = false])
  • integer $position: 记录位置
  • mixed $condition: 条件
  • string $order: 排序
  • string $fields: 字段名,默认为*
  • boolean $relation: 是否读取关联
getPk (line 2922)

得到主键名称

  • access: public
string getPk ()
getRelation (line 1222)

获取返回数据的关联记录

relation['name'] 关联名称 relation['type'] 关联类型

  • throws: ThinkExecption
  • access: public
mixed getRelation ( &$result, [array $relation = array()], mixed $result)
  • mixed $result: 返回数据
  • array $relation: 关联信息
  • &$result
getRelations (line 1326)

获取返回数据集的关联记录

  • throws: ThinkExecption
  • access: public
mixed getRelations ( &$resultSet, [array $relation = array()], mixed $result)
  • mixed $result: 返回数据
  • array $relation: 关联信息
  • &$resultSet
getRelationTableName (line 2786)

得到关联的数据表名

  • access: public
string getRelationTableName (mixed $relation)
  • mixed $relation: 关联对象
getTableName (line 2746)

得到完整的数据表名

  • access: public
string getTableName ()
group (line 3109)

查询SQL组装 group

  • access: public
Model group (string $group)
  • string $group
having (line 3173)

查询SQL组装 having

  • access: public
Model having (string $having)
  • string $having
join (line 3157)

查询SQL组装 join

  • access: public
Model join (array $join)
  • array $join
last (line 2267)

获取满足条件的第后一条记录

  • access: public
mixed last ([mixed $condition = ''], [string $order = ''], [string $fields = '*'], [boolean $relation = false])
  • mixed $condition: 条件
  • string $fields: 字段名,默认为*
  • string $order: 排序
  • boolean $relation: 是否读取关联
lazy (line 3189)

查询SQL组装 惰性

  • access: public
Model lazy (boolean $lazy)
  • boolean $lazy: 惰性查询
limit (line 3141)

查询SQL组装 limit

  • access: public
Model limit (array $limit)
  • array $limit
lock (line 3205)

查询SQL组装lock

  • access: public
Model lock (boolean $lock)
  • boolean $lock: 是否锁定
max (line 2111)

取得某个字段的最大值

  • throws: ThinkExecption
  • access: public
integer max (string $field, [mixed $condition = ''])
  • string $field: 字段名
  • mixed $condition: 条件
min (line 2135)

取得某个字段的最小值

  • throws: ThinkExecption
  • access: public
integer min (string $field, [mixed $condition = ''])
  • string $field: 字段名
  • mixed $condition: 条件
opRelation (line 1356)

操作关联数据

  • throws: ThinkExecption
  • access: public
mixed opRelation (string $opType, mixed $data, [array $relation = array()])
  • string $opType: 操作方式 ADD SAVE DEL
  • mixed $data: 数据对象
  • array $relation: 关联信息
order (line 3077)

查询SQL组装 order

  • access: public
Model order (string $order)
  • string $order
query (line 1861)

SQL查询

  • throws: ThinkExecption
  • access: public
ArrayObject|ResultIterator query (string $sql, [boolean $cache = false], [boolean $lazy = false])
  • string $sql: SQL指令
  • boolean $cache: 是否缓存
  • boolean $lazy: 是否惰性查询
rollback (line 2908)

事务回滚

  • throws: ThinkExecption
  • access: public
boolean rollback ()
rsToVo (line 2310)

把查询结果转换为数据(集)对象

  • throws: ThinkExecption
  • access: public
mixed rsToVo (mixed $resultSet, [Boolean $returnList = false], [Integer $position = 0], [boolean $relation = ''])
  • mixed $resultSet: 查询结果记录集
  • Boolean $returnList: 是否返回记录集
  • Integer $position: 定位的记录集位置
  • boolean $relation: 是否获取关联
save (line 1124)

更新数据

  • throws: ThinkExecption
  • access: public
boolen save ([mixed $data = null], [mixed $where = ''], [boolean $autoLink = false], [integer $limit = 0], [string $order = ''])
  • mixed $data: 要更新的数据
  • mixed $where: 更新数据的条件
  • boolean $autoLink: 自动关联操作
  • integer $limit: 要更新的记录数
  • string $order: 更新的顺序
saveBlobFields (line 694)

保存File方式的字段

  • access: public
void saveBlobFields ( &$data, mixed $data)
  • mixed $data: 保存的数据
  • &$data
setDec (line 2004)

字段值减少

  • throws: ThinkExecption
  • access: public
boolean setDec (string $field, [mixed $condition = ''], [integer $step = 1])
  • string $field: 字段名
  • mixed $condition: 条件
  • integer $step: 减少值
setField (line 1958)

设置记录的某个字段值

支持使用数据库字段和方法 例如 setField('score','(score+1)','id=5');

  • throws: ThinkExecption
  • access: public
boolean setField (string $field, string $value, [mixed $condition = ''])
  • string $field: 字段名
  • string $value: 字段值
  • mixed $condition: 条件
setInc (line 1981)

字段值增长

  • throws: ThinkExecption
  • access: public
boolean setInc (string $field, [mixed $condition = ''], [integer $step = 1])
  • string $field: 字段名
  • mixed $condition: 条件
  • integer $step: 增长值
sql (line 3237)

查询SQL组装

  • access: public
Model sql (string $sql)
  • string $sql: sql语句
startLazy (line 2806)

开启惰性查询

  • throws: ThinkExecption
  • access: public
void startLazy ()
startLock (line 2840)

开启锁机制

  • throws: ThinkExecption
  • access: public
void startLock ()
startTrans (line 2874)

启动事务

  • throws: ThinkExecption
  • access: public
void startTrans ()
stopLazy (line 2823)

关闭惰性查询

  • throws: ThinkExecption
  • access: public
void stopLazy ()
stopLock (line 2857)

关闭锁机制

  • throws: ThinkExecption
  • access: public
void stopLock ()
sum (line 2159)

统计某个字段的总和

  • throws: ThinkExecption
  • access: public
integer sum (string $field, [mixed $condition = ''])
  • string $field: 字段名
  • mixed $condition: 条件
switchConnect (line 3035)

切换数据库连接

  • access: public
boolean switchConnect (integer $linkNum)
  • integer $linkNum: 创建的连接序号
table (line 3093)

查询SQL组装 table

  • access: public
Model table (mixed $table)
  • mixed $table
toArray (line 767)

把数据对象转换成数组

  • access: public
array toArray ()
topN (line 1842)

查找前N个记录

  • throws: ThinkExecption
  • access: public
ArrayObject|ResultIterator topN (integer $count, [mixed $condition = ''], [string $fields = '*'], [string $order = ''], [string $group = ''], [string $having = ''], [string $join = ''], [boolean $cache = false], [mixed $relation = false], [boolean $lazy = false])
  • integer $count: 记录个数
  • mixed $condition: 条件
  • string $fields: 查询字段
  • string $order: 排序
  • string $group
  • string $having
  • string $join
  • boolean $cache: 是否读取缓存
  • mixed $relation: 是否关联查询
  • boolean $lazy: 是否惰性查询
where (line 3061)

查询SQL组装 where

  • access: public
Model where (mixed $where)
  • mixed $where
xFind (line 1756)

根据条件得到一条记录

并且返回关联记录

  • throws: ThinkExecption
  • access: public
mixed xFind ([mixed $condition = ''], [string $fields = '*'], [boolean $cache = false], [boolean $lazy = false])
  • mixed $condition: 条件
  • string $fields: 字段名,默认为*
  • boolean $cache: 是否读取缓存
  • boolean $lazy: 是否惰性查询
xFindAll (line 1815)

查询记录并返回相应的关联记录

  • throws: ThinkExecption
  • access: public
ArrayObject|ResultIterator xFindAll ([mixed $condition = ''], [string $fields = '*'], [string $order = ''], [string $limit = ''], [string $group = ''], [string $having = ''], [string $join = ''], [boolean $cache = false], boolean $lazy)
  • mixed $condition: 条件
  • string $fields: 查询字段
  • string $order: 排序
  • string $limit
  • string $group
  • string $having
  • string $join
  • boolean $cache: 是否读取缓存
  • boolean $lazy: 是否惰性查询
_after_create (line 317)
  • access: protected
void _after_create ( &$data)
  • &$data
_after_delete (line 507)
  • access: protected
void _after_delete ( &$where)
  • &$where
_after_operation (line 2712)
  • access: protected
void _after_operation ( &$data)
  • &$data
_after_query (line 550)
  • access: protected
void _after_query ( &$result)
  • &$result
_after_read (line 453)
  • access: protected
void _after_read ( &$condition,  $result)
  • &$condition
  • $result
_after_update (line 371)
  • access: protected
void _after_update ( &$data,  $where)
  • &$data
  • $where
_after_validation (line 2708)
  • access: protected
void _after_validation ( &$data,  $type)
  • &$data
  • $type
_before_create (line 316)
  • access: protected
void _before_create ( &$data)
  • &$data
_before_delete (line 506)
  • access: protected
void _before_delete ( &$where)
  • &$where
_before_operation (line 2711)
  • access: protected
void _before_operation ( &$data)
  • &$data
_before_query (line 549)
  • access: protected
void _before_query ( &$sql)
  • &$sql
_before_read (line 452)
  • access: protected
void _before_read ( &$condition)
  • &$condition
_before_update (line 370)
  • access: protected
void _before_update ( &$data,  $where)
  • &$data
  • $where
_before_validation (line 2707)
  • access: protected
void _before_validation ( &$data,  $type)
  • &$data
  • $type
_facade (line 837)

对保存到数据库的数据对象进行处理

统一使用数组方式到数据库中间层 facade字段支持

  • access: protected
boolean _facade (mixed $data)
  • mixed $data: 要操作的数据
_initialize (line 275)
  • access: protected
void _initialize ()

Documentation generated on Thu, 27 Mar 2008 08:20:47 +0000 by 塞北的雪