Свойство | Type | Description | |
---|---|---|---|
$table | null | string | 表名 | |
$tablePrefix | null | string | 表前缀 |
Méthode | Description | |
---|---|---|
__call ( $dbMethod, $arguments ) : |
当访问model中不存在的方法时直接调用$this->db()的相关方法 | |
__callStatic ( $dbMethod, $arguments ) : |
当访问model中不存在的方法时直接调用相关model中的db()的相关方法 | |
cache ( string $conf = 'default_cache' ) : |
获取cache实例 | |
closeDb ( string $conf = 'default_db' ) | 当程序连接N个db的时候用于释放于用连接以节省内存 | |
db ( string $conf = '' ) : |
获取db实例 | |
delByColumn ( mixed $val, string $column = null, string $tableName = null, mixed $tablePrefix = null ) : boolean | 通过主键删除数据-快捷方法 | |
getByColumn ( mixed $val, string $column = null, string $tableName = null, mixed $tablePrefix = null ) : boolean | array | 通过某个字段获取单条数据-快捷方法 | |
getDbConf ( ) : string | 获取当前Model的数据库配置串 | |
getInstance ( ) : |
初始化一个Model实例 | |
getList ( integer $offset, integer $limit = 20, string | array $order = 'DESC', string $tableName = null, mixed $tablePrefix = null ) : array | 获取数据列表 | |
getListByPaginate ( integer $limit = 20, string | array $order = 'DESC', string $tableName = null, mixed $tablePrefix = null ) : array | 以分页的方式获取数据列表 | |
getMultiByColumn ( mixed $val, string $column = null, string $tableName = null, mixed $tablePrefix = null ) : boolean | array | 通过某个字段获取多条数据-快捷方法 | |
getTableName ( ) : string | 获取表名 | |
getTotalNums ( null $pkField = null, string $tableName = null, mixed $tablePrefix = null ) : mixed | 获取数据的总数 | |
mapDbAndTable ( ) : |
自动根据 db属性执行$this->db(xxx)方法; table/tablePrefix属性执行$this->db('xxx')->table('tablename', 'tablePrefix')方法 | |
set ( array $data, string $tableName = null, mixed $tablePrefix = null ) : integer | 增加一条数据-快捷方法 | |
updateByColumn ( integer $val, array $data, string $column = null, string $tableName = null, mixed $tablePrefix = null ) : boolean | 通过字段更新数据-快捷方法 |
public __call ( $dbMethod, $arguments ) : |
||
$dbMethod | ||
$arguments | ||
Résultat | | \Cml\Db\MongoDB\MongoDB | $this |
public static __callStatic ( $dbMethod, $arguments ) : |
||
$dbMethod | ||
$arguments | ||
Résultat | | \Cml\Db\MongoDB\MongoDB |
public getByColumn ( mixed $val, string $column = null, string $tableName = null, mixed $tablePrefix = null ) : boolean | array | ||
$val | mixed | 值 |
$column | string | 字段名 不传会自动分析表结构获取主键 |
$tableName | string | 表名 不传会自动从当前Model中$table属性获取 |
$tablePrefix | mixed | 表前缀 不传会自动从当前Model中$tablePrefix属性获取再没有则获取配置中配置的前缀 |
Résultat | boolean | array |
public static getInstance ( ) : |
||
Résultat | | \Cml\Db\MySql\Pdo | \Cml\Db\MongoDB\MongoDB | \Cml\Db\Base |
public getList ( integer $offset, integer $limit = 20, string | array $order = 'DESC', string $tableName = null, mixed $tablePrefix = null ) : array | ||
$offset | integer | 偏移量 |
$limit | integer | 返回的条数 |
$order | string | array | 传asc 或 desc 自动取主键 或 ['id'=>'desc', 'status' => 'asc'] |
$tableName | string | 表名 不传会自动从当前Model中$table属性获取 |
$tablePrefix | mixed | 表前缀 不传会自动从当前Model中$tablePrefix属性获取再没有则获取配置中配置的前缀 |
Résultat | array |
public getListByPaginate ( integer $limit = 20, string | array $order = 'DESC', string $tableName = null, mixed $tablePrefix = null ) : array | ||
$limit | integer | 每页返回的条数 |
$order | string | array | 传asc 或 desc 自动取主键 或 ['id'=>'desc', 'status' => 'asc'] |
$tableName | string | 表名 不传会自动从当前Model中$table属性获取 |
$tablePrefix | mixed | 表前缀 不传会自动从当前Model中$tablePrefix属性获取再没有则获取配置中配置的前缀 |
Résultat | array |
public getMultiByColumn ( mixed $val, string $column = null, string $tableName = null, mixed $tablePrefix = null ) : boolean | array | ||
$val | mixed | 值 |
$column | string | 字段名 不传会自动分析表结构获取主键 |
$tableName | string | 表名 不传会自动从当前Model中$table属性获取 |
$tablePrefix | mixed | 表前缀 不传会自动从当前Model中$tablePrefix属性获取再没有则获取配置中配置的前缀 |
Résultat | boolean | array |
public mapDbAndTable ( ) : |
||
Résultat | | \Cml\Db\MongoDB\MongoDB | \Cml\Db\Base |
public updateByColumn ( integer $val, array $data, string $column = null, string $tableName = null, mixed $tablePrefix = null ) : boolean | ||
$val | integer | 字段值 |
$data | array | 更新的数据 |
$column | string | 字段名 不传会自动分析表结构获取主键 |
$tableName | string | 表名 不传会自动从当前Model中$table属性获取 |
$tablePrefix | mixed | 表前缀 不传会自动从当前Model中$tablePrefix属性获取再没有则获取配置中配置的前缀 |
Résultat | boolean |