[Zope-DB] how to get all values if input is not defined?

Cynthia Kiser cnk at caltech.edu
Wed Apr 7 16:24:18 EDT 2004

You want to use sqltest with the type of "nb". From

    The data type of the value to be inserted. This attribute is required
    and may be one of string, int, float, or nb. The nb data type stands
    for "not blank" and indicates a string that must have a length that is
    greater than 0. When using the nb type, the sqltest tag will not
    render if the variable is an empty string.

So for you example, the code should look something like: 

select * from X 
  where <dtml-sqltest A op=eq type=nb>

Quoting Jaroslav Lukesh <lukesh at seznam.cz>:
> Dear sirs,
> I have table X
> A	B
> aa	bb
> ab	bc
> aa	bd
> aa	be
> and have ZSQL method:
> <params>
> A:string=""
> </params>
> FROM    X
> WHERE   (X.A = <dtml-sqlvar A type="string">)
> How to display all table if A is not selected by user?
> Yes, it is possible to make "select * from X" and filter-out unwanted 
> results in DTML method. But it is not what I want because table is 
> really big and I need to make dtml-in batch query limit.
> Many thanks for your help,
> -- 
> Jaroslav Luke?
> --
> Tento e-mail nem??e obsahovat VIRY
> jeliko? nepoch?zi z vir?zn?ho syst?mu M$ Windows!
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org
> http://mail.zope.org/mailman/listinfo/zope-db

More information about the Zope-DB mailing list