Write whether batch execution or not as json.

<p>default: "batch": true,

@param sb            StringBuilder to write
@param execInfo      execution info
@param queryInfoList query info list
427443
protected void writeBatchEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
        sb.append("\"batch\":");
        sb.append(execInfo.isBatch() ? "true" : "false");
        sb.append(", ");
    }
161642
public void executeQueriesList(List<String> queriesList) {

        for (String query : queriesList) {
            this.session.execute(query);
        }
    }
99050
private void _serializeQuery(String name, Query query, StringBuilder sb, Set<Object> done) throws ConverterException {
	if (useWDDX) _serializeWDDXQuery(name, query, sb, done);
	else _serializeASQuery(name, query, sb, done);
    }
754278
function(callback){

    output("Initializing queries...");

    if(program.keyspace){
        batchQueries.unshift("USE " + program.keyspace + ";");
    }

    if(batchQueries && batchQueries.length > 0){
        output("Running queries...");
        executeQuery(batchQueries.shift(), callback);
    }else{
        callback("No queries to run.", null);
    }
}
132216
public JSONObject batch(JSONArray actions, RequestOptions requestOptions) throws AlgoliaException {
    return postBatch(actions, requestOptions);
  }
1011820
protected void writeFrameworkScript(AbstractRenderAppender sb)
    {
        boolean script = false;
        ScriptRequestState jsu = ScriptRequestState.getScriptRequestState((HttpServletRequest) pageContext.getRequest());

        boolean writeLegacy = false;
        boolean writeName = false;
        String val;

        // if we are writing out legacy JavaScript support output the idMap
        if (TagConfig.isLegacyJavaScript()) {
            val = processIdMap(_idMap, "idMappingEntry", _idScope);
            if (val != null) {
                writeIdMap(this, "idMappingTable", val);
                writeLegacy = true;
            }
        }

        // if we are writing out default JavaScript support we create the name map
        if (TagConfig.isDefaultJavaScript()) {
            String idScope = getJavaScriptId();
            if (idScope.equals(""))
                idScope = null;
            val = processIdMap(_idToNameMap, "tagIdNameMappingEntry", idScope);
            if (val != null) {
                writeIdMap(this, "tagIdNameMappingTable", val);
                writeName = true;
            }
        }

        if (writeLegacy || _writeId || writeName)
            jsu.writeNetuiNameFunctions(this, writeLegacy, _writeId, writeName);

        ScriptTag.State state = null;
        ScriptTag br = null;
        if (_funcBlocks != null && _funcBlocks.size() > 0) {
            if (!script) {
                state = new ScriptTag.State();
                state.suppressComments = false;
                br = (ScriptTag) TagRenderingBase.Factory.getRendering(TagRenderingBase.SCRIPT_TAG, pageContext.getRequest());
                br.doStartTag(sb, state);
                script = true;
            }
            String s = ScriptRequestState.getString("functionComment", null);
            sb.append(s);
            int cnt = _funcBlocks.size();
            for (int i = 0; i < cnt; i++) {
                sb.append((String)_funcBlocks.get(i));
                if (i != cnt - 1) {
                    sb.append("\n");
                }
            }
        }

        if (script) {
            assert(br != null);
            br.doEndTag(sb, false);
        }
    }
135786
public static void writeRecordBatchTo(BufferAllocator bufferAllocator ,List<List<Writable>> recordBatch, Schema inputSchema,OutputStream outputStream) {
        if(!(recordBatch instanceof ArrowWritableRecordBatch)) {
            val convertedSchema = toArrowSchema(inputSchema);
            List<FieldVector> columns  = toArrowColumns(bufferAllocator,inputSchema,recordBatch);
            try {
                VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,columns,recordBatch.size());

                ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(columns,convertedSchema.getFields()),
                        newChannel(outputStream));
                writer.start();
                writer.writeBatch();
                writer.end();


            } catch (IOException e) {
                throw new IllegalStateException(e);
            }

        }
        else {
            val convertedSchema = toArrowSchema(inputSchema);
            val pair = toArrowColumns(bufferAllocator,inputSchema,recordBatch);
            try {
                VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,pair,recordBatch.size());

                ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(pair,convertedSchema.getFields()),
                        newChannel(outputStream));
                writer.start();
                writer.writeBatch();
                writer.end();


            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
        }

    }
1003935
@Override
    public int[] executeBatch() throws SQLException
    {
        checkClosed();
        closeCurrentResult();
        if (batch == null || batch.size() == 0) {
            return new int[0];
        }

        int[] updateCounts = new int[batch.size()];
        // keep a running total of update counts
        int runningUpdateCount = 0;

        int i = 0;
        try {
            for (; i < batch.size(); i++) {

                setCurrentResult(
                        null,
                        (int) batch.get(i).execute(
                                sourceConnection.NativeConnection,
                                this.m_timeout,
                                sourceConnection.queryTimeOutUnit)[0].fetchRow(
                                0).getLong(0));
                updateCounts[i] = this.lastUpdateCount;
                runningUpdateCount += this.lastUpdateCount;
            }
        } catch (SQLException x) {
            updateCounts[i] = EXECUTE_FAILED;
            throw new BatchUpdateException(Arrays.copyOf(updateCounts, i + 1),
                    x);
        } finally {
            clearBatch();
        }
        // replace the update count from the last statement with the update count
        // from the last batch.
        this.lastUpdateCount = runningUpdateCount;

        return updateCounts;
    }
559393
static boolean addListToJSON(StringBuilder sb, String name, Object[] list, boolean jsonEscapeValues, boolean isFirstField) {
        if (name == null || list == null)
            return false;

        // add comma if isFirstField == false
        if (!isFirstField)
            sb.append(",");

        sb.append("\"" + name + "\":[");
        boolean firstParm = true;
        for (Object element : list) {
            if (firstParm)
                sb.append("\"");
            else
                sb.append(",\"");
            if (element != null) {
                if (jsonEscapeValues)
                    sb.append(jsonEscape2(element.toString()));
                else
                    sb.append(element.toString());
            }
            sb.append("\"");
            firstParm = false;
        }
        sb.append("]");
        return true;
    }
588085
private void writeActions(List<Action> actions)
            throws JsonGenerationException, IOException {
        List<String> actionStrings = new ArrayList<String>();

        for (Action action : actions) {
            actionStrings.add(action.getActionName());
        }
        writeJsonArray(JsonDocumentFields.ACTION, actionStrings);
    }
489969
@Override
	public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception {
		this.startOutput();
		for (String formattedResult : messageFormatter.formatResults(results, server)) {
				log.debug("Sending result: {}", formattedResult);
				this.sendOutput(formattedResult);
		}
		this.finishOutput();
	}
367061
@Override
  public void addBatch(String sql) throws SQLException {
    checkClosed();

    if (batchStatements == null) {
      batchStatements = new ArrayList<Query>();
      batchParameters = new ArrayList<ParameterList>();
    }

    // Simple statements should not replace ?, ? with $1, $2
    boolean shouldUseParameterized = false;
    CachedQuery cachedQuery = connection.createQuery(sql, replaceProcessingEnabled, shouldUseParameterized);
    batchStatements.add(cachedQuery.query);
    batchParameters.add(null);
  }
542764
@Override
  public void processEvent(QueryBatch batch) {
    try ( DocumentPage docs = getDocs(batch) ) {
      while ( docs.hasNext() ) {
        for ( Consumer<DocumentRecord> listener : exportListeners ) {
          try {
            listener.accept(docs.next());
          } catch (Throwable t) {
            logger.error("Exception thrown by an onDocumentReady listener", t);
          }
        }
      }
    } catch (Throwable t) {
      for ( BatchFailureListener<Batch<String>> listener : failureListeners ) {
        try {
          listener.processFailure(batch, t);
        } catch (Throwable t2) {
          logger.error("Exception thrown by an onBatchFailure listener", t2);
        }
      }
      for ( BatchFailureListener<QueryBatch> queryBatchFailureListener : queryBatchFailureListeners ) {
        try {
          queryBatchFailureListener.processFailure(batch, t);
        } catch (Throwable t2) {
          logger.error("Exception thrown by an onFailure listener", t2);
        }
      }
    }
  }
751188
@Override
	public int[] executeBatch(String sql, List<Object> list) {
		if (list.isEmpty() == true) {
			return new int[] {};
		}
		Iterator<Object> iterator = list.iterator();
		if (iterator.hasNext() == false) {
			return new int[] {};
		}
		Connection connection = null;
		PreparedStatement ps = null;
		try {
			PropertyDesc.cacheModeOn();
			connection = getConnection();
			Object object = iterator.next();

			Map<String, ParameterValue> values = new HashMap<>();
			addValues(values, object);
			sql = getSql(sql, dialect);
			ps = createPreparedStatement(connection, sql, values, ExecuteType.UPDATE, dialect, null);
			PreparedStatementUtil.addBatch(ps, sqlLogRegistry);

			while (iterator.hasNext()) {
				object = iterator.next();

				Node node = parse(sql);
				values = new HashMap<>();
				addValues(values, object);
				CommandContext ctx = new CommandContext(dialect);
				ctx.addArgs(values);
				node.accept(ctx);
				List<Object> bindVariables = ctx.getBindVariables();
				List<Integer> bindVariableTypes = ctx.getBindVariableTypes();
				bindArgs(ps, bindVariables, bindVariableTypes, ExecuteType.UPDATE, dialect);
				PreparedStatementUtil.addBatch(ps, sqlLogRegistry);
			}
			return PreparedStatementUtil.executeBatch(ps, sqlLogRegistry);
		} finally {
			PropertyDesc.cacheModeOff();
			try {
				StatementUtil.close(ps);
			} finally {
				ConnectionUtil.close(connection);
			}
		}
	}
743630
protected void writeTypeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
        sb.append("Type:");
        sb.append(getStatementType(execInfo.getStatementType()));
        sb.append(", ");
    }
1365938
public JSONObject batchSynonyms(List<JSONObject> objects, boolean forwardToReplicas, boolean replaceExistingSynonyms) throws AlgoliaException {
    return this.batchSynonyms(objects, forwardToReplicas, replaceExistingSynonyms, RequestOptions.empty);
  }
450711
protected <T extends AstNode> void printList(List<T> items,
                                                 StringBuilder sb) {
        int max = items.size();
        int count = 0;
        for (AstNode item : items) {
            sb.append(item.toSource(0));
            if (count++ < max-1) {
                sb.append(", ");
            } else if (item instanceof EmptyExpression) {
                sb.append(",");
            }
        }
    }