jxDBCon 0.9z

org.sourceforge.jxdbcon.postgresql
Class LibProtocol

java.lang.Object
  |
  +--org.sourceforge.jxutil.JNI
        |
        +--org.sourceforge.jxutil.SCCI
              |
              +--org.sourceforge.jxdbcon.postgresql.LibPQ
                    |
                    +--org.sourceforge.jxdbcon.postgresql.LibProtocol
All Implemented Interfaces:
InfoKeys, LibPQConstants, PGInfoKeys, PGProtocol

public final class LibProtocol
extends LibPQ
implements PGProtocol, PGInfoKeys

This class implements PGProtocol via native calls to libPQ. At runtime it binds to libpq, which must be locatable by the system's link loader.
The driver currently uses the simpler, blocking, functions of libPQ.

Version:
$Revision: 1.10 $
Author:
Keve Müller

Field Summary
private  InputStream copyInStream
          The InputStream for COPY IN data.
private  OutputStream copyOutStream
          The OutputStream for COPY OUT data.
private  String messageEncoding
          The message encoding.
private  ArrayList noticeList
          The buffer to store the notices in.
private  int pgconn
          The PGconn* handle.
 
Fields inherited from class org.sourceforge.jxdbcon.postgresql.LibPQ
 
Fields inherited from class org.sourceforge.jxutil.JNI
loaded
 
Fields inherited from interface org.sourceforge.jxdbcon.postgresql.PGInfoKeys
FORCECLIENTENC, OPTIONS, PROTOVERSION, SETTIMEZONE, STRICTSCHEMA, TTY, USEASYNC, USECLIENTENC, USEDBENC, USESSL
 
Fields inherited from interface org.sourceforge.jxdbcon.InfoKeys
CATALOG, DESCRIPTION, DRIVER, HOST, PASSWORD, PORT, SUBDRIVER, USER
 
Fields inherited from interface org.sourceforge.jxdbcon.postgresql.LibPQConstants
CONNECTION_AUTH_OK, CONNECTION_AWAITING_RESPONSE, CONNECTION_BAD, CONNECTION_MADE, CONNECTION_OK, CONNECTION_SETENV, CONNECTION_STARTED, PGRES_BAD_RESPONSE, PGRES_COMMAND_OK, PGRES_COPY_IN, PGRES_COPY_OUT, PGRES_EMPTY_QUERY, PGRES_FATAL_ERROR, PGRES_NONFATAL_ERROR, PGRES_POLLING_ACTIVE, PGRES_POLLING_FAILED, PGRES_POLLING_OK, PGRES_POLLING_READING, PGRES_POLLING_WRITING, PGRES_TUPLES_OK
 
Constructor Summary
LibProtocol()
           
 
Method Summary
 void close()
          Close the connection to the backend.
 void connect(Properties info)
          Open the connection.
private  void discardCopyOut()
           
private  void doCopyOut()
           
 PGFuncResult exec(long funcOid, byte[][] args)
          Not implemented....
 PGExecResult exec(String sql)
          Execute a SQL command.
 void requestCancel()
          Request cancellation of current statement.
 void setCopyInStream(InputStream in)
          Accessor function for COPY IN
 void setCopyOutStream(OutputStream copyOutStream)
          Accessor function for COPY OUT
 void setMessageEncoding(String messageEncoding)
          Set the encoding to use for stringifying backend messages.
 
Methods inherited from class org.sourceforge.jxdbcon.postgresql.LibPQ
PQbackendPID, PQbinaryTuples, PQclear, PQclientEncoding, PQcmdStatus, PQcmdTuples, PQconnectdb, PQconnectPoll, PQconnectStart, PQdb, PQendcopy, PQerrorMessage, PQexec, PQfinish, PQfmod, PQfn, PQfname, PQfnumber, PQfsize, PQftype, PQgetisnull, PQgetlength, PQgetline, PQgetResult, PQgetvalue, PQhost, PQnfields, PQntuples, PQoidStatus, PQoptions, PQpass, PQport, PQputline, PQputnbytes, PQrequestCancel, PQreset, PQresStatus, PQresultErrorMessage, PQresultStatus, PQsendQuery, PQsetClientEncoding, PQsetNoticeProcessor, PQstatus, PQtrace, PQtty, PQuntrace, PQuser
 
Methods inherited from class org.sourceforge.jxutil.SCCI
call_D_d, call_I_i, call_I_T, call_II_i, call_II_T, call_III_i, call_III_Y, call_IIyiiiyi_i, call_IIyiiyil_i, call_IIyyIyI_i, call_IT_i, call_Iy_i, call_IyI_i, call_IYIIi_i, call_T_i, call_TT_i, call_V_i, dlclose, dlopen, dlsym, makeCallbackS, makeCallbackV, testHandler, toByteArray, toUTF8String
 
Methods inherited from class org.sourceforge.jxutil.JNI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyInStream

private InputStream copyInStream
The InputStream for COPY IN data.


copyOutStream

private OutputStream copyOutStream
The OutputStream for COPY OUT data.


messageEncoding

private String messageEncoding
The message encoding. FIXME: Not used!!!


noticeList

private ArrayList noticeList
The buffer to store the notices in.


pgconn

private int pgconn
The PGconn* handle.

Constructor Detail

LibProtocol

public LibProtocol()
Method Detail

close

public void close()
           throws SQLException
Description copied from interface: PGProtocol
Close the connection to the backend.

Specified by:
close in interface PGProtocol
SQLException

connect

public void connect(Properties info)
             throws SQLException
Open the connection. The following properties are recognized:
InfoKeys.HOST, InfoKeys.PORT, InfoKeys.CATALOG (the database name, defaults to template1), InfoKeys.USER, InfoKeys.PASSWORD PGInfoKeys.OPTIONS, PGInfoKeys.TTY

Specified by:
connect in interface PGProtocol
SQLException
See Also:
InfoKeys, PGInfoKeys

discardCopyOut

private void discardCopyOut()

doCopyOut

private void doCopyOut()

exec

public PGFuncResult exec(long funcOid,
                         byte[][] args)
Not implemented.... FIXME: Write an implementation

Specified by:
exec in interface PGProtocol

exec

public PGExecResult exec(String sql)
Description copied from interface: PGProtocol
Execute a SQL command.

Specified by:
exec in interface PGProtocol

requestCancel

public void requestCancel()
                   throws SQLException
Description copied from interface: PGProtocol
Request cancellation of current statement.

Specified by:
requestCancel in interface PGProtocol
SQLException

setCopyInStream

public void setCopyInStream(InputStream in)
Accessor function for COPY IN

Specified by:
setCopyInStream in interface PGProtocol

setCopyOutStream

public void setCopyOutStream(OutputStream copyOutStream)
Accessor function for COPY OUT

Specified by:
setCopyOutStream in interface PGProtocol

setMessageEncoding

public void setMessageEncoding(String messageEncoding)
Description copied from interface: PGProtocol
Set the encoding to use for stringifying backend messages.

Specified by:
setMessageEncoding in interface PGProtocol

jxDBCon 0.9z

Copyright © 2001,2002 Keve Müller; see LICENSE file for details.