Re: [gnome-db] gda_connection_statement_to_sql() without a connection





On 9 November 2011 11:06, Murray Cumming <murrayc murrayc com> wrote:
In libglom, I'm using
gda_connection_statement_to_sql()
http://developer.gnome.org/libgda/unstable/GdaConnection.html#gda-connection-statement-to-sql
to generate a SQL statement that's appropriate for the particular
backend (PostgreSQL mostly), with the correct quoting (because I use
GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE when opening the
connection).

However, I don't always want an actual connection, because OnlineGlom
then uses that SQL string with its own JDBC Java API.

So is there any easy way to get that SQL string without actually
connecting to the server? gda_statement_to_sql() seems to ignore the
connection and the quoting for case-sensitivity.
http://developer.gnome.org/libgda/unstable/GdaStatement.html#gda-statement-to-sql

There is no easy way of doing this. After a quick analysis, the best to implement this feature (easiest to use and clean solution) would be to allow one to create GdaConnection objects but with the connection closed (which is in fact very easy to do). You could then use the gda_connection_statement_to_sql() normally, and then either discard the connection, or call gda_connection_open() if you need to execute statements. Would it suit your needs?

Vivien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]