Re: [gnome-db] Studying the posibility to add parametrized statements



On Tue, 2004-09-28 at 19:18 +0000, Jeronimo Albi wrote:
> On Mon, 27 Sep 2004 17:43:16 +0200
> Vivien Malerba <vmalerba gmail com> wrote:
> 
> > 
> > I've already done this for Mergeant/libmergeant.
> > 
> > Basically, any SQL statement can have parameters identified by a value
> > of ## and parameter specifications between square brackets. For
> > example one can write
> > SELECT name FROM table WHERE name='joe' [...]
> > or 
> > SELECT name FROM table WHERE name=## [...]
> > the above statement require one parameter for the "name=" condition.
> > In the first statament, the default value for the parameter is 'joe'
> > and in the second example, there is no default value for the
> > parameter.
> > 
> > The para specifications between the square brackets are:
> > :name="my para name"
> > :descr="my para description"
> > :type="the DBMS type"
> > :nullok="TRUE"
> > :isparam="FALSE" (default=TRUE)
> > 
>   Shouldn't type and nullok be initialized by each provider ? I only have
> some experience using Firebird/Interbase, and they initialize each parameter
> to ist correct type and null flag, after preparing the statement for execution.
>   
>   I'd really apreciate if someone can explain me how parameters are handled 
> in Postgres and MySQL.
> 
> > so the above example can be:
> > SELECT name FROM table WHERE name='joe' [:name="User name"
> > :descr="Enter the user name to look for" :type="varchar"]
> > 
>   Its ok, but it seems to be impractical if you use too many parameters,
> its kinda long, dont you think ?
>   
> > The SQL parser in libgda (libsql/*) already supports this syntax.
> > 
> > Libmergeant also has a small parser to isolate the parameters from any
> > text (usefull when the SQL text can't be parsed by libgda's parser for
> > various reasons); it's in libmergeant/parser/*
> > 
>   This would save lot of time, great !
> 
> > I think it would be a good idea to start libgda's implementation of
> > parameters with the same syntax and the same libgda's parser.
> > 
>   Yes it might be a good idea, so if you and Rodrigo agree I'll use libmergeant
> format.
> 
I do agree, provided we get into account how to best help in the future
integration of the 3 libraries.
-- 
Rodrigo Moya <rodrigo gnome-db org>




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