PHP Class db_mongo, zys

Author: zqf Mongo数据库驱动 必须配合MongoModel使用
Inheritance: extends db_Db
Afficher le fichier Open project: qieangel2013/zys

Protected Properties

Свойство Type Description
$_collection MongoDb Object
$_collectionName dbName
$_cursor collectionName
$_dbName MongoCollection Object
$_mongo
$comparison MongoCursor Object

Méthodes publiques

Méthode Description
__construct ( array $config = '' ) 架构函数 读取数据库配置信息
clear ( array $options = [] ) : false | integer 清空记录
close ( ) 关闭数据库
command ( array $command = [] ) : array 执行命令
connect ( $config = '', $linkNum ) 连接数据库方法
count ( array $options = [] ) : iterator 统计记录数
delete ( array $options = [] ) : false | integer 删除记录
error ( ) : string 数据库错误信息
execute ( string $code, array $args = [] ) : mixed 执行语句
find ( array $options = [] ) : array 查找某个记录
free ( ) 释放查询结果
getFields ( $collection = '' ) : array 取得数据表的字段信息
getTables ( ) 取得当前数据库的collection信息
group ( $keys, $initial, $reduce, $options = [] )
insert ( mixed $data, array $options = [], boolean $replace = false ) : false | integer 插入记录
insertAll ( array $dataList, array $options = [] ) : boolean 插入多条记录
mongo_next_id ( string $pk ) : integer 生成下一条记录ID 用于自增非MongoId主键
parseField ( mixed $fields ) : array field分析
parseWhere ( mixed $where ) : array where分析
select ( array $options = [] ) : iterator 查找记录
switchCollection ( string $collection, string $db = '', boolean $master = true ) : void 切换当前操作的Db和Collection
update ( mixed $data, array $options ) : boolean 更新记录

Méthodes protégées

Méthode Description
parseLimit ( mixed $limit ) : array limit分析
parseOrder ( mixed $order ) : array order分析
parseSet ( array $data ) : string set分析
parseThinkWhere ( string $key, mixed $val ) : string 特殊条件分析
parseWhereItem ( string $key, mixed $val ) : array where子单元分析

Method Details

__construct() public méthode

架构函数 读取数据库配置信息
public __construct ( array $config = '' )
$config array 数据库配置数组

clear() public méthode

清空记录
public clear ( array $options = [] ) : false | integer
$options array 表达式
Résultat false | integer | integer

close() public méthode

关闭数据库
public close ( )

command() public méthode

执行命令
public command ( array $command = [] ) : array
$command array 指令
Résultat array

connect() public méthode

连接数据库方法
public connect ( $config = '', $linkNum )

count() public méthode

统计记录数
public count ( array $options = [] ) : iterator
$options array 表达式
Résultat iterator

delete() public méthode

删除记录
public delete ( array $options = [] ) : false | integer
$options array 表达式
Résultat false | integer | integer

error() public méthode

数据库错误信息
public error ( ) : string
Résultat string

execute() public méthode

执行语句
public execute ( string $code, array $args = [] ) : mixed
$code string sql指令
$args array 参数
Résultat mixed

find() public méthode

查找某个记录
public find ( array $options = [] ) : array
$options array 表达式
Résultat array

free() public méthode

释放查询结果
public free ( )

getFields() public méthode

取得数据表的字段信息
public getFields ( $collection = '' ) : array
Résultat array

getTables() public méthode

取得当前数据库的collection信息
public getTables ( )

group() public méthode

public group ( $keys, $initial, $reduce, $options = [] )

insert() public méthode

插入记录
public insert ( mixed $data, array $options = [], boolean $replace = false ) : false | integer
$data mixed 数据
$options array 参数表达式
$replace boolean 是否replace
Résultat false | integer | integer

insertAll() public méthode

插入多条记录
public insertAll ( array $dataList, array $options = [] ) : boolean
$dataList array 数据
$options array 参数表达式
Résultat boolean

mongo_next_id() public méthode

生成下一条记录ID 用于自增非MongoId主键
public mongo_next_id ( string $pk ) : integer
$pk string 主键名
Résultat integer

parseField() public méthode

field分析
public parseField ( mixed $fields ) : array
$fields mixed
Résultat array

parseLimit() protected méthode

limit分析
protected parseLimit ( mixed $limit ) : array
$limit mixed
Résultat array

parseOrder() protected méthode

order分析
protected parseOrder ( mixed $order ) : array
$order mixed
Résultat array

parseSet() protected méthode

set分析
protected parseSet ( array $data ) : string
$data array
Résultat string

parseThinkWhere() protected méthode

特殊条件分析
protected parseThinkWhere ( string $key, mixed $val ) : string
$key string
$val mixed
Résultat string

parseWhere() public méthode

where分析
public parseWhere ( mixed $where ) : array
$where mixed
Résultat array

parseWhereItem() protected méthode

where子单元分析
protected parseWhereItem ( string $key, mixed $val ) : array
$key string
$val mixed
Résultat array

select() public méthode

查找记录
public select ( array $options = [] ) : iterator
$options array 表达式
Résultat iterator

switchCollection() public méthode

切换当前操作的Db和Collection
public switchCollection ( string $collection, string $db = '', boolean $master = true ) : void
$collection string collection
$db string db
$master boolean 是否主服务器
Résultat void

update() public méthode

更新记录
public update ( mixed $data, array $options ) : boolean
$data mixed 数据
$options array 表达式
Résultat boolean

Property Details

$_collection protected_oe property

MongoDb Object
protected $_collection

$_collectionName protected_oe property

dbName
protected $_collectionName

$_cursor protected_oe property

collectionName
protected $_cursor

$_dbName protected_oe property

MongoCollection Object
protected $_dbName

$_mongo protected_oe property

protected $_mongo

$comparison protected_oe property

MongoCursor Object
protected $comparison