All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class postgresql.PG_Stream

java.lang.Object
   |
   +----postgresql.PG_Stream

public class PG_Stream
extends Object
See Also:
Connection

Constructor Index

 o PG_Stream(String, int)
Constructor: Connect to the PostgreSQL back end and return a stream connection.

Method Index

 o close()
Closes the connection
 o flush()
This flushes any pending output to the backend.
 o Receive(byte[], int, int)
Reads in a given number of bytes from the backend
 o ReceiveChar()
Receives a single character from the backend
 o ReceiveInteger(int)
Receives an integer from the backend
 o ReceiveIntegerR(int)
Receives an integer from the backend
 o ReceiveString(int)
Receives a null-terminated string from the backend.
 o ReceiveTuple(int, boolean)
Read a tuple from the back end.
 o Send(byte[])
Send an array of bytes to the backend
 o Send(byte[], int)
Send an exact array of bytes to the backend - if the length has not been reached, send nulls until it has.
 o Send(byte[], int, int)
Send an exact array of bytes to the backend - if the length has not been reached, send nulls until it has.
 o SendChar(int)
Sends a single character to the back end
 o SendInteger(int, int)
Sends an integer to the back end
 o SendIntegerReverse(int, int)
Sends an integer to the back end in reverse order.
 o SendPacket(byte[])
Sends a packet, prefixed with the packet's length

Constructors

 o PG_Stream
 public PG_Stream(String host,
                  int port) throws IOException
Constructor: Connect to the PostgreSQL back end and return a stream connection.

Parameters:
host - the hostname to connect to
port - the port number that the postmaster is sitting on
Throws: IOException
if an IOException occurs below it.

Methods

 o SendChar
 public void SendChar(int val) throws IOException
Sends a single character to the back end

Parameters:
val - the character to be sent
Throws: IOException
if an I/O error occurs
 o SendInteger
 public void SendInteger(int val,
                         int siz) throws IOException
Sends an integer to the back end

Parameters:
val - the integer to be sent
siz - the length of the integer in bytes (size of structure)
Throws: IOException
if an I/O error occurs
 o SendIntegerReverse
 public void SendIntegerReverse(int val,
                                int siz) throws IOException
Sends an integer to the back end in reverse order. This is required when the backend uses the routines in the src/backend/libpq/pqcomprim.c module. As time goes by, this should become obsolete.

Parameters:
val - the integer to be sent
siz - the length of the integer in bytes (size of structure)
Throws: IOException
if an I/O error occurs
 o Send
 public void Send(byte buf[]) throws IOException
Send an array of bytes to the backend

Parameters:
buf - The array of bytes to be sent
Throws: IOException
if an I/O error occurs
 o Send
 public void Send(byte buf[],
                  int siz) throws IOException
Send an exact array of bytes to the backend - if the length has not been reached, send nulls until it has.

Parameters:
buf - the array of bytes to be sent
siz - the number of bytes to be sent
Throws: IOException
if an I/O error occurs
 o Send
 public void Send(byte buf[],
                  int off,
                  int siz) throws IOException
Send an exact array of bytes to the backend - if the length has not been reached, send nulls until it has.

Parameters:
buf - the array of bytes to be sent
off - offset in the array to start sending from
siz - the number of bytes to be sent
Throws: IOException
if an I/O error occurs
 o SendPacket
 public void SendPacket(byte buf[]) throws IOException
Sends a packet, prefixed with the packet's length

Parameters:
buf - buffer to send
Throws: SQLException
if an I/O Error returns
 o ReceiveChar
 public int ReceiveChar() throws SQLException
Receives a single character from the backend

Returns:
the character received
Throws: SQLException
if an I/O Error returns
 o ReceiveInteger
 public int ReceiveInteger(int siz) throws SQLException
Receives an integer from the backend

Parameters:
siz - length of the integer in bytes
Returns:
the integer received from the backend
Throws: SQLException
if an I/O error occurs
 o ReceiveIntegerR
 public int ReceiveIntegerR(int siz) throws SQLException
Receives an integer from the backend

Parameters:
siz - length of the integer in bytes
Returns:
the integer received from the backend
Throws: SQLException
if an I/O error occurs
 o ReceiveString
 public String ReceiveString(int maxsiz) throws SQLException
Receives a null-terminated string from the backend. Maximum of maxsiz bytes - if we don't see a null, then we assume something has gone wrong.

Parameters:
maxsiz - maximum length of string
Returns:
string from back end
Throws: SQLException
if an I/O error occurs
 o ReceiveTuple
 public byte[][] ReceiveTuple(int nf,
                              boolean bin) throws SQLException
Read a tuple from the back end. A tuple is a two dimensional array of bytes

Parameters:
nf - the number of fields expected
bin - true if the tuple is a binary tuple
Returns:
null if the current response has no more tuples, otherwise an array of strings
Throws: SQLException
if a data I/O error occurs
 o Receive
 public void Receive(byte b[],
                     int off,
                     int siz) throws SQLException
Reads in a given number of bytes from the backend

Parameters:
buf - buffer to store result
off - offset in buffer
siz - number of bytes to read
Throws: SQLException
if a data I/O error occurs
 o flush
 public void flush() throws SQLException
This flushes any pending output to the backend. It is used primarily by the Fastpath code.

Throws: SQLException
if an I/O error occurs
 o close
 public void close() throws IOException
Closes the connection

Throws: IOException
if a IO Error occurs

All Packages  Class Hierarchy  This Package  Previous  Next  Index