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



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.

Regards,
Fernando




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