\DbSql

SQL语句生成类.

Summary

Methods
Properties
Constants
__construct()
ReplacePre()
get()
DelTable()
ExistTable()
CreateTable()
Select()
Count()
Update()
Insert()
Delete()
Filter()
Export()
Transaction()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$db
$dbclass
$sql
$_explort_db
N/A

Properties

$dbclass

$dbclass : null|string

Type

null|string — 数据库类型名称

$sql

$sql : 

Type

$_explort_db

$_explort_db : 

导出sql生成语句,用于备份数据用。

Type

Methods

__construct()

__construct(  $db = null) 

Parameters

$db

ReplacePre()

ReplacePre(string  $s) : string

替换数据表前缀

Parameters

string $s

Returns

string

DelTable()

DelTable(string  $table) : string

删除表,返回SQL语句.

Parameters

string $table

Returns

string

ExistTable()

ExistTable(string  $table, string  $dbname = '') : string

检查表是否存在,返回SQL语句.

Parameters

string $table
string $dbname

Returns

string

CreateTable()

CreateTable(string  $table, array  $datainfo, null  $engine = null) : string

创建表,返回构造完整的SQL语句.

Parameters

string $table
array $datainfo
null $engine

Returns

string

Select()

Select(string  $table, string  $select = null, string  $where = null, string  $order = null, string  $limit = null, array|null  $option = null) : string

构造查询语句.

Parameters

string $table
string $select
string $where
string $order
string $limit
array|null $option

Returns

string —

返回构造的语句

Count()

Count(string  $table, mixed  $count, mixed  $where = null, null  $option = null) : string

构造计数语句.

Parameters

string $table
mixed $count
mixed $where
null $option

Returns

string —

返回构造的语句

Update()

Update(string  $table, mixed  $keyvalue, mixed  $where, array|null  $option = null) : string

构造数据更新语句.

Parameters

string $table
mixed $keyvalue
mixed $where
array|null $option

Returns

string —

返回构造的语句

Insert()

Insert(string  $table, mixed  $keyvalue) : string

构造数据插入语句.

Parameters

string $table
mixed $keyvalue

Returns

string —

返回构造的语句

Delete()

Delete(string  $table, mixed  $where, array|null  $option = null) : string

构造数据删除语句.

Parameters

string $table
mixed $where
array|null $option

Returns

string —

返回构造的语句

Filter()

Filter(  $sql) : mixed

返回经过过滤的SQL语句.

Parameters

$sql

Returns

mixed

Export()

Export(  $table,   $keyvalue,   $type = 'mysql') 

Parameters

$table
$keyvalue
$type

Transaction()

Transaction(  $command) 

Parameters

$command