Close all open databases -- VDataBase_Open()
Mark Schonewille
m.schonewille at economy-x-talk.com
Mon Oct 14 17:54:02 CDT 2013
Hi William and others,
I've tested it and yes, the valentina_database() function returns a
database ID that is equal to the database ID returned but
vDatabase_open(). This is the handler I use to close all databases:
on closeAllDatabases
put valentina_databasecount() into myDatabaseCount
repeat with myDatabaseNr = 1 to myDatabaseCount
put Valentina_Database(myDatabaseNr) into myDatabaseID
if "ERROR" is not in myDatabaseID then
if "ERROR" is not in vDatabase_Close(myDatabaseID) then
put vDatabase_Destructor(myDatabaseID) into myDatabaseID
else
beep
answer error "Can't close database."
end if
else
beep
answer error "Can't get a reference to the database."
end if
end repeat
end closeAllDatabases
It is quite similar to the bits and pieces that William posted earlier.
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553
Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other
colour spaces. http://www.color-converter.com
Buy my new book "Programming LiveCode for the Real Beginner"
http://qery.us/3fi
Fill out this survey please
http://livecodebeginner.economy-x-talk.com/survey/
On 10/14/2013 20:39, william humphrey wrote:
> you can do
>
> put VDataBase_Name( dbRef ) into MyDatabaseName from the list of
> dbRef's you got by going through each one of the numbers of the database
> in the Valentina_Database() function that returns a dbRef for each number.
>
> I was confused because in the documentation it says: " inIntIndex" and I
> had no idea what that was. Turns out it is just a number that is less
> than the total number of databases open.
>
>
> I'm also confused by:
>
> "Returns the count of databases that was instantinated in your
> application. The result counts
>
> both opened and closed databases. The result counts both local and
> remote databases."
>
> Because in my case it always returns just the number of databases that
> are open. I think it will require more experimentation but so far it
> looks like "instantiated" means open databases.
>
>
More information about the Valentina
mailing list