mirror of
https://github.com/silverstripe/silverstripe-postgresql
synced 2024-10-22 15:05:45 +00:00
FIX: Conditional revert of 06f80d33479fef1c78a870674dc62b67c3653730 as the original code is necessary in some configurations.
Now we have the magic of an if block to guide us.
This commit is contained in:
parent
c46e45f599
commit
3fe7671442
@ -1117,9 +1117,26 @@ class PostgreSQLDatabase extends SS_Database {
|
|||||||
"SELECT tgargs FROM pg_catalog.pg_trigger WHERE tgname='%s'", $this->addslashes($triggerName)
|
"SELECT tgargs FROM pg_catalog.pg_trigger WHERE tgname='%s'", $this->addslashes($triggerName)
|
||||||
))->first();
|
))->first();
|
||||||
|
|
||||||
|
// Option 1: output as a string
|
||||||
|
if(strpos($trigger['tgargs'],'\000') !== false) {
|
||||||
$argList = explode('\000', $trigger['tgargs']);
|
$argList = explode('\000', $trigger['tgargs']);
|
||||||
array_pop($argList);
|
array_pop($argList);
|
||||||
|
|
||||||
|
// Option 2: hex-encoded (not sure why this happens, depends on PGSQL config)
|
||||||
|
} else {
|
||||||
|
$bytes = str_split($trigger['tgargs'],2);
|
||||||
|
$argList = array();
|
||||||
|
$nextArg = "";
|
||||||
|
foreach($bytes as $byte) {
|
||||||
|
if($byte == "00") {
|
||||||
|
$argList[] = $nextArg;
|
||||||
|
$nextArg = "";
|
||||||
|
} else {
|
||||||
|
$nextArg .= chr(hexdec($byte));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Drop first two arguments (trigger name and config name) and implode into nice list
|
// Drop first two arguments (trigger name and config name) and implode into nice list
|
||||||
return array_slice($argList, 2);
|
return array_slice($argList, 2);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user