void setStatementName(String statementName, short deallocateEpoch) { assert statementName != null : "statement name should not be null"; this.statementName = statementName; this.encodedStatementName = Utils.encodeUTF8(statementName); this.deallocateEpoch = deallocateEpoch; }
Portal(SimpleQuery query, String portalName) { this.query = query; this.portalName = portalName; this.encodedName = Utils.encodeUTF8(portalName); }
Portal(SimpleQuery query, String portalName) { this.query = query; this.portalName = portalName; this.encodedName = Utils.encodeUTF8(portalName); }
void setStatementName(String statementName) { this.statementName = statementName; this.encodedStatementName = Utils.encodeUTF8(statementName); }
int getV3Length(int index) { --index; // Null? if (paramValues[index] == NULL_OBJECT) { throw new IllegalArgumentException("can't getV3Length() on a null parameter"); } // Directly encoded? if (paramValues[index] instanceof byte[]) { return ((byte[]) paramValues[index]).length; } // Binary-format bytea? if (paramValues[index] instanceof StreamWrapper) { return ((StreamWrapper) paramValues[index]).getLength(); } // Already encoded? if (encoded[index] == null) { // Encode value and compute actual length using UTF-8. encoded[index] = Utils.encodeUTF8(paramValues[index].toString()); } return encoded[index].length; }
int getV3Length(int index) { --index; // Null? if (paramValues[index] == NULL_OBJECT) throw new IllegalArgumentException("can't getV3Length() on a null parameter"); // Directly encoded? if (paramValues[index] instanceof byte[]) return ((byte[])paramValues[index]).length; // Binary-format bytea? if (paramValues[index] instanceof StreamWrapper) return ((StreamWrapper)paramValues[index]).getLength(); // Already encoded? if (encoded[index] == null) { // Encode value and compute actual length using UTF-8. encoded[index] = Utils.encodeUTF8(paramValues[index].toString()); } return encoded[index].length; }
void writeV3Value(int index, PGStream pgStream) throws IOException { --index; // Null? if (paramValues[index] == NULL_OBJECT) { throw new IllegalArgumentException("can't writeV3Value() on a null parameter"); } // Directly encoded? if (paramValues[index] instanceof byte[]) { pgStream.send((byte[]) paramValues[index]); return; } // Binary-format bytea? if (paramValues[index] instanceof StreamWrapper) { streamBytea(pgStream, (StreamWrapper) paramValues[index]); return; } // Encoded string. if (encoded[index] == null) { encoded[index] = Utils.encodeUTF8((String) paramValues[index]); } pgStream.send(encoded[index]); }
void writeV3Value(int index, PGStream pgStream) throws IOException { --index; // Null? if (paramValues[index] == NULL_OBJECT) throw new IllegalArgumentException("can't writeV3Value() on a null parameter"); // Directly encoded? if (paramValues[index] instanceof byte[]) { pgStream.Send((byte[])paramValues[index]); return ; } // Binary-format bytea? if (paramValues[index] instanceof StreamWrapper) { streamBytea(pgStream, (StreamWrapper)paramValues[index]); return ; } // Encoded string. if (encoded[index] == null) encoded[index] = Utils.encodeUTF8((String)paramValues[index]); pgStream.Send(encoded[index]); }
private void sendCloseStatement(String statementName) throws IOException { // // Send Close. // LOGGER.log(Level.FINEST, " FE=> CloseStatement({0})", statementName); byte[] encodedStatementName = Utils.encodeUTF8(statementName); // Total size = 4 (size field) + 1 (close type, 'S') + N + 1 (statement name) pgStream.sendChar('C'); // Close pgStream.sendInteger4(4 + 1 + encodedStatementName.length + 1); // message size pgStream.sendChar('S'); // Close (Statement) pgStream.send(encodedStatementName); // statement to close pgStream.sendChar(0); // statement name terminator }
private void sendClosePortal(String portalName) throws IOException { // // Send Close. // LOGGER.log(Level.FINEST, " FE=> ClosePortal({0})", portalName); byte[] encodedPortalName = (portalName == null ? null : Utils.encodeUTF8(portalName)); int encodedSize = (encodedPortalName == null ? 0 : encodedPortalName.length); // Total size = 4 (size field) + 1 (close type, 'P') + 1 + N (portal name) pgStream.sendChar('C'); // Close pgStream.sendInteger4(4 + 1 + 1 + encodedSize); // message size pgStream.sendChar('P'); // Close (Portal) if (encodedPortalName != null) { pgStream.send(encodedPortalName); } pgStream.sendChar(0); // unnamed portal }
private void sendCloseStatement(String statementName) throws IOException { // // Send Close. // if (logger.logDebug()) { logger.debug(" FE=> CloseStatement(" + statementName + ")"); } byte[] encodedStatementName = Utils.encodeUTF8(statementName); // Total size = 4 (size field) + 1 (close type, 'S') + N + 1 (statement name) pgStream.SendChar('C'); // Close pgStream.SendInteger4(4 + 1 + encodedStatementName.length + 1); // message size pgStream.SendChar('S'); // Close (Statement) pgStream.Send(encodedStatementName); // statement to close pgStream.SendChar(0); // statement name terminator }
private void sendClosePortal(String portalName) throws IOException { // // Send Close. // if (logger.logDebug()) { logger.debug(" FE=> ClosePortal(" + portalName + ")"); } byte[] encodedPortalName = (portalName == null ? null : Utils.encodeUTF8(portalName)); int encodedSize = (encodedPortalName == null ? 0 : encodedPortalName.length); // Total size = 4 (size field) + 1 (close type, 'P') + 1 + N (portal name) pgStream.SendChar('C'); // Close pgStream.SendInteger4(4 + 1 + 1 + encodedSize); // message size pgStream.SendChar('P'); // Close (Portal) if (encodedPortalName != null) pgStream.Send(encodedPortalName); pgStream.SendChar(0); // unnamed portal }
Utils.encodeUTF8("The JDBC driver currently does not support COPY operations."); pgStream.sendChar('f'); pgStream.sendInteger4(buf.length + 4 + 1);
byte[] queryUtf8 = Utils.encodeUTF8(nativeSql);
/** * Sends given query to BE to start, initialize and lock connection for a CopyOperation. * * @param sql COPY FROM STDIN / COPY TO STDOUT statement * @return CopyIn or CopyOut operation object * @throws SQLException on failure */ public synchronized CopyOperation startCopy(String sql, boolean suppressBegin) throws SQLException { waitOnLock(); if (!suppressBegin) { doSubprotocolBegin(); } byte[] buf = Utils.encodeUTF8(sql); try { LOGGER.log(Level.FINEST, " FE=> Query(CopyStart)"); pgStream.sendChar('Q'); pgStream.sendInteger4(buf.length + 4 + 1); pgStream.send(buf); pgStream.sendChar(0); pgStream.flush(); return processCopyResults(null, true); // expect a CopyInResponse or CopyOutResponse to our query above } catch (IOException ioe) { throw new PSQLException(GT.tr("Database connection failed when starting copy"), PSQLState.CONNECTION_FAILURE, ioe); } }
parts[j] = Utils.encodeUTF8("$" + i); encodedSize += parts[j].length; ++j; parts[j] = Utils.encodeUTF8(fragments[i]); encodedSize += parts[j].length; ++j;
synchronized (this) { LOGGER.log(Level.FINEST, "FE => CopyFail"); final byte[] msg = Utils.encodeUTF8("Copy cancel requested"); pgStream.sendChar('f'); // CopyFail pgStream.sendInteger4(5 + msg.length);
/** * Sends given query to BE to start, initialize and lock connection for a CopyOperation. * @param sql COPY FROM STDIN / COPY TO STDOUT statement * @return CopyIn or CopyOut operation object * @throws SQLException on failure */ public synchronized CopyOperation startCopy(String sql, boolean suppressBegin) throws SQLException { waitOnLock(); if (!suppressBegin) { doSubprotocolBegin(); } byte buf[] = Utils.encodeUTF8(sql); try { if (logger.logDebug()) logger.debug(" FE=> Query(CopyStart)"); pgStream.SendChar('Q'); pgStream.SendInteger4(buf.length + 4 + 1); pgStream.Send(buf); pgStream.SendChar(0); pgStream.flush(); return processCopyResults(null, true); // expect a CopyInResponse or CopyOutResponse to our query above } catch(IOException ioe) { throw new PSQLException(GT.tr("Database connection failed when starting copy"), PSQLState.CONNECTION_FAILURE, ioe); } }
byte[] buf = Utils.encodeUTF8("The JDBC driver currently does not support COPY operations."); pgStream.SendChar('f'); pgStream.SendInteger4(buf.length + 4 + 1);
logger.debug("FE => CopyFail"); final byte[] msg = Utils.encodeUTF8("Copy cancel requested"); pgStream.SendChar('f'); // CopyFail pgStream.SendInteger4(5 + msg.length);