Skip to Content.
Sympa Menu

freetds - RE: [freetds] Comment on change

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: ZIGLIO Frediano <Frediano.Ziglio AT vodafoneomnitel.it>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Comment on change
  • Date: Wed, 5 Mar 2003 17:51:53 +0100


>
> > @ + if (t->tm_year == 0 && t->tm_mon == 0 && t->tm_mday == 0) {
> > @ + dt_days = 0;
> > @ + } else {
> > @ i = (t->tm_mon - 13) / 12;
> > @ dt_days = 1461 * ( t->tm_year + 300 + i ) / 4 +
> > @ (367 * ( t->tm_mon - 1 - 12*i ) ) / 12 -
> > @ (3 * ( ( t->tm_year + 400 + i ) / 100 ) ) / 4 +
> > @ t->tm_mday - 109544;
> > @ + }
> > @
>
> > year == month == day == 0 ???
> > This seem a NULL value. tds_convert should not handle null
> values (library
> > dependent).
>
> Alas, not true. Year = 0 and month = 0 and day = 0
> represents a valid date,
> namely "Jan 01 1900", a default date widely used in my system
> It seems the marvellous bit of maths herein works for all
> dates except this
> one. rather than try and figure out why, I thought the
> quickest and easiest
> solution was to create an exception for this one case.
> (as it was, the equation was turning this date into "Dec 31
> 1899" which had
> disastrous consequences for my system!)
>

??? this code assume day 1-31 month 0-11 and year from 0 (0 == 1900) just
like C structure.
So year == month == day == 0 is 1899-12-31 !
Problem is somewhere else. What string are you trying to convert??
I tested this code for all data possible (from 1600-1-1 to 9999-12-31) and
work...

> > @ +/* I don't think this is working as tds_set_null is not
> being called
> prior to this...
> > @ + I can't figure out how where I should call
> tds_set_null() anyway....
> > @
> > @ is_null = tds_get_null(current_row, i);
> > @ +*/
> > @ colsize = curcol->column_cur_size;
> > @ + if (colsize == 0)
> > @ + is_null = 1;
> > @ + else
> > @ + is_null = 0;
> > @ +
>
> > Bad. Think at empty and not null string (supported in TDS7+).
>
> As I said in the comments, I think the real solution is to call
> tds_set_null() somewhere.
> tds_get_null() is pointless unless this has been called earlier.
> Like I said though I couldn't figure out how/where to call
> it. If you have
> any ideas on that, let me know.
> I know you did the original work on the rpc stuff in
> dblibrary, so perhaps
> you'll get there quicker than I.
>
> Thanks again for integrating these patches and your input.
>

Simply you should cell tds_set_null after setting data into row...
Nowadays I'm merging a Sybase patch and this take all my time working with
FreeTDS (I'm very busy...)

freddy77

=================================
"STRICTLY PERSONAL AND CONFIDENTIAL

This message may contain confidential and proprietary material for the sole
use of the intended recipient. Any review or distribution by others is
strictly prohibited. If you are not the intended recipient please contact
the sender and delete all copies.
The contents of this message that do not relate to the official business of
our company shall be understood as neither given nor endorsed by it."

=================================




Archive powered by MHonArc 2.6.24.

Top of Page