Rev 1370 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1370 | Rev 1389 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | * @throws OIDplusConfigInitializationException |
41 | * @throws OIDplusConfigInitializationException |
42 | * @throws OIDplusException |
42 | * @throws OIDplusException |
43 | * @throws OIDplusSQLException |
43 | * @throws OIDplusSQLException |
44 | */ |
44 | */ |
45 | protected function doQueryPrepareEmulation(string $sql, array $prepared_args=null): OIDplusQueryResultADO { |
45 | protected function doQueryPrepareEmulation(string $sql, array $prepared_args=null): OIDplusQueryResultADO { |
- | 46 | $dummy = find_nonexisting_substr($sql); |
|
46 | $sql = str_replace('?', chr(1), $sql); |
47 | $sql = str_replace('?', $dummy, $sql); |
47 | foreach ($prepared_args as $arg) { |
48 | foreach ($prepared_args as $arg) { |
48 | $needle = chr(1); |
49 | $needle = $dummy; |
49 | if (is_bool($arg)) { |
50 | if (is_bool($arg)) { |
50 | if ($this->slangDetectionDone) { |
51 | if ($this->slangDetectionDone) { |
51 | $replace = $this->getSlang()->getSQLBool($arg); |
52 | $replace = $this->getSlang()->getSQLBool($arg); |
52 | } else { |
53 | } else { |
53 | $replace = $arg ? '1' : '0'; |
54 | $replace = $arg ? '1' : '0'; |
Line 69... | Line 70... | ||
69 | $pos = strpos($sql, $needle); |
70 | $pos = strpos($sql, $needle); |
70 | if ($pos !== false) { |
71 | if ($pos !== false) { |
71 | $sql = substr_replace($sql, $replace, $pos, strlen($needle)); |
72 | $sql = substr_replace($sql, $replace, $pos, strlen($needle)); |
72 | } |
73 | } |
73 | } |
74 | } |
74 | $sql = str_replace(chr(1), '?', $sql); |
75 | $sql = str_replace($dummy, '?', $sql); |
75 | return $this->doQuery($sql); |
76 | return $this->doQuery($sql); |
76 | } |
77 | } |
77 | 78 | ||
78 | /** |
79 | /** |
79 | * @var int |
80 | * @var int |