private void executeTransactionCommand(Query query) throws SQLException { getQueryExecutor().execute(query, null, new TransactionCommandHandler(), 0, 0, QueryExecutor.QUERY_NO_METADATA | QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_SUPPRESS_BEGIN); }
public ParameterMetaData getParameterMetaData() throws SQLException { int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_DESCRIBE_ONLY | QueryExecutor.QUERY_SUPPRESS_BEGIN; StatementResultHandler handler = new StatementResultHandler(); connection.getQueryExecutor().execute(preparedQuery.query, preparedParameters, handler, 0, 0, flags); int[] oids = preparedParameters.getTypeOIDs(); if (oids != null) { return createParameterMetaData(connection, oids); } return null; }
private void executeTransactionCommand(Query query) throws SQLException { int flags = QueryExecutor.QUERY_NO_METADATA | QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_SUPPRESS_BEGIN; if (prepareThreshold == 0) { flags |= QueryExecutor.QUERY_ONESHOT; } try { getQueryExecutor().execute(query, null, new TransactionCommandHandler(), 0, 0, flags); } catch (SQLException e) { // Don't retry composite queries as it might get partially executed if (query.getSubqueries() != null || !queryExecutor.willHealOnRetry(e)) { throw e; } query.close(); // retry getQueryExecutor().execute(query, null, new TransactionCommandHandler(), 0, 0, flags); } }
connection.getQueryExecutor().execute(queries, parameterLists, handler,
public static byte[][] run(QueryExecutor executor, String queryString, boolean wantResults) throws SQLException { Query query = executor.createSimpleQuery(queryString); SimpleResultHandler handler = new SimpleResultHandler(); int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_SUPPRESS_BEGIN | QueryExecutor.QUERY_EXECUTE_AS_SIMPLE; if (!wantResults) { flags |= QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_NO_METADATA; } try { executor.execute(query, null, handler, 0, 0, flags); } finally { query.close(); } if (!wantResults) { return null; } List<byte[][]> tuples = handler.getResults(); if (tuples == null || tuples.size() != 1) { throw new PSQLException(GT.tr("An unexpected result was returned by a query."), PSQLState.CONNECTION_UNABLE_TO_CONNECT); } return tuples.get(0); }
public static byte[][] run(ProtocolConnection protoConnection, String queryString, boolean wantResults) throws SQLException { QueryExecutor executor = protoConnection.getQueryExecutor(); Query query = executor.createSimpleQuery(queryString); SimpleResultHandler handler = new SimpleResultHandler(protoConnection); int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_SUPPRESS_BEGIN; if (!wantResults) flags |= QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_NO_METADATA; try { executor.execute(query, null, handler, 0, 0, flags); } finally { query.close(); } if (!wantResults) return null; Vector tuples = handler.getResults(); if (tuples == null || tuples.size() != 1) throw new PSQLException(GT.tr("An unexpected result was returned by a query."), PSQLState.CONNECTION_UNABLE_TO_CONNECT); return (byte[][]) tuples.elementAt(0); }
/** * Retrieves the number, types and properties of this * <code>PreparedStatement</code> object's parameters. * * @return a <code>ParameterMetaData</code> object that contains information * about the number, types and properties of this * <code>PreparedStatement</code> object's parameters * @exception SQLException if a database access error occurs * @see ParameterMetaData * @since 1.4 */ public ParameterMetaData getParameterMetaData() throws SQLException { int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_DESCRIBE_ONLY | QueryExecutor.QUERY_SUPPRESS_BEGIN; StatementResultHandler handler = new StatementResultHandler(); connection.getQueryExecutor().execute(preparedQuery, preparedParameters, handler, 0, 0, flags); int oids[] = preparedParameters.getTypeOIDs(); if (oids != null) return createParameterMetaData(connection, oids); return null; }
public ResultSetMetaData getMetaData() throws SQLException { checkClosed(); ResultSet rs = getResultSet(); if (rs == null) { // OK, we haven't executed it yet, we've got to go to the backend // for more info. We send the full query, but just don't // execute it. int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_DESCRIBE_ONLY | QueryExecutor.QUERY_SUPPRESS_BEGIN; StatementResultHandler handler = new StatementResultHandler(); connection.getQueryExecutor().execute(preparedQuery, preparedParameters, handler, 0, 0, flags); ResultWrapper wrapper = handler.getResults(); if (wrapper != null) { rs = wrapper.getResultSet(); } } if (rs != null) return rs.getMetaData(); return null; }
public ResultSetMetaData getMetaData() throws SQLException { checkClosed(); ResultSet rs = getResultSet(); if (rs == null || ((PgResultSet) rs).isResultSetClosed()) { // OK, we haven't executed it yet, or it was closed // we've got to go to the backend // for more info. We send the full query, but just don't // execute it. int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_DESCRIBE_ONLY | QueryExecutor.QUERY_SUPPRESS_BEGIN; StatementResultHandler handler = new StatementResultHandler(); connection.getQueryExecutor().execute(preparedQuery.query, preparedParameters, handler, 0, 0, flags); ResultWrapper wrapper = handler.getResults(); if (wrapper != null) { rs = wrapper.getResultSet(); } } if (rs != null) { return rs.getMetaData(); } return null; }
StatementResultHandler handler2 = new StatementResultHandler(); try { connection.getQueryExecutor().execute(queries[0], parameterLists[0], handler2, 0, 0, flags2); } catch (SQLException e) { connection.getQueryExecutor().execute(queries, parameterLists, handler, maxrows, fetchSize, flags); } finally {
connection.getQueryExecutor().execute(queryToExecute, queryParameters, handler,
private void executeTransactionCommand(Query query) throws SQLException { getQueryExecutor().execute(query, null, new TransactionCommandHandler(), 0, 0, QueryExecutor.QUERY_NO_METADATA | QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_SUPPRESS_BEGIN); }
private void executeTransactionCommand(Query query) throws SQLException { getQueryExecutor().execute(query, null, new TransactionCommandHandler(), 0, 0, QueryExecutor.QUERY_NO_METADATA | QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_SUPPRESS_BEGIN); }
/** * Retrieves the number, types and properties of this * <code>PreparedStatement</code> object's parameters. * * @return a <code>ParameterMetaData</code> object that contains information * about the number, types and properties of this * <code>PreparedStatement</code> object's parameters * @exception SQLException if a database access error occurs * @see ParameterMetaData * @since 1.4 */ public ParameterMetaData getParameterMetaData() throws SQLException { int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_DESCRIBE_ONLY | QueryExecutor.QUERY_SUPPRESS_BEGIN; StatementResultHandler handler = new StatementResultHandler(); connection.getQueryExecutor().execute(preparedQuery, preparedParameters, handler, 0, 0, flags); int oids[] = preparedParameters.getTypeOIDs(); if (oids != null) return createParameterMetaData(connection, oids); return null; }
/** * Retrieves the number, types and properties of this * <code>PreparedStatement</code> object's parameters. * * @return a <code>ParameterMetaData</code> object that contains information * about the number, types and properties of this * <code>PreparedStatement</code> object's parameters * @exception SQLException if a database access error occurs * @see ParameterMetaData * @since 1.4 */ public ParameterMetaData getParameterMetaData() throws SQLException { int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_DESCRIBE_ONLY | QueryExecutor.QUERY_SUPPRESS_BEGIN; StatementResultHandler handler = new StatementResultHandler(); connection.getQueryExecutor().execute(preparedQuery, preparedParameters, handler, 0, 0, flags); int oids[] = preparedParameters.getTypeOIDs(); if (oids != null) return createParameterMetaData(connection, oids); return null; }
public static byte[][] run(ProtocolConnection protoConnection, String queryString, boolean wantResults) throws SQLException { QueryExecutor executor = protoConnection.getQueryExecutor(); Query query = executor.createSimpleQuery(queryString); SimpleResultHandler handler = new SimpleResultHandler(protoConnection); int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_SUPPRESS_BEGIN; if (!wantResults) flags |= QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_NO_METADATA; try { executor.execute(query, null, handler, 0, 0, flags); } finally { query.close(); } if (!wantResults) return null; Vector tuples = handler.getResults(); if (tuples == null || tuples.size() != 1) throw new PSQLException(GT.tr("An unexpected result was returned by a query."), PSQLState.CONNECTION_UNABLE_TO_CONNECT); return (byte[][]) tuples.elementAt(0); }
private byte[][] runSetupQuery(ProtocolConnectionImpl protoConnection, String queryString, boolean wantResults) throws SQLException { QueryExecutor executor = protoConnection.getQueryExecutor(); Query query = executor.createSimpleQuery(queryString); SimpleResultHandler handler = new SimpleResultHandler(protoConnection); int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_SUPPRESS_BEGIN; if (!wantResults) flags |= QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_NO_METADATA; try { executor.execute(query, null, handler, 0, 0, flags); } finally { query.close(); } if (!wantResults) return null; Vector tuples = handler.getResults(); if (tuples == null || tuples.size() != 1) throw new PSQLException(GT.tr("An unexpected result was returned by a query."), PSQLState.CONNECTION_UNABLE_TO_CONNECT); return (byte[][]) tuples.elementAt(0); }
public ResultSetMetaData getMetaData() throws SQLException { checkClosed(); ResultSet rs = getResultSet(); if (rs == null) { // OK, we haven't executed it yet, we've got to go to the backend // for more info. We send the full query, but just don't // execute it. int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_DESCRIBE_ONLY | QueryExecutor.QUERY_SUPPRESS_BEGIN; StatementResultHandler handler = new StatementResultHandler(); connection.getQueryExecutor().execute(preparedQuery, preparedParameters, handler, 0, 0, flags); ResultWrapper wrapper = handler.getResults(); if (wrapper != null) { rs = wrapper.getResultSet(); } } if (rs != null) return rs.getMetaData(); return null; }
public ResultSetMetaData getMetaData() throws SQLException { checkClosed(); ResultSet rs = getResultSet(); if (rs == null) { // OK, we haven't executed it yet, we've got to go to the backend // for more info. We send the full query, but just don't // execute it. int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_DESCRIBE_ONLY | QueryExecutor.QUERY_SUPPRESS_BEGIN; StatementResultHandler handler = new StatementResultHandler(); connection.getQueryExecutor().execute(preparedQuery, preparedParameters, handler, 0, 0, flags); ResultWrapper wrapper = handler.getResults(); if (wrapper != null) { rs = wrapper.getResultSet(); } } if (rs != null) return rs.getMetaData(); return null; }