471,854 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,854 software developers and data experts.

DBI: Is there an "unbind" method?

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;");
Feb 26 '09 #1
1 2664
4,059 Expert 2GB
The place to look is in the DBI modules documentation. Personally I don't know if there is or isn't.
Feb 26 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

24 posts views Thread by Hung Jung Lu | last post: by
1 post views Thread by Phil Schmidt | last post: by
2 posts views Thread by Randy Harris | last post: by
3 posts views Thread by jayderk | last post: by
2 posts views Thread by KC | last post: by
29 posts views Thread by Gerald | last post: by
reply views Thread by NeoPa | last post: by
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.