Properties

$debug

$debug : 

Type

$autoFree

$autoFree : 

Type

$pconnect

$pconnect : 

Type

$queryStr

$queryStr : 

Type

$lastInsID

$lastInsID : 

Type

$numRows

$numRows : 

Type

$numCols

$numCols : 

Type

$transTimes

$transTimes : 

Type

$error

$error : 

Type

$linkID

$linkID : 

Type

$queryID

$queryID : 

Type

$connected

$connected : 

Type

$config

$config : 

Type

$comparison

$comparison : 

Type

$selectSql

$selectSql : 

Type

$_instance

$_instance : 

Type

$mode

$mode : 

Type

$table

$table : 

Type

Methods

__construct()

__construct(array  $config = '') 

架构函数 读取数据库配置信息

Parameters

array $config

数据库配置数组

connect()

connect(  $config = '',   $linkNum) 

连接数据库方法

Parameters

$config
$linkNum

free()

free() 

释放查询结果

query()

query(string  $str) : mixed

执行查询 返回数据集

Parameters

string $str

sql指令

Returns

mixed

execute()

execute(string  $str) : integer

执行语句

Parameters

string $str

sql指令

Returns

integer

startTrans()

startTrans() : void

启动事务

commit()

commit() : \boolen

用于非自动提交状态下面的查询提交

Returns

\boolen

rollback()

rollback() : \boolen

事务回滚

Returns

\boolen

close()

close() 

关闭数据库

error()

error(  $result = true) : string

数据库错误信息 并显示当前的SQL语句

Parameters

$result

Returns

string

escapeString()

escapeString(string  $str) : string

SQL指令安全过滤

Parameters

string $str

SQL指令

Returns

string

__destruct()

__destruct() 

析构方法

getInstance()

getInstance(  $db_config = '') : mixed

取得数据库类实例

Parameters

$db_config

Returns

mixed —

返回数据库驱动类

parseDSN()

parseDSN(string  $dsnStr) : array

DSN解析 格式: mysql://username:passwd@localhost:3306/DbName

Parameters

string $dsnStr

Returns

array

getLastSql()

getLastSql() : string

获取最近一次查询的sql语句

Returns

string

getLastInsID()

getLastInsID() : string

获取最近插入的ID

Returns

string

getFields()

getFields(  $tableName) 

取得数据表的字段信息

Parameters

$tableName

getTables()

getTables(  $dbName = '') 

取得数据库的表信息(暂时实现取得用户表信息)

Parameters

$dbName

insertLastId()

insertLastId() : integer

获取最后插入id ,仅适用于采用序列+触发器结合生成ID的方式 在config.php中指定 'DB_TRIGGER_PREFIX' => 'tr_', 'DB_SEQUENCE_PREFIX' => 'ts_', eg:表 tb_user 相对tb_user的序列为: -- Create sequence create sequence TS_USER minvalue 1 maxvalue 999999999999999999999999999 start with 1 increment by 1 nocache; 相对tb_user,ts_user的触发器为: create or replace trigger TR_USER before insert on "TB_USER" for each row begin select "TS_USER".nextval into :NEW.ID from dual; end;

Returns

integer

parseLimit()

parseLimit(  $limit) : string

limit

Parameters

$limit

Returns

string

debug()

debug() 

数据库调试 记录当前SQL

getAll()

getAll() : array

获得所有的查询数据

Returns

array

parseConfig()

parseConfig(mixed  $db_config = '') : string

分析数据库配置信息,支持数组和DSN

Parameters

mixed $db_config

数据库配置信息

Returns

string