CrossPHP

SqlInterface
in

Interface SqlInterface

Table of Contents

add()  : mixed
添加数据
del()  : mixed
删除数据
find()  : mixed
带分页的查询
get()  : mixed
获取一条数据
getAll()  : mixed
批量获取表中的数据
update()  : mixed
更新数据

Methods

add()

添加数据

public add(string $table, mixed $data[, bool $multi = false ]) : mixed
Parameters
$table : string

表名

$data : mixed

要插入的数据

$multi : bool = false

是否批量插入

Return values
mixed

del()

删除数据

public del(string $table, mixed $where) : mixed
Parameters
$table : string

表名

$where : mixed

条件

Return values
mixed

find()

带分页的查询

public find(string $table, string $fields, string|array<string|int, mixed> $where[, array<string|int, mixed> &$page = ['p' => 1, 'limit' => 10] ][, mixed $order = null ][, mixed $groupBy = null ]) : mixed
Parameters
$table : string

表名

$fields : string

字段名

$where : string|array<string|int, mixed>

条件(建议只使用字符串常量,包含变量时请使用数组)

$page : array<string|int, mixed> = ['p' => 1, 'limit' => 10]

['p', 'limit'] p,当前页 limit,分页条数

$order : mixed = null

排序

$groupBy : mixed = null
Return values
mixed

get()

获取一条数据

public get(string $table, string $fields, string|array<string|int, mixed> $where) : mixed
Parameters
$table : string

表名

$fields : string

字段

$where : string|array<string|int, mixed>

条件(建议只使用字符串常量,包含变量时请使用数组)

Return values
mixed

getAll()

批量获取表中的数据

public getAll(string $table, string $fields[, string|array<string|int, mixed> $where = [] ][, mixed $order = null ][, mixed $groupBy = null ], int|string $limit) : mixed
Parameters
$table : string

表名

$fields : string

要获取的字段名

$where : string|array<string|int, mixed> = []

条件(建议只使用字符串常量,包含变量时请使用数组)

$order : mixed = null

排序

$groupBy : mixed = null

分组

$limit : int|string

0表示无限制

Return values
mixed

update()

更新数据

public update(string $table, mixed $data, mixed $where) : mixed
Parameters
$table : string

表名

$data : mixed

要更新的数据

$where : mixed

筛选条件

Return values
mixed

Search results