I' really doing something wrong :) This is what I tried:<br><br>======================================================<br>| connection spec statement resultSet value OWm2command|<br>Socket initializeNetwork.<br>Transcript open.<br>
spec := (JdmConnectionSpec new initialize<br> user: 'root'; password: 'owm2';<br> host: (NetNameResolver addressForName: 'localhost');<br> database: 'owm2';<br> port: 3306).<br>
<br>OWm2command := 'OWM2_PARSE(',$' asString,'<?xml version="1.0" encoding="UTF-8" ?><OWM2><Query command="list" type="class" id="12" ><Output /></Query></OWM2>',$' asString,')'.<br>
<br>connection := JdmConnection on: spec.<br>statement := connection createStatement.<br>resultSet := statement executeQuery: OWm2command.<br>"print column names"<br>Transcript cr; show: (resultSet columns collect: [:col | col name]) asString.<br>
<br>[resultSet next]<br>whileTrue:<br>[<br> value := resultSet valueNamed: 'id_object'. "get column named name"<br> Transcript cr; show: value printString.<br>].<br>connection close.<br>============================<br>
<br>Obviously it could not go to the end, but I was expecting to be able to inspect the resultSet and find out how to call the "column" from there. Actually this function returns simply an XML string. Yet the point where I'm breaking is the query execution itself. It *might* be because the concation I tried looks weird. What I see inspecting the values is:<br>
'OWM2_PARSE(''<?xml version="1.0" encoding="UTF-8" ?><OWM2><Query command="list" type="class" id="12" ><Output /></Query></OWM2>'')'<br>
<br>Now... this will surely break because it was meant to have " only for the internal XML parameters...so this way the string cannot be passed. I'm sure there's a way, only I cannot find it.<br>Bčrto<br><br>
<br><br><br><div class="gmail_quote">2008/6/20 Bčrto ëd Sčra <<a href="mailto:berto.d.sera@gmail.com">berto.d.sera@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
All seems to work fine, I have but one problem: how do you state a "string in a string"? The query I need to execute inputs an XML command to a stored proc, so it looks like<br>resultSet := statement executeQuery: 'OWM2_PARSE('<?xml version="1.0" encoding="UTF-8" ?><OWM2><Query command="list" type="class" id="12" ><Output /></Query></OWM2>')'.<br>
<br>Can't remember what's the equivalent of <br>resultSet := statement executeQuery: 'OWM2_PARSE(/'<?xml
version="1.0" encoding="UTF-8" ?><OWM2><Query
command="list" type="class" id="12" ><Output
/></Query></OWM2>/')'.<br>in smalltalk... <br><br>Very stupid question, I know :(<br>Bčrto<br><br><div class="gmail_quote">2008/6/16 Keith Hodges <<a href="mailto:keith_hodges@yahoo.co.uk" target="_blank">keith_hodges@yahoo.co.uk</a>>:<div>
<div></div><div class="Wj3C7c"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>Bčrto ëd Sčra wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
A connection for statement is not a problem, since I can pack any number of queries into a single XML statement it's not going to impact on performance ;) I'll try this later this week and let you know if it works.<br>
Thanks<br>
Berto<br>
<br>
</blockquote></div>
Try <a href="http://www.squeaksource.com/MySql" target="_blank">http://www.squeaksource.com/MySql</a> for more recent version of the driver. You don't actually need a new connection for each query, but that is the way that I use it myself.<br>
<br>
There is also some code for using the driver in <a href="http://mc.lukas-renggli.ch/magritteaddons" target="_blank">http://mc.lukas-renggli.ch/magritteaddons</a> package Magritte-RDB<br><font color="#888888">
<br>
Keith<br>
<br>
<br>
<br>
<br>
</font></blockquote></div></div></div><br>
</blockquote></div><br>