开发者

recess framework, select query

开发者 https://www.devze.com 2023-02-09 00:52 出处:网络
Is there a way in recess framework to do a SELECT mycolumn1, mycolumn2 and not a SELECT * on the Model. I only find the $this->开发者_运维技巧model->select() function and it not allowing that.

Is there a way in recess framework to do a SELECT mycolumn1, mycolumn2 and not a SELECT * on the Model. I only find the $this->开发者_运维技巧model->select() function and it not allowing that.

Thank you,


The Recess framework is designed to return an object model when you try to query the database. So you are stuck with the select *, because every property of the object must be returned. It is possible to get around this if you access the PDO itself. For example:

$results = Databases::getSource('dataSourceName');
$set = $results->query("SELECT col1, col2 FROM table");

This will give you resultsSet object that you can iterate through. You won't be able to use the ->insert() and ->equal() and other wrapper methods on that object though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号