Examples of PGConnection


Examples of com.impossibl.postgres.api.jdbc.PGConnection

  @Override
  public Connection getConnection() throws SQLException {
    if (logger.isLoggable(Level.FINE))
      debug("PGXAConnection.getConnection called");

    PGConnection c = (PGConnection)super.getConnection();

    // When we're outside an XA transaction, autocommit
    // is supposed to be true, per usual JDBC convention.
    // When an XA transaction is in progress, it should be
    // false.
View Full Code Here

Examples of org.postgresql.PGConnection

            col.setType(Types.INTEGER);
            DelegatingConnection conn = (DelegatingConnection)store
            .getConnection();
            try {
                conn.setAutoCommit(false);
                PGConnection pgconn = (PGConnection) conn.getInnermostDelegate();
                LargeObjectManager lom = pgconn.getLargeObjectAPI();
                // The create method is valid in versions previous 8.3
                // in 8.3 this methos is deprecated, use createLO
                int oid = lom.create();
                LargeObject lo = lom.open(oid, LargeObjectManager.WRITE);
                OutputStream os = lo.getOutputStream();
View Full Code Here

Examples of org.postgresql.PGConnection

                throw new InternalException(_loc.get("stream-exception"));
            }
            int oid = res.getInt(1);
            if (oid != -1) {
                conn.setAutoCommit(false);
                PGConnection pgconn = (PGConnection)conn
                    .getInnermostDelegate();
                LargeObjectManager lom = pgconn.getLargeObjectAPI();
                if (ob != null) {
                    LargeObject lo = lom.open(oid, LargeObjectManager.WRITE);
                    OutputStream os = lo.getOutputStream();
                    copy((InputStream)ob, os);
                    lo.close();
                } else {
                    lom.delete(oid);
                    row.setInt(col, -1);
                }
            } else {
                if (ob != null) {
                    conn.setAutoCommit(false);
                    PGConnection pgconn = (PGConnection)conn
                        .getInnermostDelegate();
                    LargeObjectManager lom = pgconn.getLargeObjectAPI();
                    oid = lom.create();
                    LargeObject lo = lom.open(oid, LargeObjectManager.WRITE);
                    OutputStream os = lo.getOutputStream();
                    copy((InputStream)ob, os);
                    lo.close();
View Full Code Here

Examples of org.postgresql.PGConnection

                throw new InternalException(_loc.get("stream-exception"));
            }
            int oid = res.getInt(1);
            if (oid != -1) {
                conn.setAutoCommit(false);
                PGConnection pgconn = (PGConnection)conn
                    .getInnermostDelegate();
                LargeObjectManager lom = pgconn.getLargeObjectAPI();
                lom.delete(oid);
            }
        } finally {
            if (res != null)
                try { res.close (); } catch (SQLException e) {}
View Full Code Here

Examples of org.postgresql.PGConnection

            col.setType(Types.INTEGER);
            DelegatingConnection conn = (DelegatingConnection)store
            .getConnection();
            try {
                conn.setAutoCommit(false);
                PGConnection pgconn = (PGConnection) conn.getInnermostDelegate();
                LargeObjectManager lom = pgconn.getLargeObjectAPI();
                // The create method is valid in versions previous 8.3
                // in 8.3 this methos is deprecated, use createLO
                int oid = lom.create();
                LargeObject lo = lom.open(oid, LargeObjectManager.WRITE);
                OutputStream os = lo.getOutputStream();
View Full Code Here

Examples of org.postgresql.PGConnection

                throw new InternalException(_loc.get("stream-exception"));
            }
            int oid = res.getInt(1);
            if (oid != -1) {
                conn.setAutoCommit(false);
                PGConnection pgconn = (PGConnection)conn
                    .getInnermostDelegate();
                LargeObjectManager lom = pgconn.getLargeObjectAPI();
                if (ob != null) {
                    LargeObject lo = lom.open(oid, LargeObjectManager.WRITE);
                    OutputStream os = lo.getOutputStream();
                    copy((InputStream)ob, os);
                    lo.close();
                } else {
                    lom.delete(oid);
                    row.setInt(col, -1);
                }
            } else {
                if (ob != null) {
                    conn.setAutoCommit(false);
                    PGConnection pgconn = (PGConnection)conn
                        .getInnermostDelegate();
                    LargeObjectManager lom = pgconn.getLargeObjectAPI();
                    oid = lom.create();
                    LargeObject lo = lom.open(oid, LargeObjectManager.WRITE);
                    OutputStream os = lo.getOutputStream();
                    copy((InputStream)ob, os);
                    lo.close();
View Full Code Here

Examples of org.postgresql.PGConnection

                throw new InternalException(_loc.get("stream-exception"));
            }
            int oid = res.getInt(1);
            if (oid != -1) {
                conn.setAutoCommit(false);
                PGConnection pgconn = (PGConnection)conn
                    .getInnermostDelegate();
                LargeObjectManager lom = pgconn.getLargeObjectAPI();
                lom.delete(oid);
            }
        } finally {
            if (res != null)
                try { res.close (); } catch (SQLException e) {}
View Full Code Here

Examples of org.postgresql.PGConnection

        }
    }

    private static LargeObjectManager extractManager(Connection conn) {
        try {
            PGConnection pgConn = conn instanceof PGConnection ? (PGConnection) conn : conn.unwrap(PGConnection.class);
            return pgConn.getLargeObjectAPI();
        } catch (SQLException e) {
            throw new BlobException("Cannot unwrap native postgres connection from: [" + conn + "]", e);
        }
    }
View Full Code Here

Examples of org.postgresql.PGConnection

            col.setType(Types.INTEGER);
            DelegatingConnection conn = (DelegatingConnection)store
            .getConnection();
            try {
                conn.setAutoCommit(false);
                PGConnection pgconn = (PGConnection)conn.getInnermostDelegate();
                LargeObjectManager lom = pgconn.getLargeObjectAPI();
                // The create method is valid in versions previous to 8.3
                // in 8.3 this method is deprecated, use createLO
                int oid = lom.create();
                LargeObject lo = lom.open(oid, LargeObjectManager.WRITE);
                OutputStream os = lo.getOutputStream();
View Full Code Here

Examples of org.postgresql.PGConnection

                throw new InternalException(_loc.get("stream-exception"));
            }
            int oid = res.getInt(1);
            if (oid != -1) {
                conn.setAutoCommit(false);
                PGConnection pgconn = (PGConnection)conn
                    .getInnermostDelegate();
                LargeObjectManager lom = pgconn.getLargeObjectAPI();
                if (ob != null) {
                    LargeObject lo = lom.open(oid, LargeObjectManager.WRITE);
                    OutputStream os = lo.getOutputStream();
                    copy((InputStream)ob, os);
                    lo.close();
                } else {
                    lom.delete(oid);
                    row.setInt(col, -1);
                }
            } else {
                if (ob != null) {
                    conn.setAutoCommit(false);
                    PGConnection pgconn = (PGConnection)conn
                        .getInnermostDelegate();
                    LargeObjectManager lom = pgconn.getLargeObjectAPI();
                    oid = lom.create();
                    LargeObject lo = lom.open(oid, LargeObjectManager.WRITE);
                    OutputStream os = lo.getOutputStream();
                    copy((InputStream)ob, os);
                    lo.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.