Re: [sqlite] Prepared Statement (select * from x where y in ());

2007-07-19 Thread Scott Hess

Long ago and far away, I build a database abstraction layer which used
?@ for this.  So you'd say something like:

  stmt = prepare("select * from table where xyz in (?@)");
  bind_array(stmt, 0, arrayRef);

The library would take the array, quote each element, and separate
them with commas.  It was pretty nice when you needed it.
Unfortunately, this wasn't for sqlite :-).

One option would be to write code to build the statement with the
right number of ?, then bind that many.  Very annoying.

Another option would be to create a temporary table, run through the
array doing individual INSERT statements, then "select * from table
where xyz in (select * from temp_table)".  Also very annoying.

-scott


On 7/18/07, RaghavendraK 70574 <[EMAIL PROTECTED]> wrote:


May be my Q is not clear,

Problem is as shown below,

SQL = "select * from table where xyz in (:abc);"

bind_text("'ab','xy','zx','123'")

bind_text will append '' at the begining and at end making it as one string 
rather
than ab,xy,zx.

regards
ragha


**
 This email and its attachments contain confidential information from HUAWEI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!
 
*

- Original Message -
From: Bharath Booshan L <[EMAIL PROTECTED]>
Date: Thursday, July 19, 2007 11:56 am
Subject: Re: [sqlite] Prepared Statement (select * from x where y in ());

>
>
>
> > 1)How can we prepare a SQliteStatement for the following type of
> select,>   select * from tablename where column in (?);
> >   ?: we don;t know the length of this string.
>
>
> Pass any value less than zero as 3rd parameter to sqlite3_prepare
> function,in which case, characters up to the first null terminator
> will be
> considered.
>
> Cheers,
>
> Bharath Booshan L.
>
>
>
> ---
> Robosoft Technologies - Come home to Technology
>
> Disclaimer: This email may contain confidential material. If you
> were not an intended recipient, please notify the sender and
> delete all copies. Emails to and from our network may be logged
> and monitored. This email and its attachments are scanned for
> virus by our scanners and are believed to be safe. However, no
> warranty is given that this email is free of malicious content or
> virus.
>
>
>
> ---
> --
> To unsubscribe, send email to [EMAIL PROTECTED]
> ---
> --
>
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Prepared Statement (select * from x where y in ());

2007-07-18 Thread RaghavendraK 70574

May be my Q is not clear,

Problem is as shown below,

SQL = "select * from table where xyz in (:abc);"

bind_text("'ab','xy','zx','123'")

bind_text will append '' at the begining and at end making it as one string 
rather 
than ab,xy,zx.

regards
ragha


**
 This email and its attachments contain confidential information from HUAWEI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!
 
*

- Original Message -
From: Bharath Booshan L <[EMAIL PROTECTED]>
Date: Thursday, July 19, 2007 11:56 am
Subject: Re: [sqlite] Prepared Statement (select * from x where y in ());

> 
> 
> 
> > 1)How can we prepare a SQliteStatement for the following type of 
> select,>   select * from tablename where column in (?);
> >   ?: we don;t know the length of this string.
> 
> 
> Pass any value less than zero as 3rd parameter to sqlite3_prepare 
> function,in which case, characters up to the first null terminator 
> will be
> considered.
> 
> Cheers,
> 
> Bharath Booshan L.
> 
> 
> 
> ---
> Robosoft Technologies - Come home to Technology
> 
> Disclaimer: This email may contain confidential material. If you 
> were not an intended recipient, please notify the sender and 
> delete all copies. Emails to and from our network may be logged 
> and monitored. This email and its attachments are scanned for 
> virus by our scanners and are believed to be safe. However, no 
> warranty is given that this email is free of malicious content or 
> virus.
> 
> 
> 
> ---
> --
> To unsubscribe, send email to [EMAIL PROTECTED]
> ---
> --
> 
> 

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Prepared Statement (select * from x where y in ());

2007-07-18 Thread Bharath Booshan L



> 1)How can we prepare a SQliteStatement for the following type of select,
>   select * from tablename where column in (?);
>   ?: we don;t know the length of this string.


Pass any value less than zero as 3rd parameter to sqlite3_prepare function,
in which case, characters up to the first null terminator will be
considered.

Cheers,

Bharath Booshan L.



---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Prepared Statement (select * from x where y in ());

2007-07-18 Thread RaghavendraK 70574
HI,

1)How can we prepare a SQliteStatement for the following type of select,
  select * from tablename where column in (?);
  ?: we don;t know the length of this string.

2) Can we mix SqliteStatement and sqlite3_exec functions?

regads
ragha



**
 This email and its attachments contain confidential information from HUAWEI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!
 
*

-
To unsubscribe, send email to [EMAIL PROTECTED]
-