EasySwoole\Mysqli\QueryBuilder; 构造器
$queryBuilder= new QueryBuilder();
增 $queryBuilder->insert('table_name',[ ]);
删 $queryBuilder->where(column,value)->delete('table_name');
改 $queryBuilder->where(column,value)->update('table_name',[ ]);
查:
$queryBuilder->where(column,value)->getOne('table_name');
$queryBuilder->where(column,value)->get('table_name');
limit();
fields([]);
join('table2','condition');
withTotalCount();
到目前为止还未执行,只不过是构造了sql语句,获取sql语句 $queryBuilder->getLastQuery();
我们也可以直接构造一个原生sql表达式
$queryBuilder->raw("select * from employee where id = ?",[1]);
执行:$result = DbManager::getInstance()->query($queryBuilder,true,'default');
第二个参数raw是否为原生sql,第三个参数ConnectionName指定连接名