Db Query Builder Select
在开启命名空间情况下(asf.use_namespace=1)类名为 Asf\Db\QueryBuilder\Select
<?php final class Asf_Db_QueryBuilder_Select extends Asf_Db_AbstractQueryBuilder { public function join(string $columns [, string $alias_columns = '']) public function leftJoin(string $columns [, string $alias_columns = '']) public function rightJoin(string $columns [, string $alias_columns = '']) public function innerJoin(string $columns [, string $alias_columns = '']) public function cols(mixed $columns, ...) public function having(string $columns, mixed $value [, string $operator = '=']) public function max(string $columns [, string $alias_columns ='']) public function min(string $columns [, string $alias_columns = '']) public function count(string $columns [, string $alias_columns = '') public function sum(string $columns [, string $alias_columns = '']) public function on(string $cloumn_a, string $cloumn_b) public function distinct(string $columns [, string $alias_columns = '']) public function groupBy(string $columns) public function orderBy(string $columns [, string $operator = 'DESC']) public function union(void) public function unionAll(void) public function __construct(void) /* alias __construct */ public function select(void) }
Call function 'cols()', The Default value is '*'
<?php // SELECT * FROM `test` WHERE `id` BETWEEN ? AND ? LIMIT 10, 20 [BVALUES] 1, 100 $select = new Asf_Db_QueryBuilder_Select(); $select ->cols() ->from('test') ->between('id', 1, 100) ->limit(10, 20);
Call function 'cols(array $data)', parameters passed array type.
<?php // SELECT `id`, 'user', 'pass' FROM `test` WHERE `id` BETWEEN ? AND ? LIMIT 10, 20 [BVALUES] 1, 100 $select = new Asf_Db_QueryBuilder_Select(); $select ->cols(array('id', 'user', 'pass')) ->from('test') ->between('id', 1, 100) ->limit(10, 20);
Call function 'cols(string $data)', parameters passed string type.
<?php // string(71) "[SQL] SELECT a, b, c, d FROM `test` WHERE `k` LIKE '%?%' [BVALUES] 1" $select = new Asf_Db_QueryBuilder_Select(); $select ->cols('a, b, c, d') ->from('test') ->like('k', 1);