This one time, at band camp, Bob Lee said:
BL>The first query has the value inserted directly into the query string,
BL>whereas you use the bind() method to set the parameters in the second.
BL>
BL>Setting parameters using the bind() method is surely the better
BL>practice. The question was out of curiosity. Actually, one of my
BL>co-workers asked me.
BL>
BL>Thanks,
BL>Bob
BL>
BL>Bruce Snyder wrote:
BL>> This one time, at band camp, Bob Lee said:
BL>>
BL>> BL>When does Castor use prepared statements?
BL>> BL>
BL>> BL>For example, will:
BL>> BL>
BL>> BL>SELECT o FROM SomeObject o WHERE o.id = '1'
BL>> BL>
BL>> BL>and
BL>> BL>
BL>> BL>SELECT o FROM SomeObject o WHERE o.id = ?
BL>> BL>
BL>> BL>result in the same prepared statement?
BL>>
BL>> Castor uses PreparedStatements for most of the queries to
BL>> persistence. These queries are generated based on the mapping
BL>> descriptor. As for your second question, I'm not sure I follow. In what
BL>> context are these two queries used?
My apologies, my reply wasn't very clear I guess. I know all about
PreparedStatements. The trouble I have with your question is that the
first query is a Statement (not pre-compiled) and the second one is a
PreparedStatement (pre-compiled). The two are different as far as JDBC
is concerned.
Also, I think that you're asking about queries from your application and
whether Castor is going to turn a Statement into a PreparedStatement. The
answer is no.
If you're just asking about JDBC, the Statement is slower and less
efficient than the PreparedStatement.
Bruce
--
perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev