Skip to Content.
Sympa Menu

freetds - RE: Output parameters (was: Strange things)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: "TDS Development Group" <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: Output parameters (was: Strange things)
  • Date: Thu, 21 Nov 2002 00:48:40 -0500


On Wed, 20 Nov 2002 16:50:42 -0500, "Castellano, Nicholas"
<Nicholas_Castellano AT acml.com> wrote:
> I think we should just scrap src/dblib/unittests/t0022.c. It seems to
> be the general consensus that this is obsolete functionality and just
> isn't useful behavior anyway.

I have some results from Bob's test. I'm a little hazy at this hour, so
I'm posting my preliminary data for the benefit or confusion of all.

Bob, what version was your server? 2000, yea?

Bob's code looks about like this:

check(SQLAllocStmt(dbc, &stmt));
check(SQLPrepare(stmt, "{call t0022(?)}", SQL_NTS));
check(SQLBindParameter(stmt, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG,
SQL_INTEGER, 0, 0, (UCHAR*)&id, 0, &cb));
check(SQLExecute(stmt));
printf("id = %d\n", id);

That's the ODBC way to get an output parameter without selecting it, I
guess. Here's the whole conversation after login:

09:23:40.579039 dsl092-147-061.wdc1.dsl.speakeasy.net.4977 >
mmdb2.nci.nih.gov.1433: P 174:201(27) ack 395 win 63846 (DF)
0x0000 4500 0043 427a 4000 8006 c025 425c 933d E..CBz@....%B\.=
0x0010 9c28 8653 1371 0599 b239 fe84 2e7d 2774 .(.S.q...9...}'t
0x0020 5018 f966 3759 0000 0301 001b 0000 0100 P..f7Y..........
0x0030 0500 7400 3000 3000 3200 3200 0000 0001 ..t.0.0.2.2.....
0x0040 2604 00 &..
09:23:40.606461 mmdb2.nci.nih.gov.1433 >
dsl092-147-061.wdc1.dsl.speakeasy.net.4977: P 395:442(47) ack 201 win
17320 (DF)
0x0000 4500 0057 3055 4000 6e06 e436 9c28 8653 E..W0U@.n..6.(.S
0x0010 425c 933d 0599 1371 2e7d 2774 b239 fe9f B\.=...q.}'t.9..
0x0020 5018 43a8 7406 0000 0401 002f 0036 0100 P.C.t....../.6..
0x0030 ff11 00c1 0001 0000 0079 0000 0000 ac0d .........y......
0x0040 0000 0138 0000 0026 0404 2a00 0000 fe00 ...8...&..*.....
0x0050 00e0 0001 0000 00 .......
09:23:40.606865 dsl092-147-061.wdc1.dsl.speakeasy.net.4977 >
mmdb2.nci.nih.gov.1433: F 201:201(0) ack 442 win 63799 (DF)
0x0000 4500 0028 427b 4000 8006 c03f 425c 933d E..(B{@....?B\.=
0x0010 9c28 8653 1371 0599 b239 fe9f 2e7d 27a3 .(.S.q...9...}'.
0x0020 5011 f937 9e82 0000 P..7....
09:23:40.633922 mmdb2.nci.nih.gov.1433 >
dsl092-147-061.wdc1.dsl.speakeasy.net.4977: . ack 202 win 17320 (DF)
0x0000 4500 0028 3056 4000 6e06 e464 9c28 8653 E..(0V@.n..d.(.S
0x0010 425c 933d 0599 1371 2e7d 27a3 b239 fea0 B\.=...q.}'..9..
0x0020 5010 43a8 5412 0000 0000 0000 0000 P.C.T.........
09:23:40.635077 mmdb2.nci.nih.gov.1433 >
dsl092-147-061.wdc1.dsl.speakeasy.net.4977: F 442:442(0) ack 202 win 17320
(DF)
0x0000 4500 0028 3057 4000 6e06 e463 9c28 8653 E..(0W@.n..c.(.S
0x0010 425c 933d 0599 1371 2e7d 27a3 b239 fea0 B\.=...q.}'..9..
0x0020 5011 43a8 5411 0000 0000 0000 0000 P.C.T.........
09:23:40.635096 dsl092-147-061.wdc1.dsl.speakeasy.net.4977 >
mmdb2.nci.nih.gov.1433: . ack 443 win 63799 (DF)
0x0000 4500 0028 427c 4000 8006 c03e 425c 933d E..(B|@....>B\.=
0x0010 9c28 8653 1371 0599 b239 fea0 2e7d 27a4 .(.S.q...9...}'.
0x0020 5010 f937 9e81 0000 P..7....

Doesn't look like much. The real oddity is we should see "2a" come back
from the server, because that's the value (42) of the output parameter.
Here's my crude attempt to find TDS tokens (it's not meant to be smart,
just helpful):

09:23:40.579039 dsl092-147-061.wdc1.dsl.speakeasy.net.4977 >
mmdb2.nci.nih.gov.1433: P 174:201(27) ack 395 win 63846 (DF)
45 00 00 43 42 7a 40 00
80 TDS_CURCLOSE
06 c0 25 42 5c 93 3d
9c 28
86 TDS_CURDECLARE
53 13 71 05 99 b2 39
fe TDS_DONEPROC

84 TDS_CUROPEN
2e 7d 27 74
50 18 f9 66 37 59 00 00 03 01 00 1b 00 00 01 00
05 00 74 00 30 00 30 00 32 00 32 00 00 00 00 01
26 04 00

09:23:40.606461 mmdb2.nci.nih.gov.1433 >
dsl092-147-061.wdc1.dsl.speakeasy.net.4977: P 395:442(47) ack 201 win
17320 (DF)
45 00 00 57 30 55 40 00 6e 06 e4 36 9c 28
86 TDS_CURDECLARE
53
42 5c 93 3d 05 99 13 71 2e 7d 27 74 b2 39
fe TDS_DONEPROC
9f
50 18 43
a8 TDS_ALTFMT
74 06 00 00 04 01 00 2f 00 36 01 00

ff TDS_DONEINPROC
11 00 c1 00 01 00 00 00 79 00 00 00 00
ac TDS_RETURNVALUE
0d
00 00 01 38 00 00 00 26 04 04 2a 00 00 00
fe TDS_DONEPROC
00
00
e0 TDS_RPC
00 01 00 00 00

09:23:40.606865 dsl092-147-061.wdc1.dsl.speakeasy.net.4977 >
mmdb2.nci.nih.gov.1433: F 201:201(0) ack 442 win 63799 (DF)
45 00 00 28 42 7b 40 00
80 TDS_CURCLOSE
06 c0 3f 42 5c 93 3d
9c 28
86 TDS_CURDECLARE
53 13 71 05 99 b2 39
fe TDS_DONEPROC
9f 2e 7d 27
a3 TDS_DYNAMIC2

50 11 f9 37 9e
82 TDS_CURFETCH
00 00

09:23:40.633922 mmdb2.nci.nih.gov.1433 >
dsl092-147-061.wdc1.dsl.speakeasy.net.4977: . ack 202 win 17320 (DF)
45 00 00 28 30 56 40 00 6e 06 e4 64 9c 28
86 TDS_CURDECLARE
53
42 5c 93 3d 05 99 13 71 2e 7d 27
a3 TDS_DYNAMIC2
b2 39
fe TDS_DONEPROC

a0 TDS_COLNAME

50 10 43
a8 TDS_ALTFMT
54 12 00 00 00 00 00 00 00 00

09:23:40.635077 mmdb2.nci.nih.gov.1433 >
dsl092-147-061.wdc1.dsl.speakeasy.net.4977: F 442:442(0) ack 202 win 17320
(DF)
45 00 00 28 30 57 40 00 6e 06 e4 63 9c 28
86 TDS_CURDECLARE
53
42 5c 93 3d 05 99 13 71 2e 7d 27
a3 TDS_DYNAMIC2
b2 39
fe TDS_DONEPROC

a0 TDS_COLNAME

50 11 43
a8 TDS_ALTFMT
54 11 00 00 00 00 00 00 00 00

09:23:40.635096 dsl092-147-061.wdc1.dsl.speakeasy.net.4977 >
mmdb2.nci.nih.gov.1433: . ack 443 win 63799 (DF)
45 00 00 28 42
7c TDS_PROCID
40 00
80 TDS_CURCLOSE
06 c0 3e 42 5c 93 3d
9c 28
86 TDS_CURDECLARE
53 13 71 05 99 b2 39
fe TDS_DONEPROC

a0 TDS_COLNAME
2e 7d 27
a4 TDS_TABNAME

50 10 f9 37 9e
81 TDS_CURDELETE
00 00

That's as far as I'm going to get tonight.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page