Project

General

Profile

Bug #7203

INIT clause for datetime var copied from 'like' phrase

Added by Constantin Asofiei about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version:

History

#2 Updated by Constantin Asofiei about 1 year ago

This testcase shows two problems:

def temp-table tt1 field f1 as datetime init "01/01/2001 12:00:00.000".
def var d1 like tt1.f1.
def var d2 like customer.created.
message d1 d2.

where customer.created is:
ADD FIELD "created" OF "customer" AS datetime 
  FORMAT "99/99/9999 HH:MM:SS.SSS" 
  INITIAL "01/01/2001 12:00:00.000" 
  POSITION 90
  MAX-WIDTH 8
  ORDER 9

FWD converts the two vars like:


   @LegacySignature(type = Type.VARIABLE, name = "d1")
   datetime d1 = UndoableFactory.datetime(new datetime(date.fromLiteral("01/01/2001")));   <!-- the INIT literal is incorrect

   @LegacySignature(type = Type.VARIABLE, name = "d2")
   datetime d2 = UndoableFactory.datetime(new datetime(datetimetz.fromLiteral(""01/01/2001 12:00:00.000"")));  <!--- this is double-quoted, and does not compile

#3 Updated by Constantin Asofiei about 1 year ago

  • Assignee set to Constantin Asofiei
  • Status changed from New to WIP

#4 Updated by Constantin Asofiei about 1 year ago

  • % Done changed from 0 to 100
  • Status changed from WIP to Review

This is fixed in 7199a/14508

#5 Updated by Greg Shah about 1 year ago

Code Review Task Branch 7199a Revision 14508

In schema.g, on line 1703, isn't content.getType() == STRING always true?

I also noticed that we have an existing optimization opportunity in datetime.fromLiteral(). We could move the compiling of the pattern to a final static member and avoid the cost of compiling on each call.

Otherwise I have no concerns.

#6 Updated by Constantin Asofiei about 1 year ago

Greg Shah wrote:

Code Review Task Branch 7199a Revision 14508

In schema.g, on line 1703, isn't content.getType() == STRING always true?

Fixed in 7199a/14513.

I also noticed that we have an existing optimization opportunity in datetime.fromLiteral(). We could move the compiling of the pattern to a final static member and avoid the cost of compiling on each call.

I've fixed datetime.fromLiteral and other cases where a Pattern can be cached.

#7 Updated by Greg Shah about 1 year ago

  • Status changed from Review to Test

#8 Updated by Constantin Asofiei about 1 year ago

7199a was merged to trunk rev 14514 and archived.

#9 Updated by Greg Shah about 1 year ago

  • Status changed from Test to Closed

Also available in: Atom PDF