<div dir="ltr">You're right. To close a database you use something like this:<div><br></div><div><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><b>function</b> DBClose isDestructing</p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">   <span style="color:rgb(145,143,0)"><b>get</b></span> VDatabase_Close( <span style="font-family:arial,sans-serif;font-size:13px">lDatabase</span> )</p>

<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">   <b>if</b> isDestructing = <span style="color:rgb(147,33,146)">true</span> <b>then</b></p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">      <span style="color:rgb(145,143,0)"><b>put</b></span> VDatabase_Destructor( <span style="font-family:arial,sans-serif;font-size:13px">lDatabase</span> ) <span style="color:rgb(147,33,146)">into</span> <span style="font-family:arial,sans-serif;font-size:13px">lDatabase</span></p>

<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">   <b>end</b> <b>if</b></p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">   <span style="color:rgb(145,143,0)"><b>put</b></span> <span style="color:rgb(1,24,146)">"Database Closed"</span> <span style="color:rgb(147,33,146)">into</span> <span style="color:rgb(147,33,146)">field</span> error_field</p>

<p style="margin:0px;font-size:11px;font-family:'Lucida Grande';color:rgb(0,142,0)"><span style="color:rgb(0,0,0)">  </span></p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><b>end</b> DBClose</p><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><br></p><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">
So what we need after calling the SQL to get list of the names of open databases is a function that looks up the ID of an open database based on the name. I usually have two databases open in my projects but I have them open in different stacks and I store the ID in a global variable and thus am able to close it -- usually right before I close each one of the stacks.</p>
<p style="margin:0px;font-size:11px;font-family:'Lucida Grande'"><br></p><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">There is a function </p><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">
<br></p><p style="margin:0px;font-size:11px;font-family:'Lucida Grande'">
                
        
        
                </p><div class="" title="Page 13">
                        <div class="">
                                <div class="">
                                        <p><span style="font-size:11pt;font-family:ArialMT">get Valentina_Database( inIntIndex ) into dbRef</span></p><p><span style="font-size:11pt;font-family:ArialMT"><br></span></p><p>
                
        
        
                </p><div class="" title="Page 13">
                        <div class="">
                                <div class="">
                                        <p><span style="font-size:11pt;font-family:ArialMT">Returns a database from the array of databases by an index. </span></p><p><span style="font-size:11pt;font-family:ArialMT"><br></span></p><p style><span style="font-size:11pt;font-family:ArialMT">I'm not sure if this function will help as I've never figured out how to use it. I have used:</span></p>
<p style>
                
        
        
                </p><div class="" title="Page 13">
                        <div class="">
                                <div class="">
                                        <p><span style="font-size:11pt;font-family:ArialMT">Valentina_DatabaseCount() (r/o)
</span></p>
                                        <p><span style="font-size:11pt;font-family:Arial;font-weight:700">Returns: </span><span style="font-size:11pt;font-family:ArialMT">integer<br>
Returns the count of databases that was instantinated in your application. The result counts
</span></p>
                                        <p><span style="font-size:11pt;font-family:ArialMT">both opened and closed databases. The result counts both local and remote databases.
</span></p>
                                        <p><span style="font-size:11pt;font-family:Arial;font-weight:700">Example:
</span></p>
                                        <p><span style="font-size:11pt;font-family:ArialMT">get Valentina_DatabaseCount </span></p>
                                </div>
                        </div>
                </div><p></p><p style><span style="font-size:11pt;font-family:ArialMT"> </span></p>
                                </div>
                        </div>
                </div><p></p><p><span style="font-size:11pt;font-family:ArialMT"> </span></p>
                                </div>
                        </div>
                </div><p></p></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 14, 2013 at 10:04 AM, 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 everyone,<br>
<br>
Now that I know how to execute the SHOW DATABASES query, using the script<br>
<br>
function queryTest<br>
   put VDatabase_SqlSelect(lDatabase,<u></u>"SHOW DATABASES") into myCursor<br>
   // put vDatabase_SqlQuery(lDatabase,"<u></u>SHOW DATABASES") into myCursor<br>
   put VCursor_RecordCount(myCursor) into myRecordCount<br>
   put VCursor_GetRecords(myCursor,1,<u></u>myRecordCount,tab,cr) into myData<br>
   put VCursor_Destructor(myCursor) into myCursor<br>
   return myData<br>
end queryTest<br>
<br>
which we discussed before, (i.e. without the syntax causing the crash), it occurs to me that contrary what Ruslan argues no database ID's or cursors are returned. So, the question remains:<br>
<br>
how do I get a list of all open databases, for use in a repeat loop that closes all databases, like so:<br>
<br>
put valentina_openDatabases() into myOpenDatabases<br>
repeat for each item myDatabase in myOpenDatabases<br>
  get vDatabase_Close(myDatabase)<br>
end repeat<br>
<br>
(Keep in mind that I made up this syntax, there is no valentina_openDatabases() function).<div class="im HOEnZb"><br>
<br>
<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></div><div class="im HOEnZb">
On 10/13/2013 17:48, 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 5:34 PM, "william humphrey" <<a href="mailto:bill@bluewatermaritime.com" target="_blank">bill@bluewatermaritime.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I looked through that PDF and did not find any command which lists the names<br>
of the open databases.<br>
</blockquote>
<br>
This can be done via SQL<br>
<br>
     SHOW DATABASES<br>
<br>
You get cursor, iterate it, get names<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>