Fix DB\IO return for unset pk name to be always string
Add Test for SELECT typ query and num rows type with dbReturn
This commit is contained in:
@@ -3384,6 +3384,23 @@ final class CoreLibsDBIOTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
// if this is a select query, db dbReturn, dbReturnRow, dbReturnArray too
|
||||
if (preg_match("/^(select|show|with) /i", $query)) {
|
||||
$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");
|
||||
|
||||
@@ -2874,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