adding in schema proc for testing on php3

This commit is contained in:
seek3r 2001-01-02 08:37:45 +00:00
parent c2874a17ea
commit 93cea133f7
6 changed files with 32 additions and 32 deletions

View File

@ -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;
?>

View File

@ -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();
}

View File

@ -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;

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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()