[freetds] TDS_DONE_TOKEN (and others)
Lowden, James K
LowdenJK at bernstein.com
Wed Apr 30 17:02:58 EDT 2003
> From: Frediano Ziglio [mailto:freddyz77 at tin.it]
> Sent: April 30, 2003 3:09 PM
> I putted some "FIXME ICONV" in query.c. Mainly some sizes are needed
> before sending string...
> Also our library do not work with non ASCII extended charset.
> It this a
> problem? Some code require query parsing, so extended ascii charset
> (even utf8) work,
Not a problem in theory. We just need two TDSICONVINFO structures, one for
UCS-2, and one for the server's character set.
> ebcdici (how to write it?) not!
See the iconv FAQ. Basically, it says: "EBCDIC? No!"
> I renamed TDS_COMPLETED in TDS_IDLE and changed code in
> query.c to test this state instead of "PENDING".
Wow. That was quick!
> I also changed all server type define
> to an enum. My intention is to use enum so compiler can provide better
I like enum and think it's underused. Sometimes we're constrained; either
because Sybase used #define, or because emum is 'int' bits wide (and so not
appropriate for, say, a 2-byte status code in the TDS packet).
> Anyone know how to pass dynamic query to Sybase passing types? Can I
> post a dynamic query like
> create proc my_proc @pippo int as ... ??
> In TDS7+ I do something like
> sp_prepare @P1 out, '@pippo int', 'select @pippo', 1
> sp_execute @P1, @param1, @param2 ...
TDS 5.0 uses the TDS_DYNAMIC (0xE7) token. I doubt there's any support for
dynamic queries in 4.2.
With TDS_DYNAMIC, you send the statement text, then *ask* the server to
describe the i/o parameters (i.e. types). To execute, you send TDS_DYNAMIC
again ('type' TDS_DYN_EXEC (0x02)), followed by a bunch of parameter
packets. Paramater names are not supported.
IMHO, this is a sensible approach, but requires the server to do more work.
> When I issue an RPC no TDS_DONE is returned (last returned is
> TDS_DONEPROC without continue).
That conforms to Sybase's functional specification.
> Perhaps we can test tds->state after
> tds_process_results_token but this lead future problem when
> we implement full thread-safe...
Is the question, When should we set "tds->state = TDS_IDLE"?
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.
More information about the FreeTDS