I think in your first example, the :a comes first, so it is assigned the first 
index value. You then use ?1, which also uses the first parameter index.

In the second, you use ?1 first, then :b, which sees the first index has been 
used and thus assigns it to the second index.

As I believe Jay said, you should not mix named and numbered parameter syntax.

David

--- On Mon, 6/14/10, Israel Lins Albuquerque <israel...@polibrasnet.com.br> 
wrote:

> From: Israel Lins Albuquerque <israel...@polibrasnet.com.br>
> Subject: Re: [sqlite] Parametrized Queries issue (Possible bug)
> To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
> Date: Monday, June 14, 2010, 10:55 AM
> Once more detail... 
> 
> Doing this... 
> 
> SELECT * 
> FROM a 
> WHERE a.a = :a 
> AND a.b = ?1; 
> 
> and this... 
> 
> SELECT * 
> FROM a 
> WHERE a.a = ?1 
> AND a.b = :b; 
> 
> Will have different behavior! 
> 
> 
> 
> ----- Mensagem original ----- 
> De: "Israel Lins Albuquerque" <israel...@polibrasnet.com.br>
> 
> Para: "sqlite-users" <sqlite-users@sqlite.org>
> 
> Enviadas: Segunda-feira, 14 de Junho de 2010 11:51:07 
> Assunto: [sqlite] Parametrized Queries issue (Possible bug)
> 
> 
> Using the example above I see one not documented issue.
> When I use parameters ?NNN and :AAAA or @AAAA or $AAAA , 
> in same query as above some of then will be omitted. I
> don't know if this is the expected behavior or not. 
> 
> CREATE TABLE a (a, b); 
> CREATE TABLE b (a, b); 
> 
> INSERT INTO a VALUES (0, 1); 
> INSERT INTO a VALUES (1, 0); 
> INSERT INTO a VALUES (1, 1); 
> INSERT INTO b VALUES (0, 1); 
> INSERT INTO b VALUES (1, 0); 
> INSERT INTO b VALUES (1, 1); 
> 
> SELECT * 
> FROM a 
> JOIN b ON (a.a = b.a AND a.b = :b AND a.b = b.b) 
> WHERE a.a = ?1; 
> 
> In this query as 2 parameters but will be see like only
> one! 
> 
> -- 
> 
> Atenciosamente/Regards, 
> 
> Israel Lins Albuquerque 
> Desenvolvimento/Development 
> Polibrás Brasil Software Ltda. 
> 
> 
> _______________________________________________ 
> sqlite-users mailing list 
> sqlite-users@sqlite.org
> 
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 
> 
> -- 
> 
> Atenciosamente/Regards, 
> 
> Israel Lins Albuquerque 
> Desenvolvimento/Development 
> Polibrás Brasil Software Ltda. 
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to