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: "Thompson, Bill D (London)" <ThompBil AT exchange.uk.ml.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Comment on change
  • Date: Wed, 5 Mar 2003 17:18:20 -0000

Aahh,

Thanks for this freddy. Let me follow up on this, but I bet its to do with
this:

in sybase isql :

1> select convert(char(30), convert(datetime,''))
2>

------------------------------
Jan 1 1900 12:00AM

(1 row affected)

I reckon thats what this is about. we've passed an empty string to dbconvert
to convert to a date.
I bet sybase dbconvert converts it to 'Jan 1 1900' , but luckily so do we
now!

I didn't realise you were the author of the amazing math.

che forza il tuo programma!
con ammirazione,

Bill

> -----Original Message-----
> From: ZIGLIO Frediano [SMTP:Frediano.Ziglio AT vodafoneomnitel.it]
> Sent: 05 March 2003 16:52
> To: 'FreeTDS Development Group'
> Subject: RE: [freetds] Comment on change
>
>
> >
> > > @ + 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."
>
> =================================
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page