DB\IO Class updates, other Class fixes

Output\Form\Generate and ACL\Login have DB\IO method call name changes
for pos/num rows methods. Use proper methods and not use the cursor full
return check method

DB\IO:
Switched to new conenction busy check with sockt and timeout loop. So
short blocked and psql error blocked ones are not blocking other calls.

Moved the dbReturn cache read to a separte private method and cleaned up
code for more clear view

Moved all query hash creations to method to simple change hash creatio
if needed. This method can be used for external correct query hash
creation if needed.

Variable name and code block clean up in dbReturn

No data return (dbReturn or dbFetchArray) will change returned data row.
Return as is.

Moved methods around in code to group them together for next stage in
sub class creation (planned)

Renamed dbCursorPos to dbGetCursorPos
and dbCursorNumRows to dbGetCursorNumRows

Work on phpunit tests for DB\IO
This commit is contained in:
Clemens Schwaighofer
2022-03-03 06:31:55 +09:00
parent fe13c24a13
commit 42b961f35e
7 changed files with 889 additions and 239 deletions

View File

@@ -55,16 +55,26 @@ echo "DB_CONFIG_SET constant: <pre>" . print_r(DB_CONFIG, true) . "</pre><br>";
print "DB Client encoding: " . $db->dbGetEncoding() . "<br>";
while (is_array($res = $db->dbReturn("SELECT * FROM max_test", DbIo::USE_CACHE, true))) {
print "TIME: " . $res['time'] . "<br>";
print "UUD/TIME: " . $res['uid'] . "/" . $res['time'] . "<br>";
}
print "CACHED DATA: <pre>" . print_r($db->dbGetCursorExt(), true) . "</pre><br>";
while (is_array($res = $db->dbReturn("SELECT * FROM max_test"))) {
print "[CACHED] TIME: " . $res['time'] . "<br>";
while (is_array($res = $db->dbReturn("SELECT * FROM max_test", DbIo::USE_CACHE))) {
print "[CACHED] UID/TIME: " . $res['uid'] . "/" . $res['time'] . "<br>";
// print "****RES: <pre>" . print_r($res, true) . "</pre><br>";
}
// print "CACHED REREAD DATA: <pre>" . print_r($db->dbGetCursorExt(), true) . "</pre><br>";
while (is_array($res = $db->dbReturn("SELECT * FROM max_test", DbIo::NO_CACHE))) {
print "[NO CACHE] UID.TIME: " . $res['uid'] . "/" . $res['time'] . "<br>";
// print "****RES: <pre>" . print_r($res, true) . "</pre><br>";
}
print "NO CACHED DATA: <pre>" . print_r($db->dbGetCursorExt(), true) . "</pre><br>";
// alternate check for valid data
// while (($res = $db->dbReturn("SELECT * FROM max_test")) !== false) {
// print "[CACHED] TIME: " . $res['time'] . "<br>";
// }
// while (is_array($res = $db->dbReturn("SELECT * FROM max_test", DbIo::USE_CACHE))) {
// print "UUD/TIME: " . $res['uid'] . "/" . $res['time'] . "<br>";
// }
print "<pre>";