DB IO Bug Fix for parameter detect after <>, DateTime code fix
Query Parameters where not detected after a <> unequal check DateTime fix for last element, use array_pop instead of $array[count - 1]
This commit is contained in:
@@ -115,6 +115,8 @@ echo "INSERT ALL COLUMN TYPES: "
|
|||||||
. "ERROR: " . $db->dbGetLastError(true) . "<br>";
|
. "ERROR: " . $db->dbGetLastError(true) . "<br>";
|
||||||
echo "<hr>";
|
echo "<hr>";
|
||||||
|
|
||||||
|
// test connectors: = , <> () for query detection
|
||||||
|
|
||||||
// convert placeholder tests
|
// convert placeholder tests
|
||||||
// ? -> $n
|
// ? -> $n
|
||||||
// :name -> $n
|
// :name -> $n
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ class DateTime
|
|||||||
} else {
|
} else {
|
||||||
$str = implode(', ', array_slice($formatted, 0, -1));
|
$str = implode(', ', array_slice($formatted, 0, -1));
|
||||||
if (!empty($formatted[count($formatted) - 1])) {
|
if (!empty($formatted[count($formatted) - 1])) {
|
||||||
$str .= ' and ' . $formatted[count($formatted) - 1];
|
$str .= ' and ' . (string)array_pop($formatted);
|
||||||
}
|
}
|
||||||
return $negative . $str;
|
return $negative . $str;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1318,14 +1318,14 @@ class IO
|
|||||||
// regex for params: only stand alone $number allowed
|
// regex for params: only stand alone $number allowed
|
||||||
// exclude all '' enclosed strings, ignore all numbers [note must start with digit]
|
// exclude all '' enclosed strings, ignore all numbers [note must start with digit]
|
||||||
// can have space/tab/new line
|
// can have space/tab/new line
|
||||||
// must have = , ( [equal, comma, opening round bracket]
|
// must have <> = , ( [not equal, equal, comma, opening round bracket]
|
||||||
// can have space/tab/new line
|
// can have space/tab/new line
|
||||||
// $ number with 1-9 for first and 0-9 for further digits
|
// $ number with 1-9 for first and 0-9 for further digits
|
||||||
// /s for matching new line in . list
|
// /s for matching new line in . list
|
||||||
// [disabled, we don't used ^ or $] /m for multi line match
|
// [disabled, we don't used ^ or $] /m for multi line match
|
||||||
// Matches in 1:, must be array_filtered to remove empty, count with array_unique
|
// Matches in 1:, must be array_filtered to remove empty, count with array_unique
|
||||||
preg_match_all(
|
preg_match_all(
|
||||||
'/(?:\'.*?\')?\s*(?:\?\?|[(=,])\s*(?:\d+|(?:\'.*?\')|(\$[1-9]{1}(?:[0-9]{1,})?))/s',
|
'/(?:\'.*?\')?\s*(?:\?\?|<>|[(=,])\s*(?:\d+|(?:\'.*?\')|(\$[1-9]{1}(?:[0-9]{1,})?))/s',
|
||||||
$query,
|
$query,
|
||||||
$match
|
$match
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user