Sv: FreeTDS JDBC Strings>255 and Date

Carsten Rhod Gregersen crg at rgm.dk
Thu May 25 10:46:31 EDT 2000



Here it is, it also fixes a date problem in ECT timezones:

----- Oprindelig meddelelse ----- 
Fra: RGM FreeTDS mail <freetds at rgm.dk>
Til: TDS Development Group <freetds at franklin.oit.unc.edu>
Sendt: 2. maj 2000 12:18
Emne: [freetds] FreeTDS JDBC Strings>255 and Date


> Hi,
> 
> I just want to say that I think the Free JDBC driver is great.
> 
> I'm having a problem with putting strings which are bigger than
> 255 chars into a text field.
> 
> Also I have problems with other timezones (specifically the ECT timezone).
> This problem occur when i try to insert/select dates via 
> prepared statements.
> 
> 
> Big Strings:
> ------------
> I have looked at the code and changed the following code:
> 
>                  comm.appendByte((byte)nativeType);
> 
>                   if (
>                      actualParameterList[i].value!=null &&
>                      ((String)actualParameterList[i].value).length()
>                      > formalParameterList[i].maxLength)
>                   {
>                      // XXX This can never happen if the driver is bug
>                      // free.  Perhaps when we are more sure of that
>                      // we can remove this check.
>                      throw new TdsException("Internal error.  string is " 
> +
>                                             "longer than procedure can  " 
> +
>                                             "handle");
>                   }
> 
>                   sendSybChar(((String)actualParameterList[i].value),
>                               formalParameterList[i].maxLength);
> 
> 
> Too this:
> 
> 
>                   if(actualParameterList[i].value != null &&
>                      ((String)actualParameterList[i].value).length()>255) 
> {
>                     comm.appendByte(SYBTEXT);
>                     sendSybImage((byte[])((String)actualParameterList[i].
>                                           value).getBytes());
>                   } else {
>                     comm.appendByte((byte)nativeType);
>                     sendSybChar(((String)actualParameterList[i].value),
>                                 formalParameterList[i].maxLength);
>                   }
> 
>                   break;
> 
> 
> Which actually works with both varchars > 255 and text fields.
> 
> 
> Also I have changed:
>                  long   ms =
>                    ((Timestamp)actualParameterList[i].value).getTime() +
>                    (nanoseconds / nsPerMs);
> 
> Too:
> 
>                  long   ms =
>                    ((Timestamp)actualParameterList[i].value).getTime() +
>                    (nanoseconds / nsPerMs) -
>                    (((Timestamp)actualParameterList[i].value).
>                     getTimezoneOffset() * 60 * 1000);
> 
> 
> Then it actually works allrigth. 
> 
> 
> crg at rgm.dk
> 
> ---
> You are currently subscribed to freetds as: freetds at rgm.dk
> To unsubscribe, forward this message to $subst('Email.Unsub')
> 
> 




More information about the FreeTDS mailing list