Subject | RE: [Firebird-Java] Re: JayBird: Problems with Prepared Statements |
---|---|
Author | Rick Debay |
Post date | 2005-09-06T16:56:03Z |
It seems like this is coded backwards. In order to support executing
unprepared SQL, prepared statements are converted to a String so both
prepared and "free-form" SQL gets passed to statementExecutor(String
sqlStatement).
What if instead all Strings get prepared by statementPreparer(String
sqlStatement), and then both types of statements just get executed.
Rick DeBay
-----Original Message-----
From: Firebird-Java@yahoogroups.com
[mailto:Firebird-Java@yahoogroups.com] On Behalf Of pifproject
Sent: Tuesday, September 06, 2005 11:51 AM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] Re: JayBird: Problems with Prepared Statements
the conversion is primarily needed in order to have a single
'statementExecutor(String sqlStatement)' method, which I can also
utilize for other non-prepares SQL statements.
before the "INTERT INTO ..." (may sound strange, but that was what
happened) and I have to cut those out before passing the statement for
execution.
statement to String after the '?'s have been substituted with their
respective values.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
unprepared SQL, prepared statements are converted to a String so both
prepared and "free-form" SQL gets passed to statementExecutor(String
sqlStatement).
What if instead all Strings get prepared by statementPreparer(String
sqlStatement), and then both types of statements just get executed.
Rick DeBay
-----Original Message-----
From: Firebird-Java@yahoogroups.com
[mailto:Firebird-Java@yahoogroups.com] On Behalf Of pifproject
Sent: Tuesday, September 06, 2005 11:51 AM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] Re: JayBird: Problems with Prepared Statements
> Just type few words - Yahoo might decide to remove their messageOkay, I'll try to formulate something as a description.
> database.
> Then why do you need SQLstatement parameter later?I also display that INSERT String as information in the System.out, but
> For now I can imagine only one usage for it - take an object (instance
> of java.sql.Statement interface) and display it to the user.
the conversion is primarily needed in order to have a single
'statementExecutor(String sqlStatement)' method, which I can also
utilize for other non-prepares SQL statements.
> But then, if you have a single method that takes string as parameter,It happened that the PostgreSQL driver adds some additional characters
> why do you need to call toString() method to return the SQL string
> that you just passed?
before the "INTERT INTO ..." (may sound strange, but that was what
happened) and I have to cut those out before passing the statement for
execution.
> If you expect the toString() method to convert parameter marks ('?')I do not think that I expect that, I want to convert the prepared
> into the specified string values - that's another story. It was
> already discussed here
statement to String after the '?'s have been substituted with their
respective values.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links