@Override
public ServiceManager getServiceManager() {
return serviceManager;
}
};
QueryBindings queryBindings = queryContext.createBindings();
JsonRowWriter json = new JsonRowWriter(new TableRowTracker(table, depth));
WriteTableRow rowWriter = new WriteTableRow();
AkibanAppender appender = AkibanAppender.of(writer);
boolean transaction = false;
Cursor cursor = null;
try {
if (withTransaction) {
transactionService.beginTransaction(session);
transaction = true;
}
cursor = API.cursor(plan, queryContext, queryBindings);
appender.append("[");
boolean begun = false;
if (keys == null) {
begun = json.writeRows(cursor, appender, "\n", rowWriter, options);
} else {
for (List<Object> key : keys) {
for (int i = 0; i < key.size(); i++) {
ValueSource value = ValueSources.fromObject(key.get(i), null).value();
queryBindings.setValue(i, value);
}
if (json.writeRows(cursor, appender, begun ? ",\n" : "\n", rowWriter, options))
begun = true;
}
}