mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
adding in schema proc
This commit is contained in:
parent
923f731f0f
commit
9ae9d07801
@ -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;
|
||||
?>
|
157
setup/inc/phpgw_schema_proc_array.inc.php
Normal file
157
setup/inc/phpgw_schema_proc_array.inc.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - Setup *
|
||||
* http://www.phpgroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class phpgw_schema_proc_array
|
||||
{
|
||||
var $m_sStatementTerminator;
|
||||
|
||||
function phpgw_schema_proc_array()
|
||||
{
|
||||
$this->m_sStatementTerminator = ";";
|
||||
}
|
||||
|
||||
// Return a type suitable for DDL abstracted array
|
||||
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
||||
{
|
||||
$sTranslated = $sType;
|
||||
return (strlen($sTranslated) > 0);
|
||||
}
|
||||
|
||||
function TranslateDefault($sDefault)
|
||||
{
|
||||
return $sDefault;
|
||||
}
|
||||
|
||||
function GetPKSQL($sFields)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
function GetUCSQL($sFields)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
function _GetColumns(&$oProc, $sTableName, &$sColumns, $sDropColumn = "")
|
||||
{
|
||||
$sColumns = "";
|
||||
while (list($sName, $aJunk) = each($oProc->m_aTables[$sTableName]["fd"]))
|
||||
{
|
||||
if ($sColumns != "")
|
||||
$sColumns .= ",";
|
||||
$sColumns .= $sName;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function DropTable(&$oProc, $sTableName)
|
||||
{
|
||||
if (IsSet($oProc->m_aTables[$sTableName]))
|
||||
UnSet($oProc->m_aTables[$sTableName]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function DropColumn(&$oProc, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
|
||||
{
|
||||
if (IsSet($oProc->m_aTables[$sTableName]))
|
||||
{
|
||||
if (IsSet($oProc->m_aTables[$sTableName]["fd"][$sColumnName]))
|
||||
UnSet($oProc->m_aTables[$sTableName]["fd"][$sColumnName]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function RenameTable(&$oProc, $sOldTableName, $sNewTableName)
|
||||
{
|
||||
$aNewTables = array();
|
||||
while (list($sTableName, $aTableDef) = each($oProc->m_aTables))
|
||||
{
|
||||
if ($sTableName == $sOldTableName)
|
||||
$aNewTables[$sNewTableName] = $aTableDef;
|
||||
else
|
||||
$aNewTables[$sTableName] = $aTableDef;
|
||||
}
|
||||
|
||||
$oProc->m_aTables = $aNewTables;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function RenameColumn(&$oProc, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
|
||||
{
|
||||
if (IsSet($oProc->m_aTables[$sTableName]))
|
||||
{
|
||||
$aNewTableDef = array();
|
||||
reset($oProc->m_aTables[$sTableName]["fd"]);
|
||||
while (list($sColumnName, $aColumnDef) = each($oProc->m_aTables[$sTableName]["fd"]))
|
||||
{
|
||||
if ($sColumnName == $sOldColumnName)
|
||||
$aNewTableDef[$sNewColumnName] = $aColumnDef;
|
||||
else
|
||||
$aNewTableDef[$sColumnName] = $aColumnDef;
|
||||
}
|
||||
|
||||
$oProc->m_aTables[$sTableName]["fd"] = $aNewTableDef;
|
||||
|
||||
reset($oProc->m_aTables[$sTableName]["pk"]);
|
||||
while (list($key, $sColumnName) = each($oProc->m_aTables[$sTableName]["pk"]))
|
||||
{
|
||||
if ($sColumnName == $sOldColumnName)
|
||||
$oProc->m_aTables[$sTableName]["pk"][$key] = $sNewColumnName;
|
||||
}
|
||||
|
||||
reset($oProc->m_aTables[$sTableName]["uc"]);
|
||||
while (list($key, $sColumnName) = each($oProc->m_aTables[$sTableName]["uc"]))
|
||||
{
|
||||
if ($sColumnName == $sOldColumnName)
|
||||
$oProc->m_aTables[$sTableName]["uc"][$key] = $sNewColumnName;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function AlterColumn(&$oProc, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
|
||||
{
|
||||
if (IsSet($oProc->m_aTables[$sTableName]))
|
||||
{
|
||||
if (IsSet($oProc->m_aTables[$sTableName]["fd"][$sColumnName]))
|
||||
$oProc->m_aTables[$sTableName]["fd"][$sColumnName] = $aColumnDef;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function AddColumn(&$oProc, $sTableName, $sColumnName, &$aColumnDef)
|
||||
{
|
||||
if (IsSet($oProc->m_aTables[$sTableName]))
|
||||
{
|
||||
if (!IsSet($oProc->m_aTables[$sTableName]["fd"][$sColumnName]))
|
||||
$oProc->m_aTables[$sTableName]["fd"][$sColumnName] = $aColumnDef;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function CreateTable(&$oProc, $sTableName, $aTableDef)
|
||||
{
|
||||
if (!IsSet($oProc->m_aTables[$sTableName]))
|
||||
$oProc->m_aTables[$sTableName] = $aTableDef;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user