Project:dool
Class List Class Hierarchy
Summary: Ctors Methods

Module dool.sql.dpq.DPQExec

Class DPQExec

Implemented interfaces:
Statement
public class DPQExec

DPQExec sendSome

Constructor Summary
public (DPQConnect connect)
          Creates a new DPQExec

Methods Summary
void begin()
          
void rollback()
          
void commit()
          
static String escapeString(String str)
          Quoting strings before inclusion in queries.
String errorMessage()
          
String escapeBytea(String bintext, int length)
          Quoting bytes before inclusion in queries.
String unescapeBytea(String strtext)
          UnQuoting bytes.
int execute(char statement)
          
int execute(String statement)
          
DPQResult exec(char query)
          execute simple synchronous query
DPQResult exec(String query)
          
PGnotify* notifies()
          Notifies \todo do we need a Notify class ???
void freeNotify(PGnotify* notify)
          Frees a struct got from notifies
int prepare(char statement)
          
int prepare(String statement)
          
bit sendQuery(String query)
          /* Interface for multiple-result or asynchronous queries sendQuery Submit a command to the server without waiting for the result(s).
DPQResult getResult()
          Wait for the next result from a prior sendQuery, and return it.
ResultSet getResultSet(char statement)
          
ResultSet getResultSet(String statement)
          
bit isBusy()
          Returns true if a query is busy, that is, getResult would block waiting for input.
int consumeInput()
          If input is available from the backend, consume it.
int finish()
          
int getLine(String string, int length)
          /* Routines for copy in/out Get line
int putLine(String string)
          putLine
int getLineAsync(String buffer, int bufsize)
          getLineAsync
int putNBytes(String buffer, int nbytes)
          put n bytes
int endCopy()
          end copy
int setNonBlocking(bit arg)
          /* Set blocking/nonblocking connection to the backend Sets the state of the connection to nonblocking if arg is 1, blocking if arg is 0.
bit isNonBlocking()
          Returns the blocking status of the database connection.
int flush()
          /* Force the write buffer to be written (or at least try) Attempt to flush any data queued to the backend, PQflush needs to be called on a nonblocking connection before calling select() to determine if a response has arrived.


public this (DPQConnect connect)
/** * Creates a new DPQExec * @param connect the database connection */
void begin()

void rollback()

void commit()

static String escapeString(String str)
/** * Quoting strings before inclusion in queries. * @param str * @return the new string */
String errorMessage()

String escapeBytea(String bintext, int length)
/** * Quoting bytes before inclusion in queries. * @param bintext * @param length * @return */
String unescapeBytea(String strtext)
/** * UnQuoting bytes. * @param strtext * @return */
int execute(char[] statement)

int execute(String statement)

DPQResult exec(char[] query)
/** * execute simple synchronous query * @param query the query text * @return a new DPQResult */
DPQResult exec(String query)

PGnotify* notifies()
/** * Notifies * \todo do we need a Notify class ??? * @return a pointer to a PGnotify struct *///????????????? how came these guys are not in the connect ????????
void freeNotify(PGnotify* notify)
/** * Frees a struct got from notifies * @see notifies() * @param notify the PGnotify pointer */
int prepare(char[] statement)

int prepare(String statement)

bit sendQuery(String query)
/* Interface for multiple-result or asynchronous queries */ /** * sendQuery Submit a command to the server without waiting for the result(s). * 1 is returned if the command was successfully dispatched, 0 if not * (in which case, use PQerrorMessage to get more information about the failure). * After successfully calling PQsendQuery, call PQgetResult one or more times to obtain the results. * PQsendQuery may not be called again (on the same connection) until PQgetResult has returned NULL, * indicating that the command is done. * @param query * @return true if the command was successfully dispatched, false if not * \throw and error on busy instead of returning false */
DPQResult getResult()
/** * Wait for the next result from a prior sendQuery, and return it. * null is returned when the query is complete and there will be no more results. * PQgetResult must be called repeatedly until it returns null, * indicating that the command is done. * (If called when no command is active, PQgetResult will just return NULL at once.) * Each non-NULL result from PQgetResult should be processed using the same PGresult * accessor functions previously described. Don't forget to free each result object * with PQclear when done with it. Note that PQgetResult will block only if a query * is active and the necessary response data has not yet been read by PQconsumeInput. * @return the result or null if no more results */
ResultSet getResultSet(char[] statement)

ResultSet getResultSet(String statement)

bit isBusy()
/** * Returns true if a query is busy, that is, getResult would block waiting for input. * A false return indicates that PQgetResult can be called with assurance of not blocking. * @return true is busy false otherwise */
int consumeInput()
/** * If input is available from the backend, consume it. * PQconsumeInput normally returns 1 indicating "no error", but returns 0 if there was * some kind of trouble (in which case PQerrorMessage is set). Note that the result does * not say whether any input data was actually collected. After calling PQconsumeInput, * the application may check PQisBusy and/or PQnotifies to see if their state has changed. * PQconsumeInput may be called even if the application is not prepared to deal with a result * or notification just yet. The routine will read available data and save it in a buffer, * thereby causing a select() read-ready indication to go away. * The application can thus use PQconsumeInput to clear the select() condition immediately, * and then examine the results at leisure. * @return */
int finish()

int getLine(String string, int length)
/* Routines for copy in/out */ /** * Get line * @param string * @param length * @return */
int putLine(String string)
/** * putLine * @param string * @return */
int getLineAsync(String buffer, int bufsize)
/** * getLineAsync * @param buffer * @param bufsize * @return */
int putNBytes(String buffer, int nbytes)
/** * put n bytes * @param buffer * @param nbytes * @return */
int endCopy()
/** * end copy * @return */
int setNonBlocking(bit arg)
/* Set blocking/nonblocking connection to the backend */ /** * Sets the state of the connection to nonblocking if arg is 1, blocking if arg is 0. * Returns 0 if OK, -1 if error. * In the nonblocking state, calls to PQputline, PQputnbytes, PQsendQuery and PQendcopy * will not block but instead return an error if they need to be called again. * When a database connection has been set to nonblocking mode and PQexec is called, * it will temporarily set the state of the connection to blocking until the PQexec completes. * @param arg nonblocking if arg is true, blocking if arg is false. * @return 0 if OK, -1 if error. */
bit isNonBlocking()
/** * Returns the blocking status of the database connection. * @return true if the connection is set to nonblocking mode, false if blocking. */
int flush()
/* Force the write buffer to be written (or at least try) */ /** * Attempt to flush any data queued to the backend, * PQflush needs to be called on a nonblocking connection before calling select() * to determine if a response has arrived. * If 0 is returned it ensures that there is no data queued to the backend * that has not actually been sent. * Only applications that have used PQsetnonblocking have a need for this. * @return 0 if successful (or if the send queue is empty) or EOF if it failed for some reason. */