Unix Technical Forum

need to update TimestampUtils code

This is a discussion on need to update TimestampUtils code within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> Hi, Can someone help me to update this small block of code (see BEGIN and END block) in the ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces jdbc

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-16-2008, 12:29 AM
Do, Leon
 
Posts: n/a
Default need to update TimestampUtils code

Hi,



Can someone help me to update this small block of code (see BEGIN and
END block) in the TimestampUtils class or tell me the direction to do
it? The code allow the util to parse the timezone in both format hhmm
or hh:mm.



// Possibly read timezone.

sep = charAt(s, start);

if (sep == '-' || sep == '+') {

int tzsign = (sep == '-') ? -1 : 1;

int tzhr, tzmin;



end = firstNonDigit(s, start+1); // Skip +/-



//CHANGES BEGIN

//if 4 digits together

if (end - (start+1) > 2) {

//get first 2 digits as tzhr

tzhr = number(s,start+1,start+1+2);

// get the rest of digits as tzmin

tzmin= number(s,start+1+2, end);

start=end;

} else {

//CHANGES END



tzhr = number(s, start+1, end);

start = end;



sep = charAt(s, start);

if (sep == ':') {

end = firstNonDigit(s, start+1); // Skip ':'

tzmin = number(s, start+1, end);

start = end;

} else {

tzmin = 0;

}

}



// Setting offset does not seem to work correctly in all

// cases.. So get a fresh calendar for a synthetic
timezone

// instead

result.tz = getCalendar(tzsign, tzhr, tzmin);



start = skipWhitespace(s, start); // Skip trailing
whitespace

}





thanks





Leon Do

Lucent Technologies

Mobility Software Engineer






Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-16-2008, 12:30 AM
Dave Cramer
 
Posts: n/a
Default Re: need to update TimestampUtils code

Does the server ever send us hhmm without a colon ?

Or what is the use case for this.

Either way you need to send us a context diff

Dave
On 4-Jan-07, at 2:28 PM, Do, Leon (Leon) wrote:

> Hi,
>
>
>
> Can someone help me to update this small block of code (see BEGIN
> and END block) in the TimestampUtils class or tell me the direction
> to do it? The code allow the util to parse the timezone in both
> format hhmm or hh:mm.
>
>
>
> // Possibly read timezone.
>
> sep = charAt(s, start);
>
> if (sep == '-' || sep == '+') {
>
> int tzsign = (sep == '-') ? -1 : 1;
>
> int tzhr, tzmin;
>
>
>
> end = firstNonDigit(s, start+1); // Skip +/-
>
>
>
> //CHANGES BEGIN
>
> //if 4 digits together
>
> if (end - (start+1) > 2) {
>
> //get first 2 digits as tzhr
>
> tzhr = number(s,start+1,start+1+2);
>
> // get the rest of digits as tzmin
>
> tzmin= number(s,start+1+2, end);
>
> start=end;
>
> } else {
>
> //CHANGES END
>
>
>
> tzhr = number(s, start+1, end);
>
> start = end;
>
>
>
> sep = charAt(s, start);
>
> if (sep == ':') {
>
> end = firstNonDigit(s, start+1); // Skip ':'
>
> tzmin = number(s, start+1, end);
>
> start = end;
>
> } else {
>
> tzmin = 0;
>
> }
>
> }
>
>
>
> // Setting offset does not seem to work correctly
> in all
>
> // cases.. So get a fresh calendar for a synthetic
> timezone
>
> // instead
>
> result.tz = getCalendar(tzsign, tzhr, tzmin);
>
>
>
> start = skipWhitespace(s, start); // Skip trailing
> whitespace
>
> }
>
>
>
>
>
> thanks
>
>
>
>
>
> Leon Do
>
> Lucent Technologies
>
> Mobility Software Engineer
>
>
>
>
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-16-2008, 12:30 AM
Kris Jurka
 
Posts: n/a
Default Re: need to update TimestampUtils code



On Thu, 4 Jan 2007, Dave Cramer wrote:

> Does the server ever send us hhmm without a colon ?
>
> Or what is the use case for this.


There was previous discussion of this in November and for the purposes of
updatable ResultSets it is important that we can parse what we generate.
The solution Oliver suggested (which makes more sense to me than this) is
to adjust our timestamp generation code to always include a colon.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:50 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com