Project

General

Profile

initial.diff

Igor Skornyakov, 10/18/2022 05:59 AM

Download (7.03 KB)

View differences:

src/com/goldencode/p2j/persist/DynamicTablesHelper.java 2022-10-18 07:43:22 +0000
832 832
            tableField.putAnnotation("col_lab", field.getColumnLabel());
833 833
         }
834 834
         
835
         if (field.getCodePage() != null)
835
         if (!org.apache.commons.lang3.StringUtils.isEmpty(field.getCodePage()))
836 836
         {
837
            tableField.putAnnotation("codePage", field.getCodePage());
837
            tableField.putAnnotation("column-codepage", field.getCodePage());
838 838
         }
839 839

  
840 840
         if (field.isSerializeHidden())
src/com/goldencode/p2j/persist/TableMapper.java 2022-10-18 08:44:34 +0000
102 102
**     CA  20220601 getIndexFieldNames must return lowercased legacy names.
103 103
**     OM  20220914 Added MAX-WIDTH support for CHARACTER fields.
104 104
**     IAS 20221006 Added 'definedFormat' and 'definedLabel'.
105
**     IAS 20221018 Fixed processing of 'now' and 'today' INITIAL attribute value.
105 106
*/
106 107

  
107 108
/*
......
2874 2875
                  {
2875 2876
                     if ("today".equalsIgnoreCase(text))
2876 2877
                     {
2877
                        initialValue = date.today();
2878
                        initialValue = new character(text);
2878 2879
                     }
2879 2880
                     else
2880 2881
                     {
......
2885 2886
                  {
2886 2887
                     if ("now".equalsIgnoreCase(text))
2887 2888
                     {
2888
                        initialValue = datetime.now();
2889
                        initialValue = new character(text);
2889 2890
                     }
2890 2891
                     else if (text.toUpperCase().indexOf('T') > 0)
2891 2892
                     {
......
2902 2903
                  {
2903 2904
                     if ("now".equalsIgnoreCase(text))
2904 2905
                     {
2905
                        initialValue = datetimetz.now();
2906
                        initialValue = new character(text);
2906 2907
                     }
2907 2908
                     else if (text.toUpperCase().indexOf('T') > 0)
2908 2909
                     {
src/com/goldencode/p2j/persist/orm/DmoMeta.java 2022-10-18 08:44:59 +0000
39 39
**                  to a better suited name.
40 40
**     OM  20220706 The objects returned by getDatabaseIndexes() carry the legacy names, too.
41 41
**     OM  20220914 Use MAX-WIDTH to generate custom sized varchar columns.
42
**     IAS 20221018 Fixed processing of 'now' and 'today' INITIAL attribute value.
42 43
*/
43 44

  
44 45
/*
......
1591 1592
                     {
1592 1593
                        if (bdtType == date.class)
1593 1594
                        {
1594
                           init = "today".equalsIgnoreCase(p.initial) ? date.today() : new date(p.initial);
1595
                           init = "today".equalsIgnoreCase(p.initial) ? new character(p.initial) : new date(p.initial);
1595 1596
                        }
1596 1597
                        else if (bdtType == datetime.class)
1597 1598
                        {
1598 1599
                           if ("now".equalsIgnoreCase(p.initial))
1599 1600
                           {
1600
                              init = datetime.now();
1601
                              init =  new character(p.initial);
1601 1602
                           }
1602 1603
                           else if (p.initial.toUpperCase().indexOf('T') > 0)
1603 1604
                           {
......
1614 1615
                        {
1615 1616
                           if ("now".equalsIgnoreCase(p.initial))
1616 1617
                           {
1617
                              init = datetimetz.now();
1618
                              init = new character(p.initial);
1618 1619
                           }
1619 1620
                           else if (p.initial.toUpperCase().indexOf('T') > 0)
1620 1621
                           {
src/com/goldencode/p2j/persist/serial/XmlImport.java 2022-10-18 08:45:19 +0000
42 42
**     OM  20220914 Use MAX-WIDTH to generate custom sized varchar columns.
43 43
**     IAS 20220926 Fixed READ-XMLSCHEMA support.
44 44
**     IAS 20221014 More fixes to READ-XMLSCHEMA support.
45
**     IAS 20221018 Fixed processing of 'now' and 'today' INITIAL attribute value.
45 46
*/
46 47

  
47 48
/*
......
1866 1867
                              // Unable to set initial value '<value>' from XML Schema for field '<field>'.
1867 1868
                              return false;
1868 1869
                           }
1869
                           
1870
                           try
1871
                           {
1872
                              Constructor<? extends BaseDataType> ctor = 
1873
                                 (Constructor<? extends BaseDataType>) fwdType.getConstructor(String.class);
1874
                              defVal = ctor.newInstance(defaultStrVal);
1875
                           }
1876
                           catch (NoSuchMethodException | IllegalAccessException | 
1877
                                  InstantiationException | InvocationTargetException e)
1878
                           {
1879
                              ErrorManager.recordOrShowError(13143, defaultStrVal, fieldName);
1880
                              // Unable to set initial value '<value>' from XML Schema for field '<field>'.
1881
                              return false;
1870
                           if (fwdType == date.class && "today".equalsIgnoreCase(defaultStrVal))
1871
                           {
1872
                                defVal = new character("today"); 
1873
                           }
1874
                           else if ((fwdType == datetime.class || fwdType == datetimetz.class) &&
1875
                                     "now".equalsIgnoreCase(defaultStrVal))
1876
                           {
1877
                              defVal = new character("now"); 
1878
                           }
1879
                           else
1880
                           {
1881
                              try
1882
                              {
1883
                                 Constructor<? extends BaseDataType> ctor = 
1884
                                    (Constructor<? extends BaseDataType>) fwdType.getConstructor(String.class);
1885
                                 defVal = ctor.newInstance(defaultStrVal);
1886
                              }
1887
                              catch (NoSuchMethodException | IllegalAccessException | 
1888
                                     InstantiationException | InvocationTargetException e)
1889
                              {
1890
                                 ErrorManager.recordOrShowError(13143, defaultStrVal, fieldName);
1891
                                 // Unable to set initial value '<value>' from XML Schema for field '<field>'.
1892
                                 return false;
1893
                              }
1882 1894
                           }
1883 1895
                        }
1884 1896