Skip to Content.
Sympa Menu

freetds - Re: timestamp data types (also DBLib Connections)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT umcc.ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: timestamp data types (also DBLib Connections)
  • Date: Mon, 13 Dec 1999 08:07:15 -0500 (EST)


timestamp are nothing more than varbinary fields...I have no idea what MS
SQL does to them though.

A good place to start would be to set a breakpoint in
tds_process_col_info() or tds7_process_results() (for 4.2 and 7.0
respectively) and see what the datatype is that is returned from the
server (should be SYBBINARY). The -1 comes from a routine called either
tds_get_conversion_type() or _ct_get_server_type(), set a break there and
determine what type is trying to be converted from/to. This will be the
bind_type, such as CS_CHAR_TYPE as opposed to the server datatype SYBCHAR.
(CHAR types used as examples, not what you should actually see). From
there it may be as simple as adding a case statement to
_ct_get_server_type() or if this is TDS 7.0 and MS put a whole new
datatype in, implementing that.

SQSH calls convert for each datatype just to check things out and decide
whether to use the convert functions or do it itself. Never did quite
understand that.

DBDEAD() should be used to test the connections validity. However (there's
always a but...) our implementation is suboptimal. it should look
something like:

if (dbproc &&
dbproc->tds_socket &&
dbproc->tds_socket->s)
return FALSE;
else
returnn TRUE;

I'll fix it up and check it in a bit. I'm not sure why I never got
around to implementing it beyond the stub...probably 'cause no one ever
asked about it. :-)

Brian

On Mon, 13 Dec 1999, Geoff Winkless wrote:

> >From sqsh I'm getting "Attempting to convert unknown source type -1" when I
> select an MS SQL7 timestamp field. It then returns garbage.
>
> On Sybase timestamp works fine.
>
> Where should I start looking??? include/tds.h mentions nothing at all about
> timestamps.
>
> Putting in some debugging code returns interesting stuff - what actually
> happens is first it converts the timestamp field from SYBBINARY (45)
> and -then- calls the convert again with -1, even though there's only one
> field, vis:
>
> 1> select msrepl_synctran_ts from folusers..tuserauth where fuserid=1793
> 2> go
>
> msrepl_synctran_ts
>
>
>
>
> --------------------------------------------------------------------
> ----
> ----------------------------------------------------------------------------
> ----
> ----------------------------------------------------------------------------
> ----
> ------------------------
> Converting type 45
> Converting type -1
> Attempting to convert unknown source type -1
>
> ( @( @
>
> Note that this isn't urgent (I've no need to return it, I was just
> intrigued...)
>
> On another matter entirely, what's the recommended DBLib way of testing if a
> connection is still valid?
>
> Thanks for any help...
>
> Geoff
>
>
> ---
> You are currently subscribed to freetds as: camber AT ais.org
> To unsubscribe, forward this message to $subst('Email.Unsub')
>
>





Archive powered by MHonArc 2.6.24.

Top of Page