* @param bindings
* The variable bindings, wrapped in {@link ERXSQLBinding} objects
*/
public static void runSqlQueryWithBindings( EOEditingContext ec, String modelName, String query, ERXSQLBinding... bindings ) {
EOObjectStore osc = ec.rootObjectStore();
EODatabaseChannel databaseChannel = databaseContextForModelName(ec,modelName).availableChannel();
osc.lock();
try {
EOAdaptorChannel adaptorChannel = databaseChannel.adaptorChannel();
if (!adaptorChannel.isOpen()) {
adaptorChannel.openChannel();
}
EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForString( query );
String proceccedQuery = processedQueryString(query, expression, bindings);
expression.setStatement(proceccedQuery);
try {
adaptorChannel.evaluateExpression( expression );
} finally {
databaseChannel.cancelFetch();
}
} finally {
osc.unlock();
}
}