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

How to use
Fastpath
in
org.postgresql.fastpath

Best Java code snippets using org.postgresql.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

public Fastpath getFastpathAPI() throws SQLException {
 checkClosed();
 if (fastpath == null) {
  fastpath = new Fastpath(this);
 }
 return fastpath;
}
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: org.postgresql/postgresql

/**
 * Reads some data from the object, and return as a byte[] array.
 *
 * @param len number of bytes to read
 * @return byte[] array containing data read
 * @throws SQLException if a database-access error occurs.
 */
public byte[] read(int len) throws SQLException {
 // This is the original method, where the entire block (len bytes)
 // is retrieved in one go.
 FastpathArg[] args = new FastpathArg[2];
 args[0] = new FastpathArg(fd);
 args[1] = new FastpathArg(len);
 return fp.getData("loread", args);
}
origin: postgresql/postgresql

/**
 * This opens a large object.
 *
 * <p>If the object does not exist, then an SQLException is thrown.
 *
 * @param fp FastPath API for the connection to use
 * @param oid of the Large Object to open
 * @param mode Mode of opening the large object
 * (defined in LargeObjectManager)
 * @exception SQLException if a database-access error occurs.
 * @see org.postgresql.largeobject.LargeObjectManager
 */
protected LargeObject(Fastpath fp, long oid, int mode) throws SQLException
{
  this.fp = fp;
  this.oid = oid;
  this.mode = mode;
  FastpathArg args[] = new FastpathArg[2];
  args[0] = Fastpath.createOIDArg(oid);
  args[1] = new FastpathArg(mode);
  this.fd = fp.getInteger("lo_open", args);
}
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

/**
 * 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 an oid.
 * @param name Function name
 * @param args Function arguments
 * @exception SQLException if a database-access error occurs or no result
 */
public long getOID(String name, FastpathArg[] args) throws SQLException
{
  long oid = getInteger(name, args);
  if (oid < 0)
    oid += NUM_OIDS;
  return oid;
}
origin: org.postgresql/postgresql

/**
 * This creates a large object, returning its OID.
 *
 * @param mode a bitmask describing different attributes of the new object
 * @return oid of new object
 * @throws SQLException on error
 */
public long createLO(int mode) throws SQLException {
 if (conn.getAutoCommit()) {
  throw new PSQLException(GT.tr("Large Objects may not be used in auto-commit mode."),
    PSQLState.NO_ACTIVE_SQL_TRANSACTION);
 }
 FastpathArg[] args = new FastpathArg[1];
 args[0] = new FastpathArg(mode);
 return fp.getOID("lo_creat", args);
}
origin: org.postgresql/postgresql

fp.addFunctions(res);
res.close();
stmt.close();
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

/**
 * <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: org.postgresql/postgresql

/**
 * <p>This opens a large object.</p>
 *
 * <p>If the object does not exist, then an SQLException is thrown.</p>
 *
 * @param fp FastPath API for the connection to use
 * @param oid of the Large Object to open
 * @param mode Mode of opening the large object
 * @param conn the connection to the database used to access this LOB
 * @param commitOnClose commit the transaction when this LOB will be closed (defined in
 *        LargeObjectManager)
 * @throws SQLException if a database-access error occurs.
 * @see org.postgresql.largeobject.LargeObjectManager
 */
protected LargeObject(Fastpath fp, long oid, int mode, BaseConnection conn, boolean commitOnClose)
  throws SQLException {
 this.fp = fp;
 this.oid = oid;
 this.mode = mode;
 if (commitOnClose) {
  this.commitOnClose = true;
  this.conn = conn;
 } else {
  this.commitOnClose = false;
 }
 FastpathArg[] args = new FastpathArg[2];
 args[0] = Fastpath.createOIDArg(oid);
 args[1] = new FastpathArg(mode);
 this.fd = fp.getInteger("lo_open", args);
}
origin: org.postgresql/postgresql

/**
 * This convenience method assumes that the return value is an oid.
 *
 * @param name Function name
 * @param args Function arguments
 * @return oid of the given call
 * @throws SQLException if a database-access error occurs or no result
 */
public long getOID(String name, FastpathArg[] args) throws SQLException {
 long oid = getInteger(name, args);
 if (oid < 0) {
  oid += NUM_OIDS;
 }
 return oid;
}
origin: postgresql/postgresql

/**
 * This creates a large object, returning its OID
 *
 * @param mode a bitmask describing different attributes of the new object
 * @return oid of new object
 * @exception SQLException on error
 */
public long createLO(int mode) throws SQLException
{
  if (conn.getAutoCommit())
    throw new PSQLException(GT.tr("Large Objects may not be used in auto-commit mode."),
                PSQLState.NO_ACTIVE_SQL_TRANSACTION);
  FastpathArg args[] = new FastpathArg[1];
  args[0] = new FastpathArg(mode);
  return fp.getOID("lo_creat", args);
}
origin: postgresql/postgresql

  throw new PSQLException(GT.tr("Failed to initialize LargeObject API"), PSQLState.SYSTEM_ERROR);
fp.addFunctions(res);
res.close();
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: 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);
}
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: org.ancoron.postgresql/org.postgresql

/**
 * This opens a large object.
 *
 * <p>If the object does not exist, then an SQLException is thrown.
 *
 * @param fp FastPath API for the connection to use
 * @param oid of the Large Object to open
 * @param mode Mode of opening the large object
 * (defined in LargeObjectManager)
 * @exception SQLException if a database-access error occurs.
 * @see org.postgresql.largeobject.LargeObjectManager
 */
protected LargeObject(Fastpath fp, long oid, int mode) throws SQLException
{
  this.fp = fp;
  this.oid = oid;
  this.mode = mode;
  FastpathArg args[] = new FastpathArg[2];
  args[0] = Fastpath.createOIDArg(oid);
  args[1] = new FastpathArg(mode);
  this.fd = fp.getInteger("lo_open", args);
}
origin: org.postgresql/postgresql

/**
 * @return the current position within the object
 * @throws SQLException if a database-access error occurs.
 */
public int tell() throws SQLException {
 FastpathArg[] args = new FastpathArg[1];
 args[0] = new FastpathArg(fd);
 return fp.getInteger("lo_tell", args);
}
org.postgresql.fastpathFastpath

Javadoc

This class implements the Fastpath api.

This is a means of executing functions embedded in the backend from within a java application.

It is based around the file src/interfaces/libpq/fe-exec.c

Most used methods

  • <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
  • fastpath
    Send a function call to the PostgreSQL backend by name. Note: the mapping for the procedure name to
  • 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

  • Running tasks concurrently on multiple threads
  • compareTo (BigDecimal)
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • JTable (javax.swing)
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