NAME
Sybase::TdsSocket - A module containing tds lowlevel functions
SYNOPSIS
my $tdssocket = Sybase::TdsSocket->new($socket);
$tdssocket->set_packetsize(512);
$tdssocket->packet_type(TDS_RESPONSE);
my ($length, $header, $data) = $tdssocket->read_packet();
$tdssocket->write($data);
DESCRIPTION
REQUIREMENTS
EXPORTS
FUNCTIONS
new - the constructor
Parameters:
- Servername
Example:
$tdssocket = Sybase::TdsSocket->new('myserver');
packet_type
Sets the packet type for the next outgoing packets.
Parameters:
The type, should be one of the following: TDS_RESPONSE
Example:
my $res = $tdssocket->packet_type(TDS_RESPONSE);
read_packet
Parameters:
- Socket
-
An IO::Socket object from which the data will be read.
Returnvalues:
- Packetlength
-
The length of the packet in bytes.
- Header
-
The 8 byte tds header
- Data
-
The data.
Example:
my ($len, $header, $data) = $tdssocket->read_packet;
write
Accumulates data in a buffer and sends a tds packet if necessary.
Parameters:
- Data
-
The packet Data
Returnvalues:
True for success, false for failure.
Example:
my $res = $tdssocket->write($data);
flush
Sends all data in buffer and truncates it.
Parameters:
None.
Example:
my $res = $tdssocket->flush;
send_done
Sends a done token to the client
Parameters:
- Status
-
Status is a bitmap with the following meaning:
0x0000 done final Result complete, successful 0x0001 done more Result complete, more results to follow 0x0002 done error Error occured in current command 0x0004 done inxact Transaction in progress for command 0x0008 done proc Result comes from a stored procedure 0x0010 done count 0x0020 done attn to acknowlegde an attention 0x0040 done event part of event notification
- Status of the current transaction.
-
Status of the current transaction is one of the following:
0 not in tran 1 tran succeed 2 tran in progress 3 statement abort 4 tran abort
- Number of rows.
-
Returnvalues:
Example:
$tdssocket->send_done($status);
send_eed
Sends a eed token to the client
Parameters:
- MsgNo
-
Message number.
- Class
-
Class or severity.
- Transtate
-
Status of the current transaction is one of the following:
0 not in tran 1 tran succeed 2 tran in progress 3 statement abort 4 tran abort
- Message
-
Text of the message.
- Server
-
Servername
- Procedure
-
Name of the procedure (optional)
- Line
-
Line of the procedure (optional)
Returnvalues:
Example:
$tdssocket->send_eed(12345, 10, 0, 'This is a warning');
server_info
Gets ip and port from interfaces file
Parameters:
Servername
Returnvalues:
IP and Portnumber
undef and errortext on failure.
Example:
my ($ip, $port) = $tdssocket->server_info('myserver');
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 293:
You forgot a '=back' before '=head2'
- Around line 371:
You forgot a '=back' before '=head2'