Skip to Content.
Sympa Menu

freetds - Does anyone know what this packet means?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Craig Spannring <cts AT internetcds.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Does anyone know what this packet means?
  • Date: Mon, 14 Sep 1998 11:36:01 -0700 (PDT)



I'm trying to figure out how to execute a prepared statement in TDS
4.2. I wrote a little C program using ODBC to see what kinds of
packets are sent by the Microsoft ODBC driver. My prepared statement
was
select * from many_types where (myint=? and mynullableint=?) or myint=?"
I have bound the first and third parameters with a value of 0x000003ff, the
second parameter to null.

In packet 16 (the invocation of the procedure) I can see that the
first and third parameters are
0x38 0xff 0x03 0x00 x000
I assume the 0x38 corresponds to SYBINT4. The 0xff 0x03 0x00 0x00 is
obviously the value of the parameter.

The part I'm confused about is the second parameter. It was bound to
SQL_NULL and looks like
0x00 0x00 0x26 0x04 0x00 0x00 0x00
The first byte (which normally indicates the type of data) is set to
0x00 which seems like a reasonable way of specifying NULL. Does
anyone have any guesses as to the next 6 bytes?



Here is the dump of the network traffic. I've formatted it so that
the header is parsed out and doesn't show up in the hex dump.

Packet 14, 10:02:07.840524
Source: client.internetcds.com
Destination: server.internetcds.com
type?: 1 (QUERY)
status?: 1
length: 147
channel?: 0
packet?: 1
window?: 0
0000 01 01 00 93 00 00 01 00 63 72 65 61 74 65 20 70 |........create p|
0010 72 6f 63 20 23 6f 64 62 63 23 70 6c 61 74 72 65 |roc #odbc#platre|
0020 39 39 38 37 62 35 30 28 40 50 31 20 69 6e 74 2c |9987b50(@P1 int,|
0030 40 50 32 20 69 6e 74 2c 40 50 33 20 69 6e 74 29 |@P2 int,@P3 int)|
0040 20 61 73 20 73 65 6c 65 63 74 20 2a 20 66 72 6f | as select * fro|
0050 6d 20 6d 61 6e 79 5f 74 79 70 65 73 20 77 68 65 |m many_types whe|
0060 72 65 20 28 6d 79 69 6e 74 3d 40 50 31 20 20 20 |re (myint=@P1 |
0070 61 6e 64 20 6d 79 6e 75 6c 6c 61 62 6c 65 69 6e |and mynullablein|
0080 74 3d 40 50 32 29 20 6f 72 20 6d 79 69 6e 74 3d |t=@P2) or myint=|
0090 40 50 33 |@P3|

Packet 15, 10:02:07.868152
Source: server.internetcds.com
Destination: client.internetcds.com
type?: 4 (REPLY)
status?: 1
length: 17
channel?: 0
packet?: 0
window?: 0
0000 04 01 00 11 00 00 00 00 fd 00 00 fd 00 00 00 00 |................|
0010 00 |.|

Packet 16, 10:02:07.868951
Source: client.internetcds.com
Destination: server.internetcds.com
type?: 3 (PROC)
status?: 1
length: 49
channel?: 0
packet?: 1
window?: 0
0000 03 01 00 31 00 00 01 00 13 23 6f 64 62 63 23 70 |...1.....#odbc#p|
0010 6c 61 74 72 65 39 39 38 37 62 35 30 00 00 00 00 |latre9987b50....|
0020 38 ff 03 00 00 00 00 26 04 00 00 00 38 ff 03 00 |8......&....8...|
0030 00 |.|


--
=======================================================================
Life is short. | Craig Spannring
Ski hard, Bike fast. | cts AT internetcds.com
--------------------------------+------------------------------------
Any sufficiently perverted technology is indistinguishable from Perl.
=======================================================================




Archive powered by MHonArc 2.6.24.

Top of Page