Compare commits

...

3 Commits

Author SHA1 Message Date
Clemens Schwaighofer
caf03421a7 Bug fix for DB\IO param prepare call with wrong param array check
The global param array in the class instead of the param array passed
to the method was checked
2023-10-31 10:18:44 +09:00
Clemens Schwaighofer
facf8adaf7 DB\IO move dbReturn params set before first abort 2023-10-31 10:05:43 +09:00
Clemens Schwaighofer
c8158c8224 Remove echo from phpunit test file 2023-10-23 17:11:06 +09:00
3 changed files with 17 additions and 5 deletions

View File

@@ -467,7 +467,6 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds);
} else {
if (in_array('show_only_days', $params)) {
echo "FOO\n";
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds, show_only_days:true);
} elseif (in_array('truncate_after', $params)) {
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds, truncate_after: 'v');

View File

@@ -56,7 +56,9 @@ print "<b>dbReturn CACHE tests</b><br>";
$db->dbExec("DELETE FROM test_db_return");
$db->dbExec("INSERT INTO test_db_return (uid, data) VALUES ('A1', 'Test A'), ('B1', 'Test B')");
// read query to use
$q_db_ret = "SELECT * FROM test_db_return ORDER BY uid";
$q_db_ret = <<<SQL
SELECT * FROM test_db_return ORDER BY uid
SQL;
RunningTime::hrRunningTime();
@@ -157,4 +159,15 @@ $db->dbCacheReset($q_db_ret);
print "<br>";
print "Overall Run time: " . RunningTime::hrRunningTimeFromStart() . "<br>";
print "<br>";
print "PARAM TEST RUN<br>";
// PARAM
$q_db_ret = <<<SQL
SELECT * FROM test_db_return WHERE uid = $1
SQL;
while (is_array($res = $db->dbReturnParams($q_db_ret, ['A1'], $db::NO_CACHE, true))) {
print "ROW: " . Support::printAr($res) . "<br>";
}
// __END__

View File

@@ -1186,7 +1186,7 @@ class IO
*/
private function __dbDebugPrepareContext(string $query, array $params = []): array
{
if ($this->params === []) {
if ($params === []) {
return [];
}
$error_data = [
@@ -2411,6 +2411,8 @@ class IO
// set the query
$this->cursor_ext[$query_hash]['query'] = $query;
// set the query parameters
$this->cursor_ext[$query_hash]['params'] = $params;
// before doing ANYTHING check if query is "SELECT ..." everything else does not work
if (!$this->dbCheckQueryForSelect($this->cursor_ext[$query_hash]['query'])) {
$this->__dbError(17, false, context: [
@@ -2420,8 +2422,6 @@ class IO
]);
return false;
}
// set the query parameters
$this->cursor_ext[$query_hash]['params'] = $params;
// QUERY PARAMS: run query params check and rewrite
if ($this->dbGetConvertPlaceholder() === true) {
try {