diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2011-06-25 19:54:07 +0400 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2011-06-25 19:54:07 +0400 |
commit | da6fe46a4d34c650e3d7f0b70d04ea22730f8e19 (patch) | |
tree | 4a1d3e03a4975a14bbf07a53c4eb3bd771f55c17 /tbl_replace.php | |
parent | d257d46dee97fb57173642fafe26a9f8b7f5b10c (diff) |
GISFromWKB functions in data insert/edit window fixed.
Diffstat (limited to 'tbl_replace.php')
-rw-r--r-- | tbl_replace.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tbl_replace.php b/tbl_replace.php index 6dd46bb283..fad6b07429 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -182,6 +182,17 @@ $gis_from_text_functions = array( 'MPolyFromText', ); +$gis_from_wkb_functions = array( + 'GeomFromWKB', + 'GeomCollFromWKB', + 'LineFromWKB', + 'MLineFromWKB', + 'PointFromWKB', + 'MPointFromWKB', + 'PolyFromWKB', + 'MPolyFromWKB', +); + foreach ($loop_array as $rownumber => $where_clause) { // skip fields to be ignored if (! $using_key && isset($_REQUEST['insert_ignore_' . $where_clause])) { @@ -271,10 +282,14 @@ foreach ($loop_array as $rownumber => $where_clause) { $cur_value = "'" . $uuid . "'"; } elseif (in_array($me_funcs[$key], $func_no_param)) { $cur_value = $me_funcs[$key] . '()'; - } elseif (in_array($me_funcs[$key], $gis_from_text_functions) && substr($val, 0, 3) == "'''") { - // Converting $val of the form '''POINT(12 15)'',145' to 'POINT(12 15)',145 - $val = str_replace("''", "'", $val); + } elseif ((in_array($me_funcs[$key], $gis_from_text_functions) + && substr($val, 0, 3) == "'''") + || in_array($me_funcs[$key], $gis_from_wkb_functions) + ) { + // Remove enclosing apostrophes $val = substr($val, 1, strlen($val) - 2); + // Remove escaping apostrophes + $val = str_replace("''", "'", $val); $cur_value = $me_funcs[$key] . '(' . $val . ')'; } else { $cur_value = $me_funcs[$key] . '(' . $val . ')'; |