CodeIgniter Forums
BasePreparedQuery to include "execute" method with an array argument - 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: BasePreparedQuery to include "execute" method with an array argument (/showthread.php?tid=80076)



BasePreparedQuery to include "execute" method with an array argument - jazzspeed - 09-10-2021

Hi,
I hope this suggestion is something visible and make sense.
I would like to suggest to add functionality to execute prepare query by passing an array argument.
This would be additional method to the existing "execute" - where it is usingĀ variable-length argument list.

Unless if there is other way that I'm not aware of, the suggestion would be helping a lotĀ in generating a dynamic prepared query.
To describe more, in "BasePreparedQuery" class:
Code:
public function execute(...$data)
{
...
}

The suggestion is to have something like this:
Code:
public function executeArray($data)
{
...
}

Thank you & BR,


RE: BasePreparedQuery to include "execute" method with an array argument - kenjis - 09-10-2021

You can write like this:
PHP Code:
$array = [012];
execute(...$array); 

See https://3v4l.org/6vUTL