[ic] Excact match don't works on searches for empty values - how do error handling in the page?

Steffen Dettmer interchange-users@interchange.redhat.com
Sat Oct 6 10:58:01 2001


Hi, 

imagine the following data:

playdb=> select * from test;
 id | group_id |  info
----+----------+--------
  1 |        0 | null
  2 |        1 | eins

Now I tried a [loop search] the get a list of all infos for a
given group_id into some <table>:

  [comment]debug: overwriting group_id[/comment]
  [set group_id]0[/set]

  [loop search="ra=no/fi=test/em=yes/se=[scratch group_id]/sf=group_id"]
    <tr>
      <td> [loop-code]                </td>
      <td> [loop-data test group_id]  </td>
      <td> [loop-data test info]      </td>
    </tr>
  [/loop]

This works. If I [set] it to 1, it works (returns right values).
Even if I [set]0 [/set] it works (returns nothing) as expected on
mv_exact_match=yes. But on [set group_id][/set] it fails and
returns _all_ records; it looks like "" matches no anything. 
I configured "Database test numeric group_id". So I would expect
some error when [scratch group_id] is non-numeric - in error.log
it's found as "> You had no search string specified.", but of
course I need it in the page. Is there a [onerror] like
possibility?

What do I am missing?

BTW, another question. In this search, is the condition evaluated
by the database or are all records fetched and evaluated by
interchange? It looks like the second, since the database
evaluates i.e. : "select * from test where group_id = ''" as
matching on zero (PostgreSQL pg_atoi() function returns zero [and
no error] for ''). But this would be bad, since no indexes would
improve speed and a lot of useless data would transferred over
the network. 

oki,

Steffen

-- 
Dieses Schreiben wurde maschinell erstellt,
es trägt daher weder Unterschrift noch Siegel.