Sunday, November 22, 2009

Search between two tables

With an account POID, search for the product name of its products.

The sql template to use here would be:

"select X from /product 1, /purchased_product 2 where ( 2.F1 = V1 and 1.F2 = 2.F3 ) "

where F1 = PIN_FLD_ACCOUNT_OBJ
F2 = PIN_FLD_POID
F3 = PIN_FLD_PRODUCT_OBJ
V1 = account POID

The search flist looks like this:

0 PIN_FLD_POID POID [0] 0.0.0.1 /search 0 0
0 PIN_FLD_TEMPLATE STR [0] "select X from /product 1, /purchased_product 2 where ( 2.F1 = V1 and 1.F2 = 2.F3 ) "
0 PIN_FLD_FLAGS INT [0] 256
0 PIN_FLD_ARGS ARRAY [1] allocated 20, used 1
1 PIN_FLD_ACCOUNT_OBJ POID [0] 0.0.0.1 /account 20454
0 PIN_FLD_ARGS ARRAY [2] allocated 20, used 1
1 PIN_FLD_POID POID [0] NULL poid pointer
0 PIN_FLD_ARGS ARRAY [3] allocated 20, used 1
1 PIN_FLD_PRODUCT_OBJ POID [0] NULL poid pointer
0 PIN_FLD_RESULTS ARRAY [0] allocated 20, used 1
1 PIN_FLD_NAME STR [0] ""

No comments: