Codota Logo
ProtocolConnection
Code IndexAdd Codota to your IDE (free)

How to use
ProtocolConnection
in
org.postgresql.core

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

  • Common ways to obtain ProtocolConnection
private void myMethod () {
ProtocolConnection p =
  • Codota IconString host;String user;String database;Properties info;Logger logger;ConnectionFactory.openConnection(host, port, user, database, info, logger)
  • Codota IconConnectionFactory connectionFactory;String host;String user;String database;Properties info;Logger logger;connectionFactory.openConnectionImpl(host, port, user, database, info, logger)
  • Smart code suggestions by Codota
}
origin: postgresql/postgresql

/**
 * In some cases, it is desirable to immediately release a Connection's
 * database and JDBC resources instead of waiting for them to be
 * automatically released.
 *
 * <B>Note:</B> A Connection is automatically closed when it is
 * garbage collected.  Certain fatal errors also result in a closed
 * connection.
 *
 * @exception SQLException if a database access error occurs
 */
public void close()
{
  protoConnection.close();
  openStackTrace = null;
}
origin: postgresql/postgresql

public String getCatalog() throws SQLException
{
  checkClosed();
  return protoConnection.getDatabase();
}
origin: postgresql/postgresql

public Encoding getEncoding() {
  return protoConnection.getEncoding();
}
origin: postgresql/postgresql

private void runInitialQueries(ProtocolConnection protoConnection, Properties info, Logger logger) throws SQLException
{
  String dbVersion = protoConnection.getServerVersion();
  if (dbVersion.compareTo("9.0") >= 0) {
    SetupQueryRunner.run(protoConnection, "SET extra_float_digits = 3", false);
  }
  String appName = info.getProperty("ApplicationName");
  if (appName != null && dbVersion.compareTo("9.0") >= 0) {
    StringBuffer sql = new StringBuffer();
    sql.append("SET application_name = '");
    Utils.appendEscapedLiteral(sql, appName, protoConnection.getStandardConformingStrings());
    sql.append("'");
    SetupQueryRunner.run(protoConnection, sql.toString(), false);
  }
}
origin: postgresql/postgresql

public int getTransactionState() {
  return protoConnection.getTransactionState();
}
origin: postgresql/postgresql

public boolean getStandardConformingStrings() {
  return protoConnection.getStandardConformingStrings();
}
origin: postgresql/postgresql

public QueryExecutor getQueryExecutor() {
  return protoConnection.getQueryExecutor();
}
origin: postgresql/postgresql

public int getProtocolVersion()
{
  return protoConnection.getProtocolVersion();
}
origin: postgresql/postgresql

public String getUserName() throws SQLException
{
  return protoConnection.getUser();
}
origin: postgresql/postgresql

public PGNotification[] getNotifications() throws SQLException
{
  checkClosed();
  getQueryExecutor().processNotifies();
  // Backwards-compatibility hand-holding.
  PGNotification[] notifications = protoConnection.getNotifications();
  return (notifications.length == 0 ? null : notifications);
}
origin: postgresql/postgresql

this.dbVersionNumber = protoConnection.getServerVersion();
this.compatible = info.getProperty("compatible", Driver.MAJORVERSION + "." + Driver.MINORVERSION);
origin: postgresql/postgresql

V2Query(String query, boolean withParameters, ProtocolConnection pconn) {
  useEStringSyntax = pconn.getServerVersion() != null
      && pconn.getServerVersion().compareTo("8.1") > 0;
  boolean stdStrings = pconn.getStandardConformingStrings();
origin: postgresql/postgresql

public void rollback() throws SQLException
{
  checkClosed();
  if (autoCommit)
    throw new PSQLException(GT.tr("Cannot rollback when autoCommit is enabled."),
                PSQLState.NO_ACTIVE_SQL_TRANSACTION);
  if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE)
    executeTransactionCommand(rollbackQuery);
}
origin: postgresql/postgresql

public String escapeString(String str) throws SQLException {
  return Utils.appendEscapedLiteral(null, str,
      protoConnection.getStandardConformingStrings()).toString();
}
origin: postgresql/postgresql

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

public int getProtocolVersion()
{
  return protoConnection.getProtocolVersion();
}
origin: org.ancoron.postgresql/org.postgresql

public String getUserName() throws SQLException
{
  return protoConnection.getUser();
}
origin: org.ancoron.postgresql/org.postgresql.osgi

public PGNotification[] getNotifications() throws SQLException
{
  getQueryExecutor().processNotifies();
  // Backwards-compatibility hand-holding.
  PGNotification[] notifications = protoConnection.getNotifications();
  return (notifications.length == 0 ? null : notifications);
}
origin: org.ancoron.postgresql/org.postgresql.osgi

this.dbVersionNumber = protoConnection.getServerVersion();
this.compatible = info.getProperty("compatible", Driver.MAJORVERSION + "." + Driver.MINORVERSION);
origin: org.ancoron.postgresql/org.postgresql

private void runInitialQueries(ProtocolConnection protoConnection, Properties info, Logger logger) throws SQLException
{
  String dbVersion = protoConnection.getServerVersion();
  if (dbVersion.compareTo("9.0") >= 0) {
    SetupQueryRunner.run(protoConnection, "SET extra_float_digits = 3", false);
  }
  String appName = info.getProperty("ApplicationName");
  if (appName != null && dbVersion.compareTo("9.0") >= 0) {
    StringBuffer sql = new StringBuffer();
    sql.append("SET application_name = '");
    Utils.appendEscapedLiteral(sql, appName, protoConnection.getStandardConformingStrings());
    sql.append("'");
    SetupQueryRunner.run(protoConnection, sql.toString(), false);
  }
}
org.postgresql.coreProtocolConnection

Javadoc

Provides access to protocol-level connection operations.

Most used methods

  • close
    Close this connection cleanly.
  • getDatabase
  • getEncoding
  • getNotifications
    Retrieve and clear the set of asynchronous notifications pending on this connection.
  • getProtocolVersion
  • getQueryExecutor
  • getServerVersion
  • getStandardConformingStrings
    Returns whether the server treats string-literals according to the SQL standard or if it uses tradit
  • getTransactionState
    Get the current transaction state of this connection.
  • getUser
  • getWarnings
    Retrieve and clear the chain of warnings accumulated on this connection.
  • isClosed
    Check if this connection is closed.
  • getWarnings,
  • isClosed,
  • sendQueryCancel

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • setContentView (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Collectors (java.util.stream)
  • JPanel (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
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