The get_warnings() function on the mysqli connection object returns useful warnings such as Warning: 1366: Incorrect integer value: '' for column 'published'
. These warnings help in building reliable code.
Can I access there warning messages from CodeIgniter?
CI provides $this->db->error();
which will return an array containing the error code and message. I'm not sure warnings show up in this list.
It is possible to execute PHP mysqli function directly. You need to run a CI function that returns a CI_DB_result
. From there you have access to the member conn_id
which will can be used as the mysqli $link
used by many of the procedural methods of PHP's mysqli extension.
$query = $this->db->get('some_table');
//$query is of type CI_DB_result
//Use it to run PHP mysqli function directly
$row_count = mysqli_affected_rows($query->conn_id);
I've tested this and it works, as does mysqli_field_count($query->conn_id);
I would expect mysqli_get_warnings ($query->conn_id)
to work also.