Good day
I did a test to see the Database objects and how the handle invalid queries. The logic is that if
the database query does not return a valid result that false is returned else the resource id is returned via the CI
Database framework
Database\BaseConnection->query
BaseConnection->simpleQuery
MySQLi\Connection->execute
the problem is that if one enteres a invalid query for example
select * from somewherethatdoesnotexist
then instead of it returned FALSE as one would expect for the error will be
mysqli_sql_exception: Table 'dominion_employees.somewhere' doesn't exist in /MySQLi/Connection.php:331
it returns (the mySQLI php lib that is) this object, that makes all code to handle invalid queries after it not work
as the object is a actual object now and not FALSE.
PHP Code:
(
[connID] => mysqli Object
(
[affected_rows] => -1
[client_info] => 5.5.66-MariaDB
[client_version] => 50566
[connect_errno] => 0
[connect_error] =>
[errno] => 1146
[error] => Table 'somewhere' doesn't exist
[error_list] => Array
(
[0] => Array
(
[errno] => 1146
[sqlstate] => 42S02
[error] => Table 'somewhere' doesn't exist
)
)
[field_count] => 0
[host_info] => Localhost via UNIX socket
[info] =>
[insert_id] => 0
[server_info] => 5.6.41-84.1
[server_version] => 50641
[stat] => Uptime: 18262742 Threads: 6 Questions: 10888006908 Slow queries: 9126 Opens: 32322468 Flush tables: 1 Open tables: 16800 Queries per second avg: 596.186
[sqlstate] => 00000
[protocol_version] => 10
[thread_id] => 99238701
[warning_count] => 0
)
[resultID] =>
[resultArray] => Array
(
)
[resultObject] => Array
(
)
[customResultObject] => Array
(
)
[currentRow] => 0
[numRows] =>
[rowData] =>
)
I geuss one should in the mySQLI driver part check
and if it is set, return false rather ?
Hope it helps
Johannes