Friday, August 16, 2013

Re: Prepared Statement (Custom SQL) always returns bool(true) instead of results

That was a typo, should be $db = $this->getDataSource();

Still having the issue though

On Friday, August 16, 2013 4:43:34 PM UTC-7, Xtagon wrote:
Hi,

I know that it is always recommended to use find() instead of custom SQL, but I have a use case where I need to use a custom prepared statement. Problem is, it always returns bool(true) instead of a results array, even if I'm just doing a very basic SELECT with nothing complex going on in the query. Is this a bug or am I using the function wrong?

Here's an example of code that would return bool(true) as shown by dump_var (this is in a model function):

$db = $this->getDataSource;
$return $db->fetchAll("SELECT TOP 10 * FROM MyTable");

I'm using MS SQL if that makes any difference.

Thanks in advance for your assistance!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: