ProtocolConnectionImpl(PGStream pgStream, String user, String database, Logger logger) { this.pgStream = pgStream; this.user = user; this.database = database; this.logger = logger; this.executor = new QueryExecutorImpl(this, pgStream, logger); }
V2Query query = (V2Query)createSimpleQuery(""); SimpleParameterList params = (SimpleParameterList)query.createParameterList(); sendQuery(query, params, "BEGIN"); processResults(query, handler, 0, 0); sendFastpathCall(fnid, (FastpathParameterList)parameters); return receiveFastpathResult();
public synchronized void execute(Query[] queries, ParameterList[] parameters, ResultHandler handler, int maxRows, int fetchSize, int flags) throws SQLException { final ResultHandler delegateHandler = handler; handler = new ResultHandler() { public void handleResultRows(Query fromQuery, Field[] fields, Vector tuples, ResultCursor cursor) { delegateHandler.handleResultRows(fromQuery, fields, tuples, cursor); } public void handleCommandStatus(String status, int updateCount, long insertOID) { delegateHandler.handleCommandStatus(status, updateCount, insertOID); } public void handleWarning(SQLWarning warning) { delegateHandler.handleWarning(warning); } public void handleError(SQLException error) { delegateHandler.handleError(error); } public void handleCompletion() throws SQLException { } }; for (int i = 0; i < queries.length; ++i) execute((V2Query)queries[i], (SimpleParameterList)parameters[i], handler, maxRows, flags); delegateHandler.handleCompletion(); }
public synchronized void processNotifies() throws SQLException { // Asynchronous notifies only arrive when we are not in a transaction if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) return; try { while (pgStream.hasMessagePending()) { int c = pgStream.ReceiveChar(); switch (c) { case 'A': // Asynchronous Notify receiveAsyncNotify(); break; case 'E': // Error Message throw receiveErrorMessage(); // break; case 'N': // Error Notification protoConnection.addWarning(receiveNotification()); break; default: throw new PSQLException(GT.tr("Unknown Response Type {0}.", new Character((char) c)), PSQLState.CONNECTION_FAILURE); } } } catch (IOException ioe) { throw new PSQLException(GT.tr("An I/O error occured while sending to the backend."), PSQLState.CONNECTION_FAILURE, ioe); } }
receiveAsyncNotify(); break; interpretCommandStatus(status, handler); interpretCommandStatus(status, handler); handler.handleError(receiveErrorMessage()); handler.handleWarning(receiveNotification()); break; fields = receiveFields(); tuples = new Vector(); break;
sendQuery(query, parameters, queryPrefix); processResults(query, handler, maxRows, flags);
receiveAsyncNotify(); break; interpretCommandStatus(status, handler); interpretCommandStatus(status, handler); handler.handleError(receiveErrorMessage()); handler.handleWarning(receiveNotification()); break; fields = receiveFields(); tuples = new Vector(); break;
receiveAsyncNotify(); break; SQLException newError = receiveErrorMessage(); if (error == null) error = newError; protoConnection.addWarning(receiveNotification()); break;
sendQuery(query, parameters, queryPrefix); processResults(query, handler, maxRows, flags);
V2Query query = (V2Query)createSimpleQuery(""); SimpleParameterList params = (SimpleParameterList)query.createParameterList(); sendQuery(query, params, "BEGIN"); processResults(query, handler, 0, 0); sendFastpathCall(fnid, (FastpathParameterList)parameters); return receiveFastpathResult();
receiveAsyncNotify(); break; interpretCommandStatus(status, handler); interpretCommandStatus(status, handler); handler.handleError(receiveErrorMessage()); handler.handleWarning(receiveNotification()); break; fields = receiveFields(); tuples = new Vector(); break;
public synchronized void processNotifies() throws SQLException { // Asynchronous notifies only arrive when we are not in a transaction if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) return; try { while (pgStream.hasMessagePending()) { int c = pgStream.ReceiveChar(); switch (c) { case 'A': // Asynchronous Notify receiveAsyncNotify(); break; case 'E': // Error Message throw receiveErrorMessage(); // break; case 'N': // Error Notification protoConnection.addWarning(receiveNotification()); break; default: throw new PSQLException(GT.tr("Unknown Response Type {0}.", new Character((char) c)), PSQLState.CONNECTION_FAILURE); } } } catch (IOException ioe) { throw new PSQLException(GT.tr("An I/O error occured while sending to the backend."), PSQLState.CONNECTION_FAILURE, ioe); } }
sendQuery(query, parameters, queryPrefix); processResults(query, handler, maxRows, flags);
ProtocolConnectionImpl(PGStream pgStream, String user, String database, Logger logger) { this.pgStream = pgStream; this.user = user; this.database = database; this.logger = logger; this.executor = new QueryExecutorImpl(this, pgStream, logger); }
public synchronized void execute(Query[] queries, ParameterList[] parameters, ResultHandler handler, int maxRows, int fetchSize, int flags) throws SQLException { final ResultHandler delegateHandler = handler; handler = new ResultHandler() { public void handleResultRows(Query fromQuery, Field[] fields, Vector tuples, ResultCursor cursor) { delegateHandler.handleResultRows(fromQuery, fields, tuples, cursor); } public void handleCommandStatus(String status, int updateCount, long insertOID) { delegateHandler.handleCommandStatus(status, updateCount, insertOID); } public void handleWarning(SQLWarning warning) { delegateHandler.handleWarning(warning); } public void handleError(SQLException error) { delegateHandler.handleError(error); } public void handleCompletion() throws SQLException { } }; for (int i = 0; i < queries.length; ++i) execute((V2Query)queries[i], (SimpleParameterList)parameters[i], handler, maxRows, flags); delegateHandler.handleCompletion(); }
V2Query query = (V2Query)createSimpleQuery(""); SimpleParameterList params = (SimpleParameterList)query.createParameterList(); sendQuery(query, params, "BEGIN"); processResults(query, handler, 0, 0); sendFastpathCall(fnid, (FastpathParameterList)parameters); return receiveFastpathResult();
public synchronized void processNotifies() throws SQLException { // Asynchronous notifies only arrive when we are not in a transaction if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) return; try { while (pgStream.hasMessagePending()) { int c = pgStream.ReceiveChar(); switch (c) { case 'A': // Asynchronous Notify receiveAsyncNotify(); break; case 'E': // Error Message throw receiveErrorMessage(); // break; case 'N': // Error Notification protoConnection.addWarning(receiveNotification()); break; default: throw new PSQLException(GT.tr("Unknown Response Type {0}.", new Character((char) c)), PSQLState.CONNECTION_FAILURE); } } } catch (IOException ioe) { throw new PSQLException(GT.tr("An I/O error occured while sending to the backend."), PSQLState.CONNECTION_FAILURE, ioe); } }
ProtocolConnectionImpl(PGStream pgStream, String user, String database, Logger logger) { this.pgStream = pgStream; this.user = user; this.database = database; this.logger = logger; this.executor = new QueryExecutorImpl(this, pgStream, logger); }
public synchronized void execute(Query[] queries, ParameterList[] parameters, ResultHandler handler, int maxRows, int fetchSize, int flags) throws SQLException { final ResultHandler delegateHandler = handler; handler = new ResultHandler() { public void handleResultRows(Query fromQuery, Field[] fields, Vector tuples, ResultCursor cursor) { delegateHandler.handleResultRows(fromQuery, fields, tuples, cursor); } public void handleCommandStatus(String status, int updateCount, long insertOID) { delegateHandler.handleCommandStatus(status, updateCount, insertOID); } public void handleWarning(SQLWarning warning) { delegateHandler.handleWarning(warning); } public void handleError(SQLException error) { delegateHandler.handleError(error); } public void handleCompletion() throws SQLException { } }; for (int i = 0; i < queries.length; ++i) execute((V2Query)queries[i], (SimpleParameterList)parameters[i], handler, maxRows, flags); delegateHandler.handleCompletion(); }
receiveAsyncNotify(); break; SQLException newError = receiveErrorMessage(); if (error == null) error = newError; protoConnection.addWarning(receiveNotification()); break;