$connect->query("select count(*) from test.test"); //二、Query组件查询 //2.1 Select部分 //2.1.1 创建select对象 $select = \HuiLib\Db\Query::select(); //2.1.2 设置查询表格等操作 $select->table('test'); //2.1.3 Where条件设置支持三种形式: //键值式(createPair) $select->where(Where::createPair('id', 2)); //=> id='2' //文本式(createPlain) $select->where(Where::createPlain("name is null")); //=>"name is null" //占位式(createQuote) $select->where(Where::createQuote('id=?', 2)); //=>"id='2'" //同时支持绑定式 $select->where(Where::createPlain('t.id=:id')); $re = $select->prepare()->execute(array('id' => 14)); //2.1.4 设置表、字段和别名 $select->table(array('AliasTable' => 'test')); //数组键是别名 $select->columns(array('AliasId' => 'id', 'AliasTest' => 'test')); //数组键是别名 //2.1.5 支持Join $select->join(array('AliasTable' => 'name'), 't.id=n.tid', 'n.name as sname, n.sid as bbid'); //表名、ON条件、获取字段 //2.1.6 发起查询 $select->query(); //或者这样