bugGNUstep - Bugs: bug #19503, ...

Group
 
 

bug #19503: PostgreSQLChannel.m/newValueForDateTypeLengthAttribute milliseconds problem

Submitter:  Manuel Guesdon <mguesdon>
Submitted:  Tue 03 Apr 2007 07:24:12 PM UTC
   
 
Category:  gdl2 Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  ayers
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 16 Apr 2007 07:34:16 AM UTC, comment #1: 

Thanks... I the millisecond value was replacing the second value and wasn't set itself.  Fixed in SVN.
I'm still a but surprised that the compiler doesn't optimize:
if (localuint > 2)
{ /*don't alter localuint */ }
if (localuint > 5)
{ /*don't alter localuint */ }
if (localuint > 9)
{ /*don't alter localuint */ }

to:
if (localuint > 2)
{ /*don't alter localuint */
  if (localuint > 5)
  { /*don't alter localuint */
    if (localuint > 9)
    { /*don't alter localuint */ }
  }
}

by itself but I'm not finding the time to investigate so changed it as you suggested (but didn't update the indetation yet as I may still look into this later.

David Ayers <ayers>
Group Member
Tue 03 Apr 2007 07:24:12 PM UTC, original submission:  

In PostgreSQLAdaptor/PostgreSQLChannel.m:

newValueForDateTypeLengthAttribute (const void *bytes,
                                    int length,
                                    EOAttribute *attribute,
                                    NSStringEncoding encoding)

There's 2 timeslength >18 case and milliseconds are not handled
....
  if (length > 18)
    {
      char tmpString[3];
      getDigits(&str[17],tmpString,2,&error);
      second = atoi(tmpString);
    }

  if (length > 18)
    {
      char tmpString[3];
      getDigits(&str[17],tmpString,2,&error);
      second = atoi(tmpString);
    }
...

BTW, won't it be better to have:
  if (length > 3)
    {
      char tmpString[5];
      getDigits(&str[0],tmpString,4,&error);
      year = atoi(tmpString);
      if (length > 6)
      {
        char tmpString[3];
        getDigits(&str[5],tmpString,2,&error);
        month = atoi(tmpString);
        if (...)


    


Manuel Guesdon <mguesdon>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ayers (Posted a comment)
  • -email is unavailable- added by mguesdon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-04-16 ayers StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code