Connecting Tech Pros Worldwide Help | Site Map

DBI: Is there an "unbind" method?

BeemerBiker's Avatar
Member
 
Join Date: Jul 2008
Location: San Antonio, Texas
Posts: 68
#1: Feb 26 '09
I added a temporary column to a database and want to delete it after I am finished with it. However, I cannot remove the column while it is still bound to a variable.

I tried $sth->finish() but that didnt do anything
$dbh->disconnect() works but I have to reconnect before I can remove the column. Google seems to indicate there is no unbind. The following code snippet works. Note: TestSource("NEW") does a connect to the "new" database and assignes $dbh.

Expand|Select|Wrap|Line Numbers
  1.    TestSource("NEW");
  2.    $sth = training::RunSql($dbh, "SELECT [Employee ID],TempDept, TempPrivilege FROM EmployeeInfo;");
  3.    $sth->bind_columns(\$eid, \$dept, \$priv);
  4.    while($sth->fetch())
  5.    {
  6.     ...blah blah blah...
  7.    }
  8.    $dbh->disconnect();
  9.    TestSource("NEW");
  10.    training::RunSql($dbh,"ALTER TABLE EmployeeInfo DROP COLUMN TempDept;");
  11.    training::RunSql($dbh,"ALTER TABLE EmployeeInfo DROP COLUMN TempPrivilege;");
  12.  
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#2: Feb 26 '09

re: DBI: Is there an "unbind" method?


The place to look is in the DBI modules documentation. Personally I don't know if there is or isn't.
Reply