Re: [gnome-db] Studying the posibility to add parametrized statements
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: Vivien Malerba <vmalerba gmail com>
- Cc: Dru <andru treshna com>, GDA <gnome-db-list gnome org>, Jeronimo Albi <amenofisvii yahoo com ar>
- Subject: Re: [gnome-db] Studying the posibility to add parametrized statements
- Date: Mon, 11 Oct 2004 10:07:52 +0200
On Mon, 2004-10-11 at 09:48 +0200, Vivien Malerba wrote:
> On Mon, 11 Oct 2004 20:37:17 +1300, Dru <andru treshna com> wrote:
> > Vivien Malerba wrote:
> >
> > >On Sun, 10 Oct 2004 13:43:05 +0000, Jeronimo Albi
> > ><amenofisvii yahoo com ar> wrote:
> > >[...]
> > >
> > >
> > >> How should i replace parameters with a token to be interpreted by
> > >>a database engine as parameter. For example in Firebird:
> > >>
> > >> a. Original statement:
> > >> SELECT name FROM table WHERE name=## [:name="User name"]
> > >> b. Parsed statement shuld be:
> > >> SELECT name FROM table WHERE name=?
> > >>
> > >>where "?" is interpreted as parameter.
> > >>
> > >>
> > >
> > >The problem with the structures built by the parser is that they are
> > >very efficient for parsing a query, but not adapted to render a
> > >structure as a SQL statement. I don't have this problem in libmergeant
> > >since I never use that feature (the sql_statement structure is used to
> > >create MgQuery objects and then discarded, and then the MgQuery is
> > >responsible to do its own rendering taking into account the real
> > >values for the parameters).
> > >
> > >
> > Creating statements for insert/delete/update is pretty easy
> > without using the sql parser. Its strength is pulling apart
> > select statements so you know exactly whats been asked.
> > Should anything be done for its future direction?
> >
>
> As I said I exclusively use the SQL parser to parse a SQL string, not
> to generate a string, and I think it should stay like that: the SQL
> rendering should not be done by the parser.
>
well, we can still provide functions that can be used when no special
SQL is needed. That is, some providers (XML for instance) will
understand the same SQL that the SQL parser supports, so it makes sense
to provide a _to_string function to get the string for that command.
--
Rodrigo Moya <rodrigo gnome-db org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]