|
|
sybperl-l Archive
Up Prev Next
From: "Barlow, Ed" <ebarlow at mlp dot com>
Subject: RE: Checking to see if a variable is a DBH
Date: Jan 6 2006 10:53PM
i think you can just see if its a reference... ie... use the ref()
built in function. will return "" if it is not a reference and when i
tested this,
it returned DBI::db for DBI connections to both sybase and SQL server.
Ed
-----Original Message-----
From: owner-sybperl-l@peppler.org
[mailto:owner-sybperl-l@peppler.org] On Behalf Of Wechsler, Steven
Sent: Friday, January 06, 2006 5:00 PM
To: sybperl-l@peppler.org
Subject: Checking to see if a variable is a DBH
Sorry, this is not a sybase-specific question, but DBI...
I'm writing a function that I want to be able to pass either a
Sybase server name or a DBI dbhandle; if the former, it will establish a
connection to the server; if the latter, it will use the extant
connection. Is there a straightforward way to check to see if the value
passed to the function is a DBH or not?
Thanks,
Steve
Steve Wechsler | steven.wechsler@mtvstaff.com
Sybase/SQL Server Database Administrator
212-846-5683
Picture (Metafile)MTV Networks
|