Close all databases - Where is DB ID
Ruslan Zasukhin
ruslan_zasukhin at valentina-db.com
Tue Oct 15 01:14:17 CDT 2013
On 10/14/13 5:21 PM, "Mark Schonewille" <m.schonewille at economy-x-talk.com>
wrote:
Hi Mark,
I am starting a new thread ...
So you have got working SHOW DATABASES, okay.
Mainly this is used to get list of opened dbs and their NAMES.
> Unfortunately, the query doesn't return a list of ID numbers for all
> open databases,
It seems to me, we need at first discuss what exactly you want to do and
why ...
Please note, that you have opened db how?
put VDatabase_Open( pathOrName ) to dbRef
Right?
Or May be you did create db first time
put VDatabase_Create( pathOrName ) to dbRef
Mark, so your app already have dbRef.
This is DIRECT reference to opened database.
Right?
To close it you need just
VDatabase_Close( dbRef )
Tell me please, where is problem on this simple way?
2) if your app going to have FEW opened dbs, then lets consider how you open
them and how you manage them.
Usually applications opens a window for each DB. So
Window1 --> mDbRef
Window2 --> mDbRef
Window3 --> mDbRef
Each windows knows dbRef of its own db.
Where problem to close db when a window is closed?
App on QUITE, close each window,
and close event of a window closes its own db.
3) Even if your app have such design that you do not want keep dbs under
windows, you still can make (at least easy in OTHER languages) some global
array of dbRefs
And later, you can have something with this logic.
WARNING: this is not true livecode syntax.
----------------------------------
on CloseAllDbs
for each dbRef in arrMyOpenDatabases
VDatabase_Close( db )
remove item from array
end
end
----------------------------------
Three simple ways, without any SHOW DATABASES.
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list