Skip to content

Commit

Permalink
FIX: Fix the apparently obsolete code for extracting search index col…
Browse files Browse the repository at this point in the history
…umns from the trigger meta-data.
  • Loading branch information
Sam Minnee committed Sep 18, 2012
1 parent 54821bd commit 06f80d3
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions code/PostgreSQLDatabase.php
Expand Up @@ -1117,23 +1117,11 @@ protected function extractTriggerColumns($triggerName)
"SELECT tgargs FROM pg_catalog.pg_trigger WHERE tgname='%s'", $this->addslashes($triggerName)
))->first();

// Trigger columns will be extracted in an ugly hex format with null-
// terminated strings, needs some coaxing into a readable format
$tgargsHex = $trigger['tgargs'];
$tgargs = array();
$tgarg = '';
for ($i = 0; $i < strlen($tgargsHex); $i+=2) {
$hexChar = substr($tgargsHex, $i, 2);
if($hexChar == '00') {
$tgargs[] = $tgarg;
$tgarg = '';
} else {
$tgarg .= chr(hexdec($hexChar));
}
}
$argList = explode('\000', $trigger['tgargs']);
array_pop($argList);

// Drop first two arguments (trigger name and config name) and implode into nice list
return array_slice($tgargs, 2);
return array_slice($argList, 2);
}

/**
Expand Down

0 comments on commit 06f80d3

Please sign in to comment.