Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04b0476b4d | ||
|
|
13fb22385b | ||
|
|
b7f594e683 |
@@ -3384,6 +3384,24 @@ final class CoreLibsDBIOTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
// if this is a select query, db dbReturn, dbReturnRow, dbReturnArray too
|
||||
if (preg_match("/^(select|show|with) /i", $query)) {
|
||||
// TODO also tst dbReturnRow and dbReturnArray
|
||||
$res = $db->dbReturn($query);
|
||||
$this->assertEquals(
|
||||
$expected_rows,
|
||||
$db->dbGetNumRows()
|
||||
);
|
||||
$this->assertEquals(
|
||||
$expected_cols,
|
||||
$db->dbGetNumFields()
|
||||
);
|
||||
$this->assertEquals(
|
||||
$expected_col_names,
|
||||
$db->dbGetFieldNames()
|
||||
);
|
||||
}
|
||||
|
||||
// reset all data
|
||||
$db->dbExec("TRUNCATE table_with_primary_key");
|
||||
$db->dbExec("TRUNCATE table_without_primary_key");
|
||||
|
||||
@@ -69,6 +69,9 @@ $db->dbSetEncoding('SJIS');
|
||||
print "ENCODING TEST: " . $db->dbVersionInfo('client_encoding') . "/" . $db->dbGetEncoding() . "<br>";
|
||||
$db->dbResetEncoding();
|
||||
|
||||
$res = $db->dbReturn("SELECT * FROM max_test");
|
||||
print "DB RETURN ROWS: " . $db->dbGetNumRows() . "<br>";
|
||||
|
||||
while (is_array($res = $db->dbReturn("SELECT * FROM max_test", DbIo::USE_CACHE, true))) {
|
||||
print "UUD/TIME: " . $res['uid'] . "/" . $res['time'] . "<br>";
|
||||
}
|
||||
@@ -277,7 +280,7 @@ print "Wrote to DB tabel $table with data " . print_r($data, true) . " and got p
|
||||
// return Array Test
|
||||
$query = "SELECT type, sdate, integer FROM foobar";
|
||||
$data = $db->dbReturnArray($query, true);
|
||||
print "Full foobar list: <br><pre>" . print_r($data, true) . "</pre><br>";
|
||||
print "Rows: " . $db->dbGetNumRows() . ", Full foobar list: <br><pre>" . print_r($data, true) . "</pre><br>";
|
||||
|
||||
// trigger a warning
|
||||
print "<b>WARNING NEXT</b><br>";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "gullevek/corelibs",
|
||||
"description": "CoreLibs",
|
||||
"name": "gullevek/corelibs-dev",
|
||||
"version": "dev-master",
|
||||
"description": "CoreLibs: Development package",
|
||||
"type": "library",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -274,8 +274,8 @@ define('G_TITLE', $_ENV['G_TITLE'] ?? '');
|
||||
/************ STYLE SHEETS / JS **********/
|
||||
define('ADMIN_STYLESHEET', 'edit.css');
|
||||
define('ADMIN_JAVASCRIPT', 'edit.js');
|
||||
define('STYLESHEET', 'frontend.css');
|
||||
define('JAVASCRIPT', 'frontend.js');
|
||||
define('STYLESHEET', $_ENV['STYLESHEET'] ?? 'frontend.css');
|
||||
define('JAVASCRIPT', $_ENV['JAVASCRIPT'] ?? 'frontend.js');
|
||||
|
||||
// anything optional
|
||||
/************* INTERNAL ******************/
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* AUTHOR: Clemens Schwaighofer
|
||||
* CREATED: 2008/08/01
|
||||
* SHORT DESCRIPTION:
|
||||
* URL redirect header
|
||||
* HISTORY:
|
||||
*********************************************************************/
|
||||
|
||||
|
||||
@@ -1786,9 +1786,12 @@ class IO
|
||||
// count the rows returned (if select)
|
||||
$this->cursor_ext[$query_hash]['num_rows'] =
|
||||
$this->db_functions->__dbNumRows($this->cursor_ext[$query_hash]['cursor']);
|
||||
// also set last return
|
||||
$this->num_rows = $this->cursor_ext[$query_hash]['num_rows'];
|
||||
// count the fields
|
||||
$this->cursor_ext[$query_hash]['num_fields'] =
|
||||
$this->db_functions->__dbNumFields($this->cursor_ext[$query_hash]['cursor']);
|
||||
$this->num_fields = $this->cursor_ext[$query_hash]['num_fields'];
|
||||
// set field names
|
||||
$this->cursor_ext[$query_hash]['field_names'] = [];
|
||||
for ($i = 0; $i < $this->cursor_ext[$query_hash]['num_fields']; $i++) {
|
||||
@@ -1798,6 +1801,7 @@ class IO
|
||||
$i
|
||||
);
|
||||
}
|
||||
$this->field_names = $this->cursor_ext[$query_hash]['field_names'];
|
||||
// reset first call vars
|
||||
$this->cursor_ext[$query_hash]['firstcall'] = 0;
|
||||
// reset the internal pos counter
|
||||
@@ -2870,7 +2874,7 @@ class IO
|
||||
*/
|
||||
public function dbGetInsertPKName(): string
|
||||
{
|
||||
return $this->insert_id_pk_name;
|
||||
return (string)$this->insert_id_pk_name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user