Codota Logo
org.postgresql.core.v2
Code IndexAdd Codota to your IDE (free)

How to use org.postgresql.core.v2

Best Java code snippets using org.postgresql.core.v2 (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: postgresql/postgresql

public void handleWarning(SQLWarning warning) {
  // we don't want to ignore warnings and it would be tricky
  // to chain them back to the connection, so since we don't
  // expect to get them in the first place, we just consider
  // them errors.
  handleError(warning);
}
origin: postgresql/postgresql

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);
}
origin: postgresql/postgresql

public ParameterList createParameterList() {
  if (fragments.length == 1)
    return NO_PARAMETERS;
  return new SimpleParameterList(fragments.length - 1, useEStringSyntax);
}
origin: postgresql/postgresql

public synchronized byte[]
fastpathCall(int fnid, ParameterList parameters, boolean suppressBegin) throws SQLException {
  if (protoConnection.getTransactionState() == ProtocolConnection.TRANSACTION_IDLE && !suppressBegin)
      V2Query query = (V2Query)createSimpleQuery("");
      SimpleParameterList params = (SimpleParameterList)query.createParameterList();
      sendQuery(query, params, "BEGIN");
      processResults(query, handler, 0, 0);
    sendFastpathCall(fnid, (FastpathParameterList)parameters);
    return receiveFastpathResult();
origin: postgresql/postgresql

  parameters = (SimpleParameterList)query.createParameterList();
parameters.checkAllParametersSet();
if (protoConnection.getTransactionState() == ProtocolConnection.TRANSACTION_IDLE &&
    (flags & QueryExecutor.QUERY_SUPPRESS_BEGIN) == 0)
  sendQuery(query, parameters, queryPrefix);
  processResults(query, handler, maxRows, flags);
  protoConnection.close();
  handler.handleError(new PSQLException(GT.tr("An I/O error occured while sending to the backend."), PSQLState.CONNECTION_FAILURE, e));
origin: postgresql/postgresql

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);
  }
}
origin: postgresql/postgresql

protected void sendQuery(V2Query query, SimpleParameterList params, String queryPrefix) throws IOException {
  if (logger.logDebug())
    logger.debug(" FE=> Query(\"" + (queryPrefix == null ? "" : queryPrefix) + query.toString(params) + "\")");
  pgStream.SendChar('Q');
  Writer encodingWriter = pgStream.getEncodingWriter();
  if (queryPrefix != null)
    encodingWriter.write(queryPrefix);
  String[] fragments = query.getFragments();
  for (int i = 0 ; i < fragments.length; ++i)
  {
    encodingWriter.write(fragments[i]);
    if (i < params.getParameterCount())
      params.writeV2Value(i + 1, encodingWriter);
  }
  encodingWriter.write(0);
  pgStream.flush();
}
origin: postgresql/postgresql

private void sendFastpathCall(int fnid, FastpathParameterList params) throws IOException {
  // Send call.
  int count = params.getParameterCount();
  if (logger.logDebug())
    logger.debug(" FE=> FastpathCall(fnid=" + fnid + ",paramCount=" + count + ")");
  pgStream.SendChar('F');
  pgStream.SendChar(0);
  pgStream.SendInteger4(fnid);
  pgStream.SendInteger4(count);
  for (int i = 1; i <= count; ++i)
    params.writeV2FastpathValue(i, pgStream);
  pgStream.flush();
}
origin: postgresql/postgresql

public Query createSimpleQuery(String sql) {
  return new V2Query(sql, false, protoConnection);
}
origin: postgresql/postgresql

public void setIntParameter(int index, int value) throws SQLException {
  setLiteralParameter(index, "" + value, Oid.INT4);
}
origin: postgresql/postgresql

public ParameterList createFastpathParameters(int count) {
  return new FastpathParameterList(count);
}
origin: postgresql/postgresql

void writeV2Value(int index, Writer encodingWriter) throws IOException {
  if (paramValues[index - 1] instanceof StreamWrapper)
  {
    streamBytea((StreamWrapper)paramValues[index - 1], encodingWriter);
  }
  else
  {
    encodingWriter.write((String)paramValues[index - 1]);
  }
}
origin: postgresql/postgresql

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();
}
origin: postgresql/postgresql

public void handleCommandStatus(String status, int updateCount, long insertOID) {
  if (!sawBegin)
  {
    if (!status.equals("BEGIN"))
      handleError(new PSQLException(GT.tr("Expected command status BEGIN, got {0}.", status),
                     PSQLState.PROTOCOL_VIOLATION));
    sawBegin = true;
  }
  else
  {
    delegateHandler.handleCommandStatus(status, updateCount, insertOID);
  }
}
origin: postgresql/postgresql

private void receiveAsyncNotify() throws IOException {
  int pid = pgStream.ReceiveInteger4();
  String msg = pgStream.ReceiveString();
  if (logger.logDebug())
    logger.debug(" <=BE AsyncNotify(pid=" + pid + ",msg=" + msg + ")");
  protoConnection.addNotification(new org.postgresql.core.Notification(msg, pid));
}
origin: postgresql/postgresql

public void handleCommandStatus(String status, int updateCount, long insertOID) {
  if (!sawBegin)
  {
    if (!status.equals("BEGIN"))
      handleError(new PSQLException(GT.tr("Expected command status BEGIN, got {0}.", status),
                     PSQLState.PROTOCOL_VIOLATION));
    sawBegin = true;
  }
  else
  {
    handleError(new PSQLException(GT.tr("Unexpected command status: {0}.", status),
                   PSQLState.PROTOCOL_VIOLATION));
  }
}
origin: postgresql/postgresql

public ParameterList copy() {
  SimpleParameterList newCopy = new SimpleParameterList(paramValues.length, useEStringSyntax);
  System.arraycopy(paramValues, 0, newCopy.paramValues, 0, paramValues.length);
  return newCopy;
}
origin: postgresql/postgresql

public Query createParameterizedQuery(String sql) {
  return new V2Query(sql, true, protoConnection);
}
origin: postgresql/postgresql

public void setStringParameter(int index, String value, int oid) throws SQLException {
  StringBuffer sbuf = new StringBuffer(2 + value.length() * 11 / 10); // Add 10% for escaping.
  if (useEStringSyntax)
    sbuf.append(' ').append('E');
  sbuf.append('\'');
  Utils.appendEscapedLiteral(sbuf, value, false);
  sbuf.append('\'');
  setLiteralParameter(index, sbuf.toString(), oid);
}
origin: postgresql/postgresql

public ParameterList copy() {
  FastpathParameterList newCopy = new FastpathParameterList(paramValues.length);
  System.arraycopy(paramValues, 0, newCopy.paramValues, 0, paramValues.length);
  return newCopy;
}
org.postgresql.core.v2

Most used classes

  • ConnectionFactoryImpl
    ConnectionFactory implementation for version 2 (pre-7.4) connections.
  • FastpathParameterList
    Implementation of fastpath parameter lists for the V2 protocol. The V2 protocol expects different re
  • ProtocolConnectionImpl
    V2 implementation of ProtocolConnection.
  • QueryExecutorImpl$1
  • QueryExecutorImpl$3
  • SimpleParameterList,
  • V2Query,
  • ConnectionFactoryImpl$SimpleResultHandler
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now