[freetds] TDS server - error messages and "fFunction 999"

James K. Lowden jklowden at schemamania.org
Fri May 7 22:06:37 EDT 2004


On Fri, 7 May 2004, Steve Kirkendall <skirkendall at dsl-only.net> wrote:
> My little server is starting to stabilize.  At present, my biggest
> questions are:
> 
> * When is it safe the server to send error messages?  Currently my
> server
>   just calls tds_send_message(...) immediately when an error is detected
>   such as a bad column name in the SQL request, but that causes
>   Crystal Reports to crash!

Hi Steve, 

I think as late in the game as possible.  Three examples:

"select type / (type - 35) from systypes"
[some data, ending abruptly on divide by zero]
21:45:32.392682 processing result tokens.  marker is  81(TDS7_RESULT)
21:45:32.392780 processing result tokens.  marker is  d1(ROW)
21:45:32.393303 processing row tokens.  marker is  d1(ROW)
21:45:32.393735 processing row tokens.  marker is  d1(ROW)
21:45:32.405420 processing row tokens.  marker is  d1(ROW)
21:45:32.405842 processing row tokens.  marker is  d1(ROW)
21:45:32.408930 processing result tokens.  marker is  aa(ERROR)
21:45:32.409098 processing result tokens.  marker is  fd(DONE)

"select blah from systypes"
[no data or metadata]
21:50:46.364518 processing result tokens.  marker is  aa(ERROR)
21:50:46.365191 processing result tokens.  marker is  fd(DONE)

"select 1/0, type from systypes"
[metadata, no data]
21:52:35.752133 processing result tokens.  marker is  81(TDS7_RESULT)
21:52:35.752317 processing result tokens.  marker is  aa(ERROR)
21:52:35.752939 processing result tokens.  marker is  fd(DONE)

Here's the whole response for that last one:

Received packet @ 21:52:35.751863
0000 81 02 00 00 00 01 00 26-04 00 00 00 01 00 26 01 |.......& ......&.|
0010 04 74 00 79 00 70 00 65-00 aa 5c 00 c6 1f 00 00 |.t.y.p.e ..\.....|
0020 01 10 21 00 44 00 69 00-76 00 69 00 64 00 65 00 |..!.D.i. v.i.d.e.|
0030 20 00 62 00 79 00 20 00-7a 00 65 00 72 00 6f 00 | .b.y. . z.e.r.o.|
0040 20 00 65 00 72 00 72 00-6f 00 72 00 20 00 65 00 | .e.r.r. o.r. .e.|
0050 6e 00 63 00 6f 00 75 00-6e 00 74 00 65 00 72 00 |n.c.o.u. n.t.e.r.|
0060 65 00 64 00 2e 00 07 43-00 50 00 52 00 4f 00 32 |e.d....C .P.R.O.2|
0070 00 30 00 30 00 00 01 00-fd 12 00 c1 00 00 00 00 |.0.0.... ........|
0080 00                     -                        |.|

> 	http://www.cs.pdx.edu/~kirkenda/tdsserver.html

You make some novel observations, and I didn't notice any errors.  I hope
we'll be able to add it to our documentation.  Practically everything we
have is from the client perspective; it's good to look at it from the
server side, too.  

Regards, 

--jkl



More information about the FreeTDS mailing list