• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Prepared statements

 
Yasir Qureshi
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using preapared statments, I was just wondering what if my in clause is dynamic, I am passing CSV values in my 'in' clause and not calling .set methods, for example

select a.* from A a where a.id in (params)
Params is string that is dynamically generated and its a CSV not string having question marks, i.e.: (1,2,3) not (?,?,?)

In this case will this query be considered as a single query and compiled once or it is considered separate query and compile every time.

Thanks in advance,
Yasir.
 
Jan Cumps
Bartender
Posts: 2586
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a separate query each time you send a unique combination of parameters.
But your query is so simple that the analyze and compile cost / time can't be a lot.

Regards, Jan
 
Yasir Qureshi
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank for reply Jan, so it means in this case using Prepared statement is not going to make very big difference.

Yasir.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Yasir",

We're pleased to have you here with us here at JavaRanch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character.

Thanks,
Jeanne
Forum Bartender
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic