| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Contains the function for dropping tables
|
|
|
5 |
*
|
|
|
6 |
* PHP versions 4 and 5
|
|
|
7 |
*
|
|
|
8 |
* LICENSE: This source file is subject to version 3.0 of the PHP license
|
|
|
9 |
* that is available through the world-wide-web at the following URI:
|
|
|
10 |
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
|
|
|
11 |
* the PHP License and are unable to obtain it through the web, please
|
|
|
12 |
* send a note to license@php.net so we can mail you a copy immediately.
|
|
|
13 |
*
|
|
|
14 |
* @category Database
|
|
|
15 |
* @package DB
|
|
|
16 |
* @author Daniel Convissor <danielc@php.net>
|
|
|
17 |
* @copyright 1997-2007 The PHP Group
|
|
|
18 |
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
|
|
19 |
* @version $Id: droptable.inc 239211 2007-07-06 05:19:21Z aharvey $
|
|
|
20 |
* @link http://pear.php.net/package/DB
|
|
|
21 |
*/
|
|
|
22 |
|
|
|
23 |
/**
|
|
|
24 |
* Drops the requested table
|
|
|
25 |
*
|
|
|
26 |
* @param object $dbh the PEAR DB object currently in use
|
|
|
27 |
* @param string $table the name of the table to be dropped
|
|
|
28 |
*
|
|
|
29 |
* @return int DB_OK on success. DB_Error object on failure.
|
|
|
30 |
*/
|
|
|
31 |
function drop_table($dbh, $table) {
|
|
|
32 |
switch ($dbh->phptype) {
|
|
|
33 |
case 'fbsql':
|
|
|
34 |
$res = $dbh->query("DROP TABLE $table CASCADE");
|
|
|
35 |
break;
|
|
|
36 |
default:
|
|
|
37 |
$res = $dbh->query("DROP TABLE $table");
|
|
|
38 |
}
|
|
|
39 |
return $res;
|
|
|
40 |
}
|