Re: [gnome-db] input values in SQL view



On Sun, Jan 19, 2003 at 02:47:42AM +0100, Fernando Martins wrote:
> 
> Rodrigo wrote:
> > it doesn't understand data types. It just replaces :whatever with the
> > string you enter in the dialog, nothing else. So, you have to either
> > use:
> >
> > select * from customers where name = ':field1'
> >
> > or enter 'value' on the dialog.
> >
> 
> I've been using Zope and it has a nice way to deal with parameters and data
> types:
> 
> select * from customers where name = <dtml-sqlvar field1 type=string>
> 
> Replace string by int, float, nb, etc., (nb means a non-blank string).
> 
> Zope includes another parameter, "Optional", to indicate the parameter might
> be absent. Not sure what's the point of it, though.
> 
> Anyway, with this approach, one could think about other parameters, like
> "default=[default value]" to support default values, or "fmt='%3d'" to
> support formatting a value, or a more generic, but harder to implement,
> "eval=calculate(field1)", to apply a function to the parameter before
> rendering it in the query statement.
> 

Yes, good idea. This way we also could use the plugins from mergeant
which explain how to enter data depending on the data type (so no more
worry about the 'value' instead of simply value).

Cheers


Vivien



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