From 93cea133f716887e48b76044da0e40502464c5cc Mon Sep 17 00:00:00 2001 From: seek3r Date: Tue, 2 Jan 2001 08:37:45 +0000 Subject: [PATCH] adding in schema proc for testing on php3 --- setup/inc/functions.inc.php | 2 +- setup/inc/phpgw_schema_proc.inc.php | 2 +- setup/inc/phpgw_schema_proc_array.inc.php | 18 +++++++++--------- setup/inc/phpgw_schema_proc_mysql.inc.php | 20 ++++++++++---------- setup/inc/phpgw_schema_proc_pgsql.inc.php | 20 ++++++++++---------- setup/inc/phpgw_setup.inc.php | 2 +- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php index 266812a955..0e8e6bd0c0 100644 --- a/setup/inc/functions.inc.php +++ b/setup/inc/functions.inc.php @@ -36,6 +36,6 @@ if(file_exists("../header.inc.php")) { include("../header.inc.php"); } include("./inc/phpgw_setup.inc.php"); -// include("./inc/phpgw_schema_proc.inc.php"); + include("./inc/phpgw_schema_proc.inc.php"); $phpgw_setup = new phpgw_setup; ?> \ No newline at end of file diff --git a/setup/inc/phpgw_schema_proc.inc.php b/setup/inc/phpgw_schema_proc.inc.php index cf6cdd54d0..9cdeae2651 100644 --- a/setup/inc/phpgw_schema_proc.inc.php +++ b/setup/inc/phpgw_schema_proc.inc.php @@ -22,7 +22,7 @@ class phpgw_schema_proc include("./inc/phpgw_schema_proc_" . $dbms . ".inc.php"); eval("\$this->m_oTranslator = new phpgw_schema_proc_$dbms;"); global $phpgw_setup; - $this->m_odb = &$phpgw_setup->db; + $this->m_odb = $phpgw_setup->db; $this->m_aTables = array(); } diff --git a/setup/inc/phpgw_schema_proc_array.inc.php b/setup/inc/phpgw_schema_proc_array.inc.php index 912a81a1e7..f8d2a36e58 100644 --- a/setup/inc/phpgw_schema_proc_array.inc.php +++ b/setup/inc/phpgw_schema_proc_array.inc.php @@ -21,7 +21,7 @@ class phpgw_schema_proc_array } // Return a type suitable for DDL abstracted array - function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated) + function TranslateType($sType, $iPrecision = 0, $iScale = 0, $sTranslated) { $sTranslated = $sType; return (strlen($sTranslated) > 0); @@ -42,7 +42,7 @@ class phpgw_schema_proc_array return ""; } - function _GetColumns(&$oProc, $sTableName, &$sColumns, $sDropColumn = "") + function _GetColumns($oProc, $sTableName, $sColumns, $sDropColumn = "") { $sColumns = ""; while (list($sName, $aJunk) = each($oProc->m_aTables[$sTableName]["fd"])) @@ -55,7 +55,7 @@ class phpgw_schema_proc_array return true; } - function DropTable(&$oProc, $sTableName) + function DropTable($oProc, $sTableName) { if (IsSet($oProc->m_aTables[$sTableName])) UnSet($oProc->m_aTables[$sTableName]); @@ -63,7 +63,7 @@ class phpgw_schema_proc_array return true; } - function DropColumn(&$oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true) + function DropColumn($oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true) { if (IsSet($oProc->m_aTables[$sTableName])) { @@ -74,7 +74,7 @@ class phpgw_schema_proc_array return true; } - function RenameTable(&$oProc, $sOldTableName, $sNewTableName) + function RenameTable($oProc, $sOldTableName, $sNewTableName) { $aNewTables = array(); while (list($sTableName, $aTableDef) = each($oProc->m_aTables)) @@ -90,7 +90,7 @@ class phpgw_schema_proc_array return true; } - function RenameColumn(&$oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true) + function RenameColumn($oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true) { if (IsSet($oProc->m_aTables[$sTableName])) { @@ -124,7 +124,7 @@ class phpgw_schema_proc_array return true; } - function AlterColumn(&$oProc, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true) + function AlterColumn($oProc, $sTableName, $sColumnName, $aColumnDef, $bCopyData = true) { if (IsSet($oProc->m_aTables[$sTableName])) { @@ -135,7 +135,7 @@ class phpgw_schema_proc_array return true; } - function AddColumn(&$oProc, $sTableName, $sColumnName, &$aColumnDef) + function AddColumn($oProc, $sTableName, $sColumnName, $aColumnDef) { if (IsSet($oProc->m_aTables[$sTableName])) { @@ -146,7 +146,7 @@ class phpgw_schema_proc_array return true; } - function CreateTable(&$oProc, $sTableName, $aTableDef) + function CreateTable($oProc, $sTableName, $aTableDef) { if (!IsSet($oProc->m_aTables[$sTableName])) $oProc->m_aTables[$sTableName] = $aTableDef; diff --git a/setup/inc/phpgw_schema_proc_mysql.inc.php b/setup/inc/phpgw_schema_proc_mysql.inc.php index a091b0c094..8d29cf1baf 100644 --- a/setup/inc/phpgw_schema_proc_mysql.inc.php +++ b/setup/inc/phpgw_schema_proc_mysql.inc.php @@ -9,7 +9,7 @@ class phpgw_schema_proc_mysql } // Return a type suitable for DDL - function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated) + function TranslateType($sType, $iPrecision = 0, $iScale = 0, $sTranslated) { $sTranslated = ""; switch($sType) @@ -101,7 +101,7 @@ class phpgw_schema_proc_mysql } - function _GetColumns(&$oProc, $sTableName, &$sColumns, $sDropColumn = "") + function _GetColumns($oProc, $sTableName, $sColumns, $sDropColumn = "") { $sColumns = ""; @@ -116,22 +116,22 @@ class phpgw_schema_proc_mysql return false; } - function DropTable(&$oProc, $sTableName) + function DropTable($oProc, $sTableName) { return !!($oProc->m_odb->query("DROP TABLE " . $sTableName)); } - function DropColumn(&$oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true) + function DropColumn($oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true) { return !!($oProc->m_odb->query("ALTER TABLE $sTableName DROP COLUMN $sColumnName")); } - function RenameTable(&$oProc, $sOldTableName, $sNewTableName) + function RenameTable($oProc, $sOldTableName, $sNewTableName) { return !!($oProc->m_odb->query("ALTER TABLE $sOldTableName RENAME TO $sNewTableName")); } - function RenameColumn(&$oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true) + function RenameColumn($oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true) { // This really needs testing - it can affect primary keys, and other table-related objects // like sequences and such @@ -141,7 +141,7 @@ class phpgw_schema_proc_mysql return false; } - function AlterColumn(&$oProc, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true) + function AlterColumn($oProc, $sTableName, $sColumnName, $aColumnDef, $bCopyData = true) { if ($oProc->_GetFieldSQL($oProc->m_aTables[$sTableName]["fd"][$sColumnName], $sNewColumnSQL)) return !!($oProc->m_odb->query("ALTER TABLE $sTableName MODIFY $sColumnName " . $sNewColumnSQL)); @@ -149,7 +149,7 @@ class phpgw_schema_proc_mysql return false; } - function AddColumn(&$oProc, $sTableName, $sColumnName, &$aColumnDef) + function AddColumn($oProc, $sTableName, $sColumnName, $aColumnDef) { $oProc->_GetFieldSQL($aColumnDef, $sFieldSQL); $query = "ALTER TABLE $sTableName ADD COLUMN $sColumnName $sFieldSQL"; @@ -157,13 +157,13 @@ class phpgw_schema_proc_mysql return !!($oProc->m_odb->query($query)); } - function GetSequenceSQL($sTableName, $sFieldName, &$sSequenceSQL) + function GetSequenceSQL($sTableName, $sFieldName, $sSequenceSQL) { $sSequenceSQL = ""; return true; } - function CreateTable(&$oProc, $sTableName, $aTableDef) + function CreateTable($oProc, $sTableName, $aTableDef) { if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL)) { diff --git a/setup/inc/phpgw_schema_proc_pgsql.inc.php b/setup/inc/phpgw_schema_proc_pgsql.inc.php index 30d0f9873c..6694fc0481 100644 --- a/setup/inc/phpgw_schema_proc_pgsql.inc.php +++ b/setup/inc/phpgw_schema_proc_pgsql.inc.php @@ -21,7 +21,7 @@ class phpgw_schema_proc_pgsql } // Return a type suitable for DDL - function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated) + function TranslateType($sType, $iPrecision = 0, $iScale = 0, $sTranslated) { switch($sType) { @@ -96,7 +96,7 @@ class phpgw_schema_proc_pgsql return "UNIQUE($sFields)"; } - function _GetColumns(&$oProc, $sTableName, &$sColumns, $sDropColumn = "") + function _GetColumns($oProc, $sTableName, $sColumns, $sDropColumn = "") { $sColumns = ""; $query = "SELECT a.attname FROM pg_attribute a,pg_class b WHERE "; @@ -116,12 +116,12 @@ class phpgw_schema_proc_pgsql return false; } - function DropTable(&$oProc, $sTableName) + function DropTable($oProc, $sTableName) { return !!($oProc->m_odb->query("DROP TABLE " . $sTableName)); } - function DropColumn(&$oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true) + function DropColumn($oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true) { if ($bCopyData) $oProc->m_odb->query("ALTER TABLE $sTableName RENAME TO $sTableName" . "_tmp"); @@ -139,12 +139,12 @@ class phpgw_schema_proc_pgsql return !!($oProc->m_odb->query($query)); } - function RenameTable(&$oProc, $sOldTableName, $sNewTableName) + function RenameTable($oProc, $sOldTableName, $sNewTableName) { return !!($oProc->m_odb->query("ALTER TABLE $sOldTableName RENAME TO $sNewTableName")); } - function RenameColumn(&$oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true) + function RenameColumn($oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true) { // This really needs testing - it can affect primary keys, and other table-related objects // like sequences and such @@ -163,7 +163,7 @@ class phpgw_schema_proc_pgsql return !!($oProc->m_odb->query($query)); } - function AlterColumn(&$oProc, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true) + function AlterColumn($oProc, $sTableName, $sColumnName, $aColumnDef, $bCopyData = true) { if ($bCopyData) $oProc->m_odb->query("ALTER TABLE $sTableName RENAME TO $sTableName" . "_tmp"); @@ -180,7 +180,7 @@ class phpgw_schema_proc_pgsql return !!($oProc->m_odb->query($query)); } - function AddColumn(&$oProc, $sTableName, $sColumnName, &$aColumnDef) + function AddColumn($oProc, $sTableName, $sColumnName, $aColumnDef) { $oProc->_GetFieldSQL($aColumnDef, $sFieldSQL); $query = "ALTER TABLE $sTableName ADD COLUMN $sColumnName $sFieldSQL"; @@ -188,13 +188,13 @@ class phpgw_schema_proc_pgsql return !!($oProc->m_odb->query($query)); } - function GetSequenceSQL($sTableName, $sFieldName, &$sSequenceSQL) + function GetSequenceSQL($sTableName, $sFieldName, $sSequenceSQL) { $sSequenceSQL = sprintf("CREATE SEQUENCE %s_%s_seq", $sTableName, $sFieldName); return true; } - function CreateTable(&$oProc, $sTableName, $aTableDef) + function CreateTable($oProc, $sTableName, $aTableDef) { if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL)) { diff --git a/setup/inc/phpgw_setup.inc.php b/setup/inc/phpgw_setup.inc.php index 4b833b4f66..887780955a 100644 --- a/setup/inc/phpgw_setup.inc.php +++ b/setup/inc/phpgw_setup.inc.php @@ -182,7 +182,7 @@ $this->db->User = $phpgw_domain[$ConfigDomain]["db_user"]; $this->db->Password = $phpgw_domain[$ConfigDomain]["db_pass"]; - //$phpgw_schema_proc = new phpgw_schema_proc($phpgw_domain[$ConfigDomain]["db_type"]); + $phpgw_schema_proc = new phpgw_schema_proc($phpgw_domain[$ConfigDomain]["db_type"]); } function check_db()