problem with invokeQueryWith() function while using % as part of the query e.g. Select DATE_FORMAT(trigger_time, '%Y%m%dT%T') as trigger_time from abc;
This is the issue we found during our project development using invokeQueryWith() function to invoke a query which involve % sign as part of query.
e.g. Select DATE_FORMAT(
It's giving error:
Excetion -->vsprintf(): Too few arguments
The issue is we use vsprintf to replace named parameters in query with arguments passed in query. The syntax of query required '%(abcd)s' format to specify the replacement parameter. Internally, phpdevshell try to mach that replacement parameters and replace it using vsprintf function.
Somehow there is a bug in vsprintf() method of php and it tries to replace parameters with arguments pass to query starting with whereever it sees % sign within the query. Hench forth it runs sort of replacement arguments or endup replacing arguments at wrong place and throwing error: vsprintf(): Too few arguments
-------------- Report bug to php to fix it in vsprintf()
Update documentation of phpdevshell database part, to update users to precede % with another % sign as escape character while executing query involving named parameters.
e.g. Original Query: Select DATE_FORMAT(
felt necessary report to save others wasting time to debug the code