| java.lang.Object com.internetcds.jdbc.tds.TdsComm
TdsComm | public class TdsComm implements TdsDefinitions(Code) | | Handle the communications for a Tds instance.
version: $Id: TdsComm.java,v 1.2 2007-10-19 13:21:40 sinisa Exp $ author: Craig Spannring author: Igor Petrovski |
Method Summary | |
public void | appendByte(byte b) append a byte onto the end of the logical TDS packet.
Append a byte onto the end of the logical TDS packet. | public void | appendBytes(byte[] b) append an array of bytes onto the end of the logical TDS packet. | public void | appendBytes(byte[] b, int len, byte pad) append an array of bytes onto the end of the logical TDS packet. | public void | appendChars(String s) Appends the 16-bit characters from the caller's string, without
narrowing the characters.
Sybase let's the client decide what byte order to use but it \
appears that SQLServer 7.0 little-endian byte order. | public void | appendFlt8(Double value) append a Double onto the end of the logical TDS packet. | public void | appendInt(int i) | public void | appendInt64(long i) | public void | appendShort(short s) append a short int onto the end of the logical TDS packet. | public void | appendTdsInt(int i) | public void | appendTdsShort(short s) Appends a short int onto the end of the logical TDS packet. | public void | backup() put the most recently read byte of data back in the inBuffer. | public void | close() | public byte | getByte() read a byte of data from the DB server. | public byte[] | getBytes(int len) | public int | getNetShort() | public String | getString(int len) Reads bytes or characters (depending on TDS version) and constructs a
string with them.
Sybase will let the client choose byte ordering, but SQLServer 7.0
wants little endian only. | public int | getTdsInt() | public long | getTdsInt64() | public int | getTdsShort() | public byte | peek() peek at the next byte of data.
This returns the next byte of data that would be returned
by getByte(), but does not actually consume the data.
Note- We can't synchronize this method (or most of the other
methods in this class) because of the way cancels are handled. | public synchronized void | sendPacket() Send the logical packet.
Send the logical packet the has been constructed. | public void | skip(int i) | public boolean | someThreadIsBuildingPacket() | public synchronized void | startPacket(int type) start a TDS packet.
This method should be called to start a logical TDS packet.
Parameters: type - Type of the packet. |
CANCEL | final public static byte CANCEL(Code) | | |
LOGON | final public static byte LOGON(Code) | | |
LOGON70 | final public static byte LOGON70(Code) | | |
PROC | final public static byte PROC(Code) | | |
QUERY | final public static byte QUERY(Code) | | |
REPLY | final public static byte REPLY(Code) | | |
headerLength | final static int headerLength(Code) | | |
inBufferIndex | int inBufferIndex(Code) | | |
inBufferLen | int inBufferLen(Code) | | |
nextOutBufferIndex | int nextOutBufferIndex(Code) | | |
outBuffer | byte outBuffer(Code) | | |
packetType | int packetType(Code) | | |
packetsReceived | int packetsReceived(Code) | | |
packetsSent | int packetsSent(Code) | | |
appendByte | public void appendByte(byte b) throws java.io.IOException(Code) | | append a byte onto the end of the logical TDS packet.
Append a byte onto the end of the logical TDS packet. When a
physical packet is full send it to the server.
Parameters: b - byte to add to the TDS packet |
appendBytes | public void appendBytes(byte[] b) throws java.io.IOException(Code) | | append an array of bytes onto the end of the logical TDS packet.
Parameters: b - bytes to add to the TDS packet |
appendBytes | public void appendBytes(byte[] b, int len, byte pad) throws java.io.IOException(Code) | | append an array of bytes onto the end of the logical TDS packet.
Parameters: b - bytes to add to the TDS packet Parameters: len - maximum number of bytes to transmit Parameters: pad - fill with this byte until len is reached |
appendChars | public void appendChars(String s) throws java.io.IOException(Code) | | Appends the 16-bit characters from the caller's string, without
narrowing the characters.
Sybase let's the client decide what byte order to use but it \
appears that SQLServer 7.0 little-endian byte order.
Added 2000-06-05
|
appendFlt8 | public void appendFlt8(Double value) throws java.io.IOException(Code) | | append a Double onto the end of the logical TDS packet.
Append the Double value onto the end of the TDS packet as a
SYBFLT8.
Parameters: value - Double to add to the TDS packet |
appendShort | public void appendShort(short s) throws java.io.IOException(Code) | | append a short int onto the end of the logical TDS packet.
Parameters: s - short int to add to the TDS packet |
appendTdsShort | public void appendTdsShort(short s) throws java.io.IOException(Code) | | Appends a short int onto the end of the logical TDS packet.
Parameters: s - short int to add to the TDS packet |
backup | public void backup()(Code) | | put the most recently read byte of data back in the inBuffer.
This function effectivly ungets the last byte read.
It is guaranteed to be able to unget the last byte read.
Trying to unget multiple bytes is not recomended and will
only work so long as all the bytes were in the same
physical TDS network packet.
author: Craig Spannring |
close | public void close()(Code) | | |
getString | public String getString(int len) throws com.internetcds.jdbc.tds.TdsException, java.io.IOException(Code) | | Reads bytes or characters (depending on TDS version) and constructs a
string with them.
Sybase will let the client choose byte ordering, but SQLServer 7.0
wants little endian only. In the interest of simplicity, just use
little endian regardless of the type of server.
Added 2000-06-05.
|
peek | public byte peek() throws com.internetcds.jdbc.tds.TdsException, java.io.IOException(Code) | | peek at the next byte of data.
This returns the next byte of data that would be returned
by getByte(), but does not actually consume the data.
Note- We can't synchronize this method (or most of the other
methods in this class) because of the way cancels are handled.
If a thread is waiting for a response from the server the
cancelController class must be able to call sendPacket() to
cancel the request.
The next byte of data that will be returned by getByte() exception: com.internetcds.jdbc.tds.TdsException - exception: java.io.IOException - |
sendPacket | public synchronized void sendPacket() throws java.io.IOException(Code) | | Send the logical packet.
Send the logical packet the has been constructed.
|
someThreadIsBuildingPacket | public boolean someThreadIsBuildingPacket()(Code) | | Is some thread currently building a logical TDS packet?
true iff a packet is being built. |
startPacket | public synchronized void startPacket(int type)(Code) | | start a TDS packet.
This method should be called to start a logical TDS packet.
Parameters: type - Type of the packet. Can be QUERY, LOGON, PROC,REPLY, or CANCEL. |
|
|