Re: OT: PreparedStatement with dynamic parameter list

2003-04-01 Thread John Turner
The SQL parameter passed to java.sql.Connection.preparedStatement() is a 
String.  You can write whatever logic you want to build that string, 
including counting the number of arguments obtained from somewhere else and 
building the right number of placeholders accordingly.  Probably won't be 
very elegant, but certainly possible.

John

On Tue, 1 Apr 2003 10:36:14 -0500, Chakravarthy, Sundar 
[EMAIL PROTECTED] wrote:

Has anyone constructed a PreparedStatement where the number of ?s ( i.e
bind variables ) is unknown at compile time  ?
Is there any support of that in JDBC ?

Thanks

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: OT: PreparedStatement with dynamic parameter list

2003-04-01 Thread Larry Meadors
Here are a couple of options for this:

The open-source ibatis database framework (www.ibatis.com) lets you do
this.

Another home-grown solution would be to create a StringBuffer for your
SQL, and a map for the parameters. Then you can prepare the statement,
and iterate through the map setting the parameters.

Larry

 [EMAIL PROTECTED] 04/01/03 08:37 AM 

Has anyone constructed a PreparedStatement where the number of ?s ( i.e
bind variables ) is unknown at compile time  ?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]