CodeIgniter Forums
mysqli multi_query - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: mysqli multi_query (/showthread.php?tid=88364)



mysqli multi_query - user44953432 - 08-28-2023

I have been searching on how to achieving executing a sql batch using the CI database framework. So far, have not been able to find it. In short, something similar to below is supported?
Code:
$conn->multi_query($sql)

If not, can I still use mysqli directly like done in plain PHP?


RE: mysqli multi_query - sammyskills - 08-29-2023

You can use Custom Function Calls. See docs.


RE: mysqli multi_query - user44953432 - 08-29-2023

Have seen that. That one allows a procedure or function to be called. Due to some restrictions, I cannot go that route and have to fire a “batch of Sql queries” like you would do in a front end DB UI.

Is this possible using CI database or I have to go directly with MySQLi based code?

On a side note, I noticed this in my logs:

CRITICAL - 2023-08-29 12:12:51 --> ...
...
CRITICAL - 2023-08-29 16:16:10 --> syntax error, unexpected token "->"
...
CRITICAL - 2023-08-29 12:17:13 --> ...

For the error "syntax error", the log timing is probably getting logged in UTC vs every other log which is in my local timezone. Looks like a bug in CI logger?