public function dropTable($name)
{
+ global $_PEAR;
+
$res = $this->conn->query("DROP TABLE $name");
- if (PEAR::isError($res)) {
+ if ($_PEAR->isError($res)) {
throw new Exception($res->getMessage());
}
public function createIndex($table, $columnNames, $name=null)
{
+ global $_PEAR;
+
if (!is_array($columnNames)) {
$columnNames = array($columnNames);
}
"ADD INDEX $name (".
implode(",", $columnNames).")");
- if (PEAR::isError($res)) {
+ if ($_PEAR->isError($res)) {
throw new Exception($res->getMessage());
}
public function dropIndex($table, $name)
{
+ global $_PEAR;
+
$res = $this->conn->query("ALTER TABLE $table DROP INDEX $name");
- if (PEAR::isError($res)) {
+ if ($_PEAR->isError($res)) {
throw new Exception($res->getMessage());
}
public function addColumn($table, $columndef)
{
+ global $_PEAR;
+
$sql = "ALTER TABLE $table ADD COLUMN " . $this->_columnSql($columndef);
$res = $this->conn->query($sql);
- if (PEAR::isError($res)) {
+ if ($_PEAR->isError($res)) {
throw new Exception($res->getMessage());
}
public function modifyColumn($table, $columndef)
{
+ global $_PEAR;
+
$sql = "ALTER TABLE $table MODIFY COLUMN " .
$this->_columnSql($columndef);
$res = $this->conn->query($sql);
- if (PEAR::isError($res)) {
+ if ($_PEAR->isError($res)) {
throw new Exception($res->getMessage());
}
public function dropColumn($table, $columnName)
{
+ global $_PEAR;
+
$sql = "ALTER TABLE $table DROP COLUMN $columnName";
$res = $this->conn->query($sql);
- if (PEAR::isError($res)) {
+ if ($_PEAR->isError($res)) {
throw new Exception($res->getMessage());
}
*/
function runSqlSet(array $statements)
{
+ global $_PEAR;
+
$ok = true;
foreach ($statements as $sql) {
if (defined('DEBUG_INSTALLER')) {
}
$res = $this->conn->query($sql);
- if (PEAR::isError($res)) {
+ if ($_PEAR->isError($res)) {
throw new Exception($res->getMessage());
}
}
*/
protected function fetchQueryData($sql)
{
+ global $_PEAR;
+
$res = $this->conn->query($sql);
- if (PEAR::isError($res)) {
+ if ($_PEAR->isError($res)) {
throw new Exception($res->getMessage());
}