$table->select()->where('? = id', 123); // <-- valid SQL
--
Hector
--
Hector
On Thu, Aug 27, 2009 at 2:38 PM, Thasmo <thasmo@gmail.com> wrote:
Maybe that's right, in this case I guess,
it won't affect anything, as the '?'-sign won't
ever be at position 1, as long as I understand the quote function.
Anyone there to test it?
Mamsaac schrieb:
I'm not really looking into trying the code, since I was just reading some of
the Db code for entertaining (hey! it's better than some bad novels =) ).
I came up with this part in class Zend_Db_Adapter_Abstract:
public function quoteInto($text, $value, $type = null, $count = null) {
if ($count === null) {
return str_replace('?', $this->quote($value, $type), $text);
} else {
while ($count > 0) {
if (strpos($text, '?') != false) {
$text = substr_replace($text, $this->quote($value),
strpos($text, '?'), 1);
}
--$count;
}
return $text;
}
}
My issue, and I'm probably wrong, but this shouldn't take long, is that I
believe that strpos($text, '?') != false should be strpos($text, '?') !==
false
If the "?" is the first character, it would just not replace it. (I mean, ?
being in position 0).
If I'm wrong, I apologize for taking a quick reaction without verifying...
but I don't have any applications of mine using the ZF (again, I was just
reading :D) and I'm not supposed to waste too much time =)
And if this is not the right place to ask about this, again, sorry =)
没有评论:
发表评论