jxDBCon 0.9z

org.sourceforge.jxdbcon.postgresql
Class NetProtocolV1

java.lang.Object
  |
  +--org.sourceforge.jxdbcon.postgresql.NetProtocol
        |
        +--org.sourceforge.jxdbcon.postgresql.NetProtocolV1
All Implemented Interfaces:
InfoKeys, PGConstants, PGInfoKeys, PGProtocol
Direct Known Subclasses:
NetProtocolV2

public abstract class NetProtocolV1
extends NetProtocol

The PGProtocolV1 is the protocol implementation for V1. The V1 protocol is used by PostgresSQL v6.3.x

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

Nested Class Summary
(package private)  class NetProtocolV1.AsciiRow
          Fetch a query result row in text form.
(package private)  class NetProtocolV1.Authentication
          Fetch the authentication response.
(package private)  class NetProtocolV1.BinaryRow
          Fetch a query result row in binary form.
(package private)  class NetProtocolV1.CompletedResponse
          Fetch the completed response.
(package private)  class NetProtocolV1.CursorResponse
          Fetch the cursor name response.
(package private)  class NetProtocolV1.EmptyQueryResponse
          Fetch the empty query response.
(package private) static class NetProtocolV1.EmptyResponse
          Abstract base class for empty content responses.
(package private)  class NetProtocolV1.ErrorResponse
          Fetch the error response.
(package private)  class NetProtocolV1.FunctionResult
          Fetch the function result response.
(package private)  class NetProtocolV1.MessageResponse
          Abstract base class for one-string messages.
(package private)  class NetProtocolV1.NoticeResponse
          Fetch the notice response.
(package private)  class NetProtocolV1.NotificationResponse
          Fetch the notification response.
(package private) static class NetProtocolV1.Response
          Abstract base class for the messages sent by the backend.
(package private)  class NetProtocolV1.RowDescription
          Fetch the row description response.
 
Field Summary
protected  int nFields
          State variable holding the number of fields in the current query.
 
Fields inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocol
copyInStream, copyOutStream, in, lock, messageEncoding, out, socket
 
Fields inherited from interface org.sourceforge.jxdbcon.postgresql.PGConstants
AUTH_REQ_CRYPT, AUTH_REQ_KRB4, AUTH_REQ_KRB5, AUTH_REQ_MD5, AUTH_REQ_OK, AUTH_REQ_PASSWORD, AUTH_REQ_SCM, NUMERIC_DSCALE_MASK, NUMERIC_NAN, NUMERIC_NEG, NUMERIC_POS, NUMERIC_SIGN_MASK, PG_VERSION_STR, PG_VERSION_STR1, TRIGGER_TYPE_BEFORE, TRIGGER_TYPE_DELETE, TRIGGER_TYPE_INSERT, TRIGGER_TYPE_ROW, TRIGGER_TYPE_UPDATE
 
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
 
Constructor Summary
NetProtocolV1()
           
 
Method Summary
private static void copyStream(InputStream from, OutputStream to)
          Copy the stream data used by COPY IN/OUT statements.
protected  NetProtocolV1.Response dispatch(int ch)
          Identify the message by the transmitted first character.
protected  NetProtocolV1.Response readFirst()
          Read the first/next response from the backend.
protected  void sendClose()
          Send the close command.
protected  void sendFunctionCall(long funcOid, byte[][] param)
          Send a function call.
protected  void sendPassword(byte[] password)
          Send a password.
protected  void sendQuery(byte[] query)
          Send a query.
protected  void sendStartup(int major, int minor, String catalog, String user, String pgoptions, String pgtty)
          Send a generic startup packet.
protected  void sendStartup(String catalog, String user, String pgoptions, String pgtty)
          Send the V1 startup packet.
 
Methods inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocol
connectSocket, limString, readCString, setCopyInStream, setCopyOutStream, setMessageEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sourceforge.jxdbcon.postgresql.PGProtocol
close, connect, exec, requestCancel
 

Field Detail

nFields

protected int nFields
State variable holding the number of fields in the current query.

Constructor Detail

NetProtocolV1

public NetProtocolV1()
Method Detail

copyStream

private static void copyStream(InputStream from,
                               OutputStream to)
                        throws IOException
Copy the stream data used by COPY IN/OUT statements.

IOException

dispatch

protected NetProtocolV1.Response dispatch(int ch)
                                   throws IOException
Identify the message by the transmitted first character. This routine also performs COPY functions.

Returns:
null if the character code does not map to a valid message, else the message instance
IOException

readFirst

protected NetProtocolV1.Response readFirst()
                                    throws InterruptedException,
                                           IOException
Read the first/next response from the backend.

Throws:
InterruptedException - if the operation was interrupted
EOFException - if the end of the stream was found
IOException - if any other IO problem occured

sendClose

protected void sendClose()
                  throws IOException
Send the close command.

IOException

sendFunctionCall

protected void sendFunctionCall(long funcOid,
                                byte[][] param)
                         throws IOException
Send a function call.

IOException

sendPassword

protected void sendPassword(byte[] password)
                     throws IOException
Send a password.

IOException

sendQuery

protected void sendQuery(byte[] query)
                  throws IOException
Send a query.

IOException

sendStartup

protected void sendStartup(int major,
                           int minor,
                           String catalog,
                           String user,
                           String pgoptions,
                           String pgtty)
                    throws IOException
Send a generic startup packet.

IOException

sendStartup

protected void sendStartup(String catalog,
                           String user,
                           String pgoptions,
                           String pgtty)
                    throws IOException
Send the V1 startup packet.

IOException

jxDBCon 0.9z

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