Project

General

Profile

datetimetz_count.patch

Alexandru Lungu, 05/16/2023 02:23 AM

Download (3.53 KB)

View differences:

new/src/com/goldencode/p2j/persist/orm/DmoMeta.java 2023-05-16 06:21:59 +0000
53 53
**     ECF 20221207 Changed heuristic to extract schema name from full DMO interface name.
54 54
** 003 AL2 20230120 Compute if the underlying DMO requires extra computed columns.
55 55
** 004 AL2 20230317 Extents and date-time extra column are not computed columns; it is safe to exclude them.
56
                    Avoid lazy initializing hasComputedColumns to avoid concurrency issues.
56
**                  Avoid lazy initializing hasComputedColumns to avoid concurrency issues.
57
** 005 AL2 20230516 Cache the number of datetime-tz fields.                 
57 58
*/
58 59

  
59 60
/*
......
261 262
   /** The set of properties and their metadata, indexed by their in-memory positions. */
262 263
   private Pair<Property, PropertyMeta>[] properties = null;
263 264
   
265
   /** Number of fields of type datetime-tz. This is used to retrieve the number of tz offset columns */
266
   private Integer datetimeTzCount = null;
267
   
264 268
   /** The unique id of this DMO. */
265 269
   private final int id = idSeed.incrementAndGet();
266 270
   
......
1601 1605
      return Category.VST.name().equals(category) && systemTable.fileName.equalsIgnoreCase(legacyTable);
1602 1606
   }
1603 1607
   
1608
   /**
1609
    * Retrieve the number of fields of type datetime-tz. This should be used to detect how many
1610
    * additional tz offset columns are generated. 
1611
    * 
1612
    * @return   The number of datetime-tz fields.
1613
    */
1614
   public int getDatetimeTzCount()
1615
   {
1616
      if (datetimeTzCount == null)
1617
      {
1618
         int counter = 0;
1619
         Set<Map.Entry<String, Property>> fieldEntries = propsByName.entrySet();
1620
         for (Map.Entry<String, Property> field : fieldEntries)
1621
         {
1622
            if (field.getValue()._isDatetimeTz)
1623
            {
1624
               counter++; // datetimetz use two columns per property
1625
            }
1626
         }
1627
         datetimeTzCount = counter;
1628
      }
1629
      return datetimeTzCount;
1630
   }
1631

  
1632
   
1604 1633
   
1605 1634
   /**
1606 1635
    * Check if this DMO has computed columns in the underlying database representation. This is 
new/src/com/goldencode/p2j/persist/orm/FqlToSqlConverter.java 2023-05-16 06:21:39 +0000
54 54
**                  Fixed second pass query generation for queries with CONTAINS operator.
55 55
** 006 DDF 20230306 Skip analyzing propertyStr too see whether it is a ComputedColumn when the
56 56
**                  dialect doesn't require computed columns (refs: #7108).
57
** 006 OM  20230428 Made sure [aliases] is balanced. Avoid double-emit or skipping of FQLAst tokens.
58
*                   Fixed handling of nested SUBSELECTs. Local optimizations. Bit of code cleanup.
57
** 007 OM  20230428 Made sure [aliases] is balanced. Avoid double-emit or skipping of FQLAst tokens.
58
**                  Fixed handling of nested SUBSELECTs. Local optimizations. Bit of code cleanup.
59
** 008 AL2 20230516 Include the number of datetime-tz offset fields in the field counter.                  
59 60
*/
60 61

  
61 62
/*
......
1637 1638
            sb.append(", ");
1638 1639
         }
1639 1640
         sb.append(sqlTableAliasName).append(".*");
1640
         fieldCounter = dmoMeta.propsByName.size();
1641
         fieldCounter = dmoMeta.propsByName.size() + dmoMeta.getDatetimeTzCount();
1641 1642

  
1642 1643
         if (rowStructure != null)
1643 1644
         {