[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNUe-dev] New condition-element available to Appserver
From: |
malek |
Subject: |
Re: [GNUe-dev] New condition-element available to Appserver |
Date: |
Tue, 25 Jan 2005 15:11:10 +0100 |
User-agent: |
Internet Messaging Program (IMP) 3.2.2 |
hi,
what would be the correct syntax for a session.find()?
is it:
['exist', 'class', 'master', 'detail', [subcondition...]]
or:
['exist', ['table', 'class'], ['masterlink', 'master'], ['detaillink',
'detail'], [subcondition...]]
thanks,
malek
Quoting Johannes Vetter <address@hidden>:
> Hi,
>
> We've introduced a new condition-element 'exist'. It's main purpose is
> to perform a sub-select and to return False if that sub-select was empty
> or True if it was not empty.
>
> Example: Invoicing
>
> I want to see all customers that have an order for item 'FOO'.
>
>
> Here comes the XML-Syntax of the new condition-element:
>
> <datasource name="dtsFoo" ...>
> <condition>
> ...
> <exist table="detailtable" masterlink="f,f,..." detaillink="f,f,...">
> <condition>...</condition>
> </exist>
> ...
> </condition>
> </datasource>
>
> 'table' defines the table to be queried by the sub-select.
> 'masterlink' specifies the fields to be compared from the current
> datasource (i.e. 'dtsFoo')
> 'detaillink' specifies the fields in 'table', which must match with the
> fields in 'masterlink'. Note: the order and number of items must be the
> same.
>
> An optional 'sub-condition' could be added. If it is given, this
> condition will be used as condition for the subselect.
>
>
> Example:
>
> (To see the structures used for this example, please have a look at
> gnue-appserver/samples/testing/joins/struct.gcd)
>
>
> <datasource name="dtsCust" connection="appserver" table="test_customer">
> <condition>
> <exist table="test_lineitem" masterlink="gnue_id"
> detaillink="test_invoice.test_customer">
> <eq>
> <cfield name="test_item.test_code" />
> <cconst value="G1" />
> </eq>
> </exist>
> </condition>
> </datasource>
>
>
> The above definition would select all rows from 'test_customer', which
> have a result in: all rows from test_lineitem, where
> test_invoice.test_customer matches the former row in 'test_customer'
> *and* where 'test_item.test_code' is equal to 'G1'.
>
>
>
> Thanks,
>
> Johannes
>
>
>
> --
> BYTEWISE Software GmbH Tel +43 (5577) 89877-0
> i.A. Johannes Vetter Fax +43 (5577) 89877-66
> A-6890 Lustenau, Enga 2 http://www.bytewise.at
> -------------------------------------------------------
> Wir bieten die Installation von Debian GNU/Linux auf
> Servern für kleinere Netzwerke zum Pauschalpreis an.
> Mehr dazu unter http://www.bytewise.at/texte/pl-debian
>
>