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

Murray Cumming <[email protected]>
Newsgroups gmane.comp.gnome.db
Message-ID <1320842209.2277.30.camel@murrayc-desktop>
On Wed, 2011-11-09 at 13:27 +0100, Vivien Malerba wrote:
> 
> 
> On 9 November 2011 11:06, Murray Cumming <[email protected]> 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?

I guess that would work. It would solve my problem.

I was thinking that I should somehow call the appropriate code in the
provider without using a connection.


-- 
[email protected]
www.murrayc.com
www.openismus.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.