If a method accepts parameters, those parameters get mapped to Servoy’s arguments array automatically. This is a great feature, but I have not had any luck using the arguments array for prepared statements.
For example, the following code does not seem to work…
databaseManager.getDataSetByQuery(currentcontroller.getServerName(), ‘SELECT foo FROM bar where bar = ?’, arguments, 1);
Would be a time saver to be able to pass arguments to the getDataSetByQuery fx for prepared statement.
The issue is that arguments is not an Array type. It’s an Object.
The getDataSetByQuery expects a value of the type Array.
What you can do however is pass an Array with your values to the first argument of the method and then pass it to the getDataSetByQuery as arguments[0].
At the end of the day I was trying to avoid creating a new array to hold the data the args object already has. It’s redundant for me to have to do it in each method that I have prepared SQL statements in.
Maybe the getDataSetbyquery fx could someday be modified to accept either an array or an object? Servoy seems to be really very good at creating/implementing shortcuts for developers, this would be a good one in my opinion.