On Sat, Apr 9, 2016 at 5:20 PM, Richard Williams <
richard at roguewavelimited.com> wrote:

> I have a PHP program where I have the equivalent of the following code. The
> code was not deleting the expected rows ('abc' & 'def') because of the bad
> syntax. However the error did not throw an exception. Is this what I should
> expect?
>
> $p = new PDO('sqlite::memory:');
> $p->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
> $p->exec("create table a (a text)");
> $sql = "delete from a where a in (a in ('abc','def'))";
> $stat = $p->exec($sql);
>

('abc' & 'def') does not produce a syntax error:

sqlite> select 'abc' & 'def';
0

so your SQL was well-formed, just not what you wanted. Your IN(...)
effectively resolved to IN(0).

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf

Reply via email to