How to determine if Db is connected/open?

Hello all,

Without re-opening, how can I determine if a database connection is open or not? I am using both PostgreSQL and SQLite.
Thank you,
Tim

Dim rst As RecordSet = Db.SQLSelect("SELECT 1") If rst Is Nil Then // Not connected Else // Connected End

Hello Eli and thank you for you reply.

So a query is necessary to do this… I was hoping for a property.

Tim

You would have to maintain your own property. But the query will be very fast.

[quote=111974:@Tim Seyfarth]Hello Eli and thank you for you reply.

So a query is necessary to do this… I was hoping for a property.

Tim[/quote]

the property has to be updated by something for the status. the dbase plugins dont do it. so you would have to.

Actually, I believe the cubeSQL plugin does. It provides db.isConnected As Boolean, though it may very well be a function that does the suggested query (or something similar) behind the scenes.

I stand corrected… cubeSQL does, and every one that Xojo ships doesnt

anything connected over tcp it’d be a “best guess” unless there’d been some activity OR it pinged the server