CodeIgniter Forums
Add named values for query binding - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Add named values for query binding (/showthread.php?tid=66370)



Add named values for query binding - Nicolas - 10-17-2016

I truly hope I am not saying something wrong if I say that today, the latest version of CI I'm using 3.1.0 does not support named values for query binding.

Whenever I implement insert queries or update queries, there could be tons of fields to pass to a query through the binding mechanism. I find it very difficult to maintain, read, implement with only adding '?' everywhere in the SQL and pass an array that has in the exact right sequence order the values which match with each '?' in the SQL.

PDO supports the query binding with named values to pass associative array. Why not CI?

The method DB_driver::compile_binds method even states: "// Make sure we're using numeric keys" Sad


I don't know what others think about it, but I would really love to see named binds array work with CI 4.
Thank you


RE: Add named values for query binding - kilishan - 10-17-2016

You're in luck