Codota Logo
Fastpath.fastpath
Code IndexAdd Codota to your IDE (free)

How to use
fastpath
method
in
org.postgresql.fastpath.Fastpath

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

  • Common ways to obtain Fastpath
private void myMethod () {
Fastpath f =
  • Codota IconBaseConnection baseConnection;baseConnection.getFastpathAPI()
  • Codota IconAbstractJdbc2Connection abstractJdbc2Connection;new Fastpath(abstractJdbc2Connection)
  • Smart code suggestions by Codota
}
origin: org.postgresql/postgresql

/**
 * This convenience method assumes that the return value is not an Integer.
 *
 * @param name Function name
 * @param args Function arguments
 * @return byte[] array containing result
 * @throws SQLException if a database-access error occurs or no result
 */
public byte[] getData(String name, FastpathArg[] args) throws SQLException {
 return fastpath(name, args);
}
origin: postgresql/postgresql

/**
 * This convenience method assumes that the return value is not an Integer
 * @param name Function name
 * @param args Function arguments
 * @return byte[] array containing result
 * @exception SQLException if a database-access error occurs or no result
 */
public byte[] getData(String name, FastpathArg[] args) throws SQLException
{
  return (byte[])fastpath(name, false, args);
}
origin: org.postgresql/postgresql

/**
 * This deletes a large object.
 *
 * @param oid describing object to delete
 * @throws SQLException on error
 */
public void delete(long oid) throws SQLException {
 FastpathArg[] args = new FastpathArg[1];
 args[0] = Fastpath.createOIDArg(oid);
 fp.fastpath("lo_unlink", args);
}
origin: postgresql/postgresql

/**
 * This deletes a large object.
 *
 * @param oid describing object to delete
 * @exception SQLException on error
 */
public void delete(long oid) throws SQLException
{
  FastpathArg args[] = new FastpathArg[1];
  args[0] = Fastpath.createOIDArg(oid);
  fp.fastpath("lo_unlink", false, args);
}
origin: postgresql/postgresql

/**
 * This convenience method assumes that the return value is an Integer
 * @param name Function name
 * @param args Function arguments
 * @return integer result
 * @exception SQLException if a database-access error occurs or no result
 */
public int getInteger(String name, FastpathArg[] args) throws SQLException
{
  Integer i = (Integer)fastpath(name, true, args);
  if (i == null)
    throw new PSQLException(GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", name),
                PSQLState.NO_DATA);
  return i.intValue();
}
origin: org.postgresql/postgresql

/**
 * @param name Function name
 * @param resulttype True if the result is a numeric (Integer or Long)
 * @param args FastpathArguments to pass to fastpath
 * @return null if no data, Integer if an integer result, Long if a long result, or byte[]
 *         otherwise
 * @throws SQLException if something goes wrong
 * @see #fastpath(int, FastpathArg[])
 * @see #fastpath(String, FastpathArg[])
 * @deprecated Use {@link #getData(String, FastpathArg[])} if you expect a binary result, or one
 *             of {@link #getInteger(String, FastpathArg[])} or
 *             {@link #getLong(String, FastpathArg[])} if you expect a numeric one
 */
@Deprecated
public Object fastpath(String name, boolean resulttype, FastpathArg[] args) throws SQLException {
 connection.getLogger().log(Level.FINEST, "Fastpath: calling {0}", name);
 return fastpath(getID(name), resulttype, args);
}
origin: org.postgresql/postgresql

/**
 * Writes an array to the object.
 *
 * @param buf array to write
 * @throws SQLException if a database-access error occurs.
 */
public void write(byte[] buf) throws SQLException {
 FastpathArg[] args = new FastpathArg[2];
 args[0] = new FastpathArg(fd);
 args[1] = new FastpathArg(buf);
 fp.fastpath("lowrite", args);
}
origin: org.postgresql/postgresql

/**
 * Writes some data from an array to the object.
 *
 * @param buf destination array
 * @param off offset within array
 * @param len number of bytes to write
 * @throws SQLException if a database-access error occurs.
 */
public void write(byte[] buf, int off, int len) throws SQLException {
 FastpathArg[] args = new FastpathArg[2];
 args[0] = new FastpathArg(fd);
 args[1] = new FastpathArg(buf, off, len);
 fp.fastpath("lowrite", args);
}
origin: postgresql/postgresql

/**
 * Writes an array to the object
 *
 * @param buf array to write
 * @exception SQLException if a database-access error occurs.
 */
public void write(byte buf[]) throws SQLException
{
  FastpathArg args[] = new FastpathArg[2];
  args[0] = new FastpathArg(fd);
  args[1] = new FastpathArg(buf);
  fp.fastpath("lowrite", false, args);
}
origin: org.postgresql/postgresql

/**
 * <p>Send a function call to the PostgreSQL backend by name.</p>
 *
 * <p>Note: the mapping for the procedure name to function id needs to exist, usually to an earlier
 * call to addfunction().</p>
 *
 * <p>This is the preferred method to call, as function id's can/may change between versions of the
 * backend.</p>
 *
 * <p>For an example of how this works, refer to org.postgresql.largeobject.LargeObject</p>
 *
 * @param name Function name
 * @param args FastpathArguments to pass to fastpath
 * @return null if no data, byte[] otherwise
 * @throws SQLException if name is unknown or if a database-access error occurs.
 * @see org.postgresql.largeobject.LargeObject
 */
public byte[] fastpath(String name, FastpathArg[] args) throws SQLException {
 connection.getLogger().log(Level.FINEST, "Fastpath: calling {0}", name);
 return fastpath(getID(name), args);
}
origin: postgresql/postgresql

/**
 * Writes some data from an array to the object
 *
 * @param buf destination array
 * @param off offset within array
 * @param len number of bytes to write
 * @exception SQLException if a database-access error occurs.
 */
public void write(byte buf[], int off, int len) throws SQLException
{
  FastpathArg args[] = new FastpathArg[2];
  args[0] = new FastpathArg(fd);
  args[1] = new FastpathArg(buf, off, len);
  fp.fastpath("lowrite", false, args);
}
origin: org.postgresql/postgresql

/**
 * Sets the current position within the object using 64-bit value (9.3+).
 *
 * @param pos position within object
 * @param ref Either SEEK_SET, SEEK_CUR or SEEK_END
 * @throws SQLException if a database-access error occurs.
 */
public void seek64(long pos, int ref) throws SQLException {
 FastpathArg[] args = new FastpathArg[3];
 args[0] = new FastpathArg(fd);
 args[1] = new FastpathArg(pos);
 args[2] = new FastpathArg(ref);
 fp.fastpath("lo_lseek64", args);
}
origin: org.postgresql/postgresql

/**
 * <p>Sets the current position within the object.</p>
 *
 * <p>This is similar to the fseek() call in the standard C library. It allows you to have random
 * access to the large object.</p>
 *
 * @param pos position within object
 * @param ref Either SEEK_SET, SEEK_CUR or SEEK_END
 * @throws SQLException if a database-access error occurs.
 */
public void seek(int pos, int ref) throws SQLException {
 FastpathArg[] args = new FastpathArg[3];
 args[0] = new FastpathArg(fd);
 args[1] = new FastpathArg(pos);
 args[2] = new FastpathArg(ref);
 fp.fastpath("lo_lseek", args);
}
origin: postgresql/postgresql

/**
 * Sets the current position within the object.
 *
 * <p>This is similar to the fseek() call in the standard C library. It
 * allows you to have random access to the large object.
 *
 * @param pos position within object
 * @param ref Either SEEK_SET, SEEK_CUR or SEEK_END
 * @exception SQLException if a database-access error occurs.
 */
public void seek(int pos, int ref) throws SQLException
{
  FastpathArg args[] = new FastpathArg[3];
  args[0] = new FastpathArg(fd);
  args[1] = new FastpathArg(pos);
  args[2] = new FastpathArg(ref);
  fp.fastpath("lo_lseek", false, args);
}
origin: org.postgresql/postgresql

/**
 * Send a function call to the PostgreSQL backend.
 *
 * @param fnId Function id
 * @param resultType True if the result is a numeric (Integer or Long)
 * @param args FastpathArguments to pass to fastpath
 * @return null if no data, Integer if an integer result, Long if a long result, or byte[]
 *         otherwise
 * @throws SQLException if a database-access error occurs.
 * @deprecated please use {@link #fastpath(int, FastpathArg[])}
 */
@Deprecated
public Object fastpath(int fnId, boolean resultType, FastpathArg[] args) throws SQLException {
 // Run it.
 byte[] returnValue = fastpath(fnId, args);
 // Interpret results.
 if (!resultType || returnValue == null) {
  return returnValue;
 }
 if (returnValue.length == 4) {
  return ByteConverter.int4(returnValue, 0);
 } else if (returnValue.length == 8) {
  return ByteConverter.int8(returnValue, 0);
 } else {
  throw new PSQLException(
    GT.tr("Fastpath call {0} - No result was returned and we expected a numeric.", fnId),
    PSQLState.NO_DATA);
 }
}
origin: postgresql/postgresql

fp.fastpath("lo_close", false, args); // true here as we dont care!!
closed = true;
origin: org.postgresql/postgresql

/**
 * This method closes the object. You must not call methods in this object after this is called.
 *
 * @throws SQLException if a database-access error occurs.
 */
public void close() throws SQLException {
 if (!closed) {
  // flush any open output streams
  if (os != null) {
   try {
    // we can't call os.close() otherwise we go into an infinite loop!
    os.flush();
   } catch (IOException ioe) {
    throw new PSQLException("Exception flushing output stream", PSQLState.DATA_ERROR, ioe);
   } finally {
    os = null;
   }
  }
  // finally close
  FastpathArg[] args = new FastpathArg[1];
  args[0] = new FastpathArg(fd);
  fp.fastpath("lo_close", args); // true here as we dont care!!
  closed = true;
  if (this.commitOnClose) {
   this.conn.commit();
  }
 }
}
origin: org.postgresql/postgresql

/**
 * This convenience method assumes that the return value is an integer.
 *
 * @param name Function name
 * @param args Function arguments
 * @return integer result
 * @throws SQLException if a database-access error occurs or no result
 */
public int getInteger(String name, FastpathArg[] args) throws SQLException {
 byte[] returnValue = fastpath(name, args);
 if (returnValue == null) {
  throw new PSQLException(
    GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", name),
    PSQLState.NO_DATA);
 }
 if (returnValue.length == 4) {
  return ByteConverter.int4(returnValue, 0);
 } else {
  throw new PSQLException(GT.tr(
    "Fastpath call {0} - No result was returned or wrong size while expecting an integer.",
    name), PSQLState.NO_DATA);
 }
}
origin: org.postgresql/postgresql

/**
 * This convenience method assumes that the return value is a long (bigint).
 *
 * @param name Function name
 * @param args Function arguments
 * @return long result
 * @throws SQLException if a database-access error occurs or no result
 */
public long getLong(String name, FastpathArg[] args) throws SQLException {
 byte[] returnValue = fastpath(name, args);
 if (returnValue == null) {
  throw new PSQLException(
    GT.tr("Fastpath call {0} - No result was returned and we expected a long.", name),
    PSQLState.NO_DATA);
 }
 if (returnValue.length == 8) {
  return ByteConverter.int8(returnValue, 0);
 } else {
  throw new PSQLException(
    GT.tr("Fastpath call {0} - No result was returned or wrong size while expecting a long.",
      name),
    PSQLState.NO_DATA);
 }
}
origin: postgresql/postgresql

/**
 * Send a function call to the PostgreSQL backend by name.
 *
 * Note: the mapping for the procedure name to function id needs to exist,
 * usually to an earlier call to addfunction().
 *
 * This is the prefered method to call, as function id's can/may change
 * between versions of the backend.
 *
 * For an example of how this works, refer to org.postgresql.largeobject.LargeObject
 *
 * @param name Function name
 * @param resulttype True if the result is an integer, false for other
 * results
 * @param args FastpathArguments to pass to fastpath
 * @return null if no data, Integer if an integer result, or byte[] otherwise
 * @exception SQLException if name is unknown or if a database-access error
 * occurs.
 * @see org.postgresql.largeobject.LargeObject
 */
public Object fastpath(String name, boolean resulttype, FastpathArg[] args) throws SQLException
{
  if (connection.getLogger().logDebug())
    connection.getLogger().debug("Fastpath: calling " + name);
  return fastpath(getID(name), resulttype, args);
}
org.postgresql.fastpathFastpathfastpath

Javadoc

Send a function call to the PostgreSQL backend

Popular methods of Fastpath

  • <init>
    Initialises the fastpath system
  • addFunctions
    This takes a ResultSet containing two columns. Column 1 contains the function name, Column 2 the oid
  • createOIDArg
    Creates a FastpathArg with an oid parameter. This is here instead of a constructor of FastpathArg be
  • getData
    This convenience method assumes that the return value is not an Integer
  • getID
    This returns the function id associated by its name.If addFunction() or addFunctions() have not been
  • getInteger
    This convenience method assumes that the return value is an Integer
  • getOID
    This convenience method assumes that the return value is an oid.
  • getLong
    This convenience method assumes that the return value is a long (bigint).

Popular in Java

  • Making http requests using okhttp
  • runOnUiThread (Activity)
  • addToBackStack (FragmentTransaction)
  • findViewById (Activity)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
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