[TYPO3-mvc] Prepared statement with variable num of arguments?

Marc Wöhlken woehlken at quadracom.de
Fri Oct 25 12:28:03 CEST 2013


Hi there!
I have a scenario where I whish to generate SQL queries dynamically but
also like to benefit from prepared statements.

When using prepared statements one has to specify the values to be
inserted directly within the method call:

$query->statement(
  'select * from tbl_foo where foo=? and bar=?',
  'fooVal',
  'barVal'
);

As my sql is generated in a dynamic way I wonder if there is a way to
deal with the variable number of parameters like this:

// $values would be an array, $sql a string
list($sql,$values) = $this->createSqlAndValues($mySearchParams);
$query->statement($sql,$values);

Any ideas on how to deal with this scenario?

Regards
	Marc


-- 
...........................................................
Marc Wöhlken                     TYPO3 certified integrator

Quadracom - Proffe & Wöhlken

Rembertistraße 32              WWW: http://www.quadracom.de
D-28203 Bremen                E-Mail: woehlken at quadracom.de
______________             PGP-Key: http://pgp.quadracom.de


More information about the TYPO3-project-typo3v4mvc mailing list