diff --git a/www/admin/class_test.db.php b/www/admin/class_test.db.php index 3b459152..dd8e7494 100644 --- a/www/admin/class_test.db.php +++ b/www/admin/class_test.db.php @@ -276,6 +276,7 @@ print "UPDATE WITH PK " . Support::printToString($last_insert_pk) . "QUERY: " . $db->dbGetQuery() . " |
" . "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | " . "RETURNING ARRAY: " . print_r($db->dbGetReturningArray(), true) . "
"; +$db->dbExec("INSERT INTO test_foo (test) VALUES ('STAND ALONE')"); // INSERT WITH NO RETURNING $status = $db->dbExec("INSERT INTO test_foobar (type, integer) VALUES ('WITHOUT DATA', 456)"); @@ -294,6 +295,7 @@ print "INSERT WITH NO PRIMARY KEY WITH RETURNING STATUS: " . Support::printToStr print ""; +print "PREPARE QUERIES
"; // READ PREPARE $q_prep = "SELECT test_foo_id, test, some_bool, string_a, number_a, " . "number_a_numeric, some_time " @@ -303,13 +305,12 @@ $q_prep = "SELECT test_foo_id, test, some_bool, string_a, number_a, " if ($db->dbPrepare('sel_test_foo', $q_prep) === false) { print "Error in sel_test_foo prepare
"; } else { - $max_rows = 6; // do not run this in dbFetchArray directly as // dbFetchArray(dbExecute(...)) // this will end in an endless loop - $cursor = $db->dbExecute('sel_test_foo', []); $i = 1; - while (($res = $db->dbFetchArray($cursor, true)) !== false) { + $cursor = $db->dbExecute('sel_test_foo', ['SOMETHING DIFFERENT']); + while (is_array($res = $db->dbFetchArray($cursor, true))) { print "DB PREP EXEC FETCH ARR: " . $i . ":
" . print_r($res, true) . "

"; $i++; } @@ -322,6 +323,37 @@ if ($db->dbPrepare('sel_test_foo', $q_prep) === false) { . "
" . print_r($db->dbGetCombinedErrorHistory(), true) . "

"; } +// sel test with ANY () type +$q_prep = "SELECT test_foo_id, test, some_bool, string_a, number_a, " + . "number_a_numeric, some_time " + . "FROM test_foo " + . "WHERE test = ANY($1) " + . "ORDER BY test_foo_id DESC LIMIT 5"; +if ($db->dbPrepare('sel_test_foo_any', $q_prep) === false) { + print "Error in sel_test_foo_any prepare
"; +} else { + // do not run this in dbFetchArray directly as + // dbFetchArray(dbExecute(...)) + // this will end in an endless loop + $values = [ + 'SOMETHING DIFFERENT', + 'STAND ALONE', + 'I DO NOT EXIST' + ]; + $query_value = '{' + . join(',', $values) + . '}'; + print "Read: $query_value
"; + $cursor = $db->dbExecute('sel_test_foo_any', [ + $query_value + ]); + $i = 1; + while (($res = $db->dbFetchArray($cursor, true)) !== false) { + print "DB PREP EXEC FETCH ANY ARR: " . $i . ":
" . print_r($res, true) . "

"; + $i++; + } +} + echo "
"; print "EOM STYLE STRINGS
"; $test_bar = $db->dbEscapeLiteral('SOMETHING DIFFERENT');