mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
Hack in display of index values in sqltoarray.php (setup);
This commit is contained in:
parent
5ee6f04fd0
commit
649b7a9fd8
@ -356,12 +356,30 @@
|
||||
$this->uc[] = $sdc->f(2);
|
||||
}
|
||||
}
|
||||
$this->_GetIndices($oProc,$sTableName,$this->pk,$this->ix,$this->uc,$this->fk);
|
||||
|
||||
/* ugly as heck, but is here to chop the trailing comma on the last element (for php3) */
|
||||
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
function _GetIndices($oProc,$sTableName,&$aPk,&$aIx,&$aUc,&$aFk)
|
||||
{
|
||||
$aIx = array();
|
||||
/* This select excludes any indexes that are just base indexes for constraints. */
|
||||
$sql = "SELECT c2.relname, i.indisprimary, i.indisunique, i.indisclustered, pg_catalog.pg_get_indexdef(i.indexrelid) as pg_get_indexdef FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i WHERE c.relname = '$sTableName' AND pg_catalog.pg_table_is_visible(c.oid) AND c.oid = i.indrelid AND i.indexrelid = c2.oid AND NOT EXISTS ( SELECT 1 FROM pg_catalog.pg_depend d JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) WHERE d.classid = c2.tableoid AND d.objid = c2.oid AND d.deptype = 'i' AND c.contype IN ('u', 'p') ) ORDER BY c2.relname";
|
||||
|
||||
$oProc->m_odb->query($sql);
|
||||
while($oProc->m_odb->next_record())
|
||||
{
|
||||
$indexfields = ereg_replace("^CREATE.+\(",'',$oProc->m_odb->f(4));
|
||||
$indexfields = ereg_replace("\)$",'',$indexfields);
|
||||
$aIx = explode(',',$indexfields);
|
||||
}
|
||||
//echo "Indices from $sTableName<pre>pk=".print_r($aPk,True)."\nix=".print_r($aIx,True)."\nuc=".print_r($aUc,True)."</pre>\n";
|
||||
}
|
||||
|
||||
function _CopyAlteredTable($oProc, &$aTables, $sSource, $sDest)
|
||||
{
|
||||
$oDB = $oProc->m_odb;
|
||||
|
Loading…
Reference in New Issue
Block a user