forked from extern/egroupware
explicitly enable casts between text and bytea for transparent use by schema_proc
This commit is contained in:
parent
6bfdfcac95
commit
a8ddeb719d
@ -218,7 +218,13 @@ class ADODB2_postgres extends ADODB_DataDict {
|
|||||||
$copyflds[] = "to_number($fld->name,'S9999999999999D99')";
|
$copyflds[] = "to_number($fld->name,'S9999999999999D99')";
|
||||||
} elseif (preg_match('/'.$fld->name.' ([\w]+)/i',$tableflds,$matches) &&
|
} elseif (preg_match('/'.$fld->name.' ([\w]+)/i',$tableflds,$matches) &&
|
||||||
strtoupper($fld->type) != ($type = $this->ActualType($matches[1]))) {
|
strtoupper($fld->type) != ($type = $this->ActualType($matches[1]))) {
|
||||||
$copyflds[] = "CAST($fld->name AS $type)";
|
if ($type == 'BYTEA' && $fld->type == 'text') {
|
||||||
|
$copyflds[] = "DECODE($fld->name, 'escape')";
|
||||||
|
} elseif ($fld->type == 'bytea' && $type == 'TEXT') {
|
||||||
|
$copyflds[] = "ENCODE($fld->name, 'escape')";
|
||||||
|
} else {
|
||||||
|
$copyflds[] = "CAST($fld->name AS $type)";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$copyflds[] = $fld->name;
|
$copyflds[] = $fld->name;
|
||||||
}
|
}
|
||||||
@ -360,4 +366,4 @@ CREATE [ UNIQUE ] INDEX index_name ON table
|
|||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user