\Database

+------------------------------------------------------------------------------ Framk PHP框架 +------------------------------------------------------------------------------

Summary

Methods
Properties
Constants
__construct()
findAll()
findOne()
countRecords()
updt()
update()
insert()
replace()
delete()
execSql()
getMaxValue()
getCount()
getTableEngine()
prepareSql()
execute()
setAttribute()
begintrans()
commit()
rollback()
execTransaction()
destruct()
version()
__destruct()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
checkFields()
getFields()
getPDOError()
debug()
outputError()
$db
$transTimes
N/A

Properties

$db

$db : 

Type

$transTimes

$transTimes : 

Type

Methods

__construct()

__construct() 

findAll()

findAll(  $sql) 

Parameters

$sql

findOne()

findOne(  $sql) 

Parameters

$sql

countRecords()

countRecords(  $sql) 

Parameters

$sql

updt()

updt(  $sql) 

Parameters

$sql

update()

update(String  $table, Array  $arrayDataValue, String  $where = '', Boolean  $debug = false) : Int

Update 更新

Parameters

String $table

表名

Array $arrayDataValue

字段与值

String $where

条件

Boolean $debug

Returns

Int

insert()

insert(String  $table, Array  $arrayDataValue, Boolean  $debug = false) : Int

Insert 插入

Parameters

String $table

表名

Array $arrayDataValue

字段与值

Boolean $debug

Returns

Int

replace()

replace(String  $table, Array  $arrayDataValue, Boolean  $debug = false) : Int

Replace 覆盖方式插入

Parameters

String $table

表名

Array $arrayDataValue

字段与值

Boolean $debug

Returns

Int

delete()

delete(String  $table, String  $where = '', Boolean  $debug = false) : Int

Delete 删除

Parameters

String $table

表名

String $where

条件

Boolean $debug

Returns

Int

execSql()

execSql(String  $strSql, Boolean  $debug = false) : Int

execSql 执行SQL语句,debug=>true可打印sql调试

Parameters

String $strSql
Boolean $debug

Returns

Int

getMaxValue()

getMaxValue(string  $table, string  $field_name, string  $where = '',   $debug = false) 

获取字段最大值

Parameters

string $table

表名

string $field_name

字段名

string $where

条件

$debug

getCount()

getCount(string  $table, string  $field_name, string  $where = '', boolean  $debug = false) : integer

获取指定列的数量

Parameters

string $table
string $field_name
string $where
boolean $debug

Returns

integer

getTableEngine()

getTableEngine(String  $dbName, String  $tableName) : String

获取表引擎

Parameters

String $dbName

库名

String $tableName

表名

Returns

String

prepareSql()

prepareSql(  $sql = '') 

Parameters

$sql

execute()

execute(  $presql) 

Parameters

$presql

setAttribute()

setAttribute(  $p,   $d) 

pdo属性设置

Parameters

$p
$d

begintrans()

begintrans() 

beginTransaction 事务开始

commit()

commit() 

commit 事务提交

rollback()

rollback() 

rollback 事务回滚

execTransaction()

execTransaction(array  $arraySql) : Boolean

transaction 通过事务处理多条SQL语句 调用前需通过getTableEngine判断表引擎是否支持事务

Parameters

array $arraySql

Returns

Boolean

destruct()

destruct() 

destruct 关闭数据库连接

version()

version() : \boolen

数据库版本号

Returns

\boolen

__destruct()

__destruct() 

checkFields()

checkFields(String  $table,   $arrayFields) 

checkFields 检查指定字段是否在指定数据表中存在

Parameters

String $table
$arrayFields

getFields()

getFields(String  $table) : array

getFields 获取指定数据表中的全部字段名

Parameters

String $table

表名

Returns

array

getPDOError()

getPDOError() 

getPDOError 捕获PDO错误信息

debug()

debug(mixed  $debuginfo) 

debug

Parameters

mixed $debuginfo

outputError()

outputError(String  $strErrMsg) 

输出错误信息

Parameters

String $strErrMsg