[JDEV] Complex DTD=2 SQL
Bernino Lind
lind at hlgroup.dk
Wed Jun 25 09:28:40 CDT 2003
Dear all,
I need a bit of adwise.
I have a working simple dtd="2" sql set/get pair with my own namespace.
I need to make these more sql queries more complex by adding more
variables in my select statements.
I can do this no problem with my update/insert with bindvar tag=... but
with select I hit problems, which I cant resolve...:
My select in xdb_sql.xml / queredef:
<querydef name="score-get" dtd="2" type="get" namespace="lind:score">
<text>SELECT * FROM score WHERE gameid = '$$gameid$$' AND username
= '$$user$$'</text>
<user>$$user$$</user>
<bindvar tag="gameid">$$gameid$$</bindvar>
<top-result>
<x xmlns='lind:score'/>
</top-result>
<tuple-node><item/></tuple-node>
<bindcol tag="sid" offset="0"/>
<bindcol tag="username" offset="1"/>
<bindcol tag="gameid" offset="2"/>
<bindcol tag="score" offset="3"/>
<bindcol tag="date" offset="4"/>
</querydef>
</queries>
What happens when I fire off my xml is that the type="set" works just
fine, but firing off a gives a warning:
WARNING: pg_atoi: zero-length string
Which I guess means that gameid is null, even though my iq packet is good:
<iq type="get">
<query xmlns='lind:score'>
<gameid>123</gameid>
</query>
</iq>
And theres something in it:
jdb=# SELECT * FROM score WHERE gameid = '123' AND username =
'psi at 192.168.0.166';
sid | username | gameid | score | date
-----+-------------------+--------+--------+----------------------------
10 | psi at 192.168.0.166 | 123 | 234234 | 2003-06-17 15:42:41.611469
12 | psi at 192.168.0.166 | 123 | 234234 | 2003-06-17 16:12:12.182216
13 | psi at 192.168.0.166 | 123 | 234234 | 2003-06-25 15:31:02.446713
14 | psi at 192.168.0.166 | 123 | 234234 | 2003-06-25 15:31:11.871944
15 | psi at 192.168.0.166 | 123 | 234234 | 2003-06-25 16:02:51.309132
(5 rows)
When I change the querydef to have just say username - no problem, it
selects and outputs the way I want it...
Help,
Best Regards Bernino Lind
More information about the JDev
mailing list