PHP Class Swoole\Database\MySQLi

Author: Tianfeng.Han
Inheritance: extends mysqli, implements Swoole\IDatabase
Show file Open project: matyhtf/swoole_framework Class Usage Examples

Public Properties

Property Type Description
$config
$conn
$debug

Public Methods

Method Description
Insert_ID ( ) : integer 返回上一个Insert语句的自增主键ID
__construct ( $db_config )
connect ( null $_host = null, null $user = null, null $password = null, null $database = null, null $port = null, null $socket = null ) : boolean 参数为了兼容parent类,代码不会使用传入的参数作为配置
errno ( ) : integer 获取错误码
getAffectedRows ( ) : integer 获取受影响的行数
lastInsertId ( )
multi_query ( string $sql ) : MySQLiRecord | false 执行多个SQL语句
query ( string $sql ) : MySQLiRecord | false 执行一个SQL语句
queryAsync ( $sql ) : boolean | mysqli_result 异步SQL
quote ( $value ) : string 过滤特殊字符

Protected Methods

Method Description
checkConnection ( ) 检查数据库连接,是否有效,无效则重新建立
errorMessage ( $sql ) : string SQL错误信息
tryReconnect ( $call, $params )

Method Details

Insert_ID() public method

返回上一个Insert语句的自增主键ID
public Insert_ID ( ) : integer
return integer

__construct() public method

public __construct ( $db_config )

checkConnection() protected method

检查数据库连接,是否有效,无效则重新建立
protected checkConnection ( )

connect() public method

参数为了兼容parent类,代码不会使用传入的参数作为配置
public connect ( null $_host = null, null $user = null, null $password = null, null $database = null, null $port = null, null $socket = null ) : boolean
$_host null
$user null
$password null
$database null
$port null
$socket null
return boolean

errno() public method

获取错误码
public errno ( ) : integer
return integer

errorMessage() protected method

SQL错误信息
protected errorMessage ( $sql ) : string
$sql
return string

getAffectedRows() public method

获取受影响的行数
public getAffectedRows ( ) : integer
return integer

lastInsertId() public method

public lastInsertId ( )

multi_query() public method

执行多个SQL语句
public multi_query ( string $sql ) : MySQLiRecord | false
$sql string 执行的SQL语句
return MySQLiRecord | false | false

query() public method

执行一个SQL语句
public query ( string $sql ) : MySQLiRecord | false
$sql string 执行的SQL语句
return MySQLiRecord | false | false

queryAsync() public method

异步SQL
public queryAsync ( $sql ) : boolean | mysqli_result
$sql
return boolean | mysqli_result

quote() public method

过滤特殊字符
public quote ( $value ) : string
$value
return string

tryReconnect() protected method

protected tryReconnect ( $call, $params )

Property Details

$config public property

public $config

$conn public property

public $conn

$debug public property

public $debug