<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">function queryTest</span><div><font face="arial, sans-serif">put </font><span style="font-size:13px;font-family:arial,sans-serif">"</span><u style="font-size:13px;font-family:arial,sans-serif"></u><span style="font-size:13px;font-family:arial,sans-serif">SHOW DATABASES" into tSQL</span><font face="arial, sans-serif"><br>
</font><div><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"> <span style="color:rgb(145,143,0)"><b>put</b></span> VDatabase_SqlSelect( <span style="font-family:arial,sans-serif;font-size:13px">lDatabase</span>, tSQL ) <span style="color:rgb(147,33,146)">into</span> <span style="font-family:arial,sans-serif;font-size:13px">myCursor</span></p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><span style="font-family:arial,sans-serif;font-size:13px">-- try sqlselect instead of sqlquery also</span></p><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">
<span style="font-family:arial,sans-serif;font-size:13px">-- </span><span style="font-family:arial,sans-serif;font-size:13px"> put vDatabase_SqlQuery(lDatabase,"</span><u style="font-family:arial,sans-serif;font-size:13px"></u><span style="font-family:arial,sans-serif;font-size:13px">SHOW DATABASES") into myCursor</span></p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><span style="font-family:arial,sans-serif;font-size:13px">-- although sql query should work</span></p><div><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">
<span style="color:rgb(145,143,0)"><b>put</b></span> VCursor_RecordCount(<span style="font-family:arial,sans-serif;font-size:13px">myCursor</span>) <span style="color:rgb(147,33,146)">into</span> recNum</p><span style="font-family:arial,sans-serif;font-size:13px"> put VCursor_GetRecords(myCursor,1,recNum,</span><u style="font-family:arial,sans-serif;font-size:13px"></u><span style="font-family:arial,sans-serif;font-size:13px">tab,cr) into myData</span></div>
<div><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><span style="color:rgb(145,143,0)"><b>put</b></span> VCursor_Destructor(<span style="font-family:arial,sans-serif;font-size:13px">myCursor</span>) <span style="color:rgb(147,33,146)">into</span> <span style="font-family:arial,sans-serif;font-size:13px">myCursor</span></p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><span style="font-family:arial,sans-serif;font-size:13px">-- can't leave un-destructed cursors laying around</span></p><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">
<span style="font-family:arial,sans-serif;font-size:13px">-- good practice or when database does fancy restore after crash</span></p><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><span style="font-family:arial,sans-serif;font-size:13px">-- all the data which has open cursor is lost</span></p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><span style="font-family:arial,sans-serif;font-size:13px">-- this is not clear in any documentation because journaling that does fancy stuff</span></p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><span style="font-family:arial,sans-serif;font-size:13px">-- was added later</span></p><span style="font-family:arial,sans-serif;font-size:13px"> return myData</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">end queryTest</span><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Oct 13, 2013 at 9:18 PM, Mark Schonewille <span dir="ltr"><<a href="mailto:m.schonewille@economy-x-talk.com" target="_blank">m.schonewille@economy-x-talk.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ruslan or anyone else who knows this,<br>
<br>
Unfortunately, this script<br>
<br>
function queryTest<br>
put vDatabase_SqlQuery(lDatabase,"<u></u>SHOW DATABASES") into myCursor<br>
put VCursor_GetRecords(myCursor,,,<u></u>tab,cr) into myData<br>
return myData<br>
end queryTest<br>
<br>
returns an empty value. An integer is stored in myCursor, but myData is empty. If I run the samein Valentina Studio, I get a small table with all databases. What am I doing wrong?<div class="im HOEnZb"><br>
<br>
--<br>
Best regards,<br>
<br>
Mark Schonewille<br>
<br>
Economy-x-Talk Consulting and Software Engineering<br>
Homepage: <a href="http://economy-x-talk.com" target="_blank">http://economy-x-talk.com</a><br>
Twitter: <a href="http://twitter.com/xtalkprogrammer" target="_blank">http://twitter.com/<u></u>xtalkprogrammer</a><br>
KvK: 50277553<br>
<br>
Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour spaces. <a href="http://www.color-converter.com" target="_blank">http://www.color-converter.com</a><br>
<br>
Buy my new book "Programming LiveCode for the Real Beginner" <a href="http://qery.us/3fi" target="_blank">http://qery.us/3fi</a><br>
<br>
Fill out this survey please<br>
<a href="http://livecodebeginner.economy-x-talk.com/survey/" target="_blank">http://livecodebeginner.<u></u>economy-x-talk.com/survey/</a><br>
<br>
On 10/13/2013 23:15, Ruslan Zasukhin wrote:<br>
</div><div class="im HOEnZb"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 10/13/13 8:18 PM, "Mark Schonewille" <<a href="mailto:m.schonewille@economy-x-talk.com" target="_blank">m.schonewille@economy-x-talk.<u></u>com</a>><br>
wrote:<br>
<br>
Hi Mark,<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks. How do I execute SQL and get the data directly, just like the<br>
revDataFromQuery() function in LiveCode?<br>
</blockquote>
<br>
Hi Mark,<br>
<br>
Directly into string?<br>
<br>
Oops, it seems PDF misses 2 functions of this kind<br>
We will add it tomorrow.<br>
<br>
<br>
<br>
Class VCursor<br>
<br>
<br>
put VCursor_GetRecord(<br>
cursorRef, [RecIndex], [fldDelimiter] )<br>
into VAR<br>
<br>
<br>
<br>
put VCursor_GetRecords(<br>
cursorRef, [FromRec], [MaxRecords], [fldDelimiter], [recDelimiter] )<br>
into VAR<br>
<br>
<br>
<br>
<br>
<br>
</blockquote></div><div class="HOEnZb"><div class="h5">
______________________________<u></u>_________________<br>
Valentina mailing list<br>
<a href="mailto:Valentina@lists.macserve.net" target="_blank">Valentina@lists.macserve.net</a><br>
<a href="http://lists.macserve.net/mailman/listinfo/valentina" target="_blank">http://lists.macserve.net/<u></u>mailman/listinfo/valentina</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><a href="http://www.bluewatermaritime.com">http://www.bluewatermaritime.com</a>
</div>