Project

General

Profile

auto_fetch_results.patch

Alexandru Lungu, 03/15/2023 06:58 AM

Download (5.22 KB)

View differences:

new/src/com/goldencode/p2j/persist/AdaptiveQuery.java 2023-03-15 10:08:49 +0000
349 349
**                           set is created, ProgressiveResults can no longer be the type returned.
350 350
**     RAA 20230221          If the query will be executed lazy, then it is no longer registered as a 
351 351
**                           listener.
352
** 178 AL2 20230315          Make dynamic results "auto fetch".
352 353
*/
353 354

  
354 355
/*
......
3932 3933
      {
3933 3934
         throw new UnsupportedOperationException();
3934 3935
      }
3936

  
3937
      /**
3938
       * Is the result delegate responsible for fetching? This is usually true when using
3939
       * query delegates which handle the fetching process already.
3940
       * 
3941
       * @return   {@code true} for complex results which also do the fetching
3942
       */
3943
      @Override
3944
      public boolean isAutoFetch()
3945
      {
3946
         return true;
3947
      }
3935 3948
      
3936 3949
      /**
3937 3950
       * Get the array of objects at the current result row.
new/src/com/goldencode/p2j/persist/PreselectQuery.java 2023-03-15 10:08:30 +0000
607 607
**                           as 'partial/incomplete'.   At this time, extent fields are always loaded.
608 608
** 177 CA  20230227          Fixed where clause translation when the external buffer's binding and definition
609 609
**                           does not match.
610
** 178 AL2 20230315          Avoid redundant fetch.
610 611
*/
611 612

  
612 613
/*
......
5877 5878
         }
5878 5879
         else
5879 5880
         {
5880
            Object[] data = available ? results.get() : null;
5881
            coreFetch(data, lockType, errorIfNull, false);
5881
            boolean alreadyFetched = available && results.isAutoFetch();
5882
            if (!alreadyFetched)
5883
            {
5884
               Object[] data = available ? results.get() : null;
5885
               coreFetch(data, lockType, errorIfNull, false);
5886
            }
5882 5887
            
5883 5888
            if (available)
5884 5889
            {
new/src/com/goldencode/p2j/persist/Results.java 2023-03-15 10:08:04 +0000
2 2
** Module   : Results.java
3 3
** Abstract : Abstraction layer interface for query results
4 4
**
5
** Copyright (c) 2006-2020, Golden Code Development Corporation.
5
** Copyright (c) 2006-2023, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- --JPRM-- ---------------------------Description------------------------------
8 8
** 001 ECF 20060214   @24711 Created initial version. Defines an API which abstracts the results
......
14 14
** 004 ECF 20190427          Fixed results caching.
15 15
** 005 SVL 20191002          Added addRow.
16 16
** 006 ECF 20200906          New ORM implementation.
17
** 007 AL2 20230315          Added isAutoFetch.
17 18
*/
18 19

  
19 20
/*
......
122 123
   public boolean isLast();
123 124
   
124 125
   /**
126
    * Is the result delegate responsible for fetching? This is usually true when using
127
    * query delegates which handle the fetching process already.
128
    * 
129
    * @return   {@code true} for complex results which also do the fetching.
130
    */
131
   default public boolean isAutoFetch() 
132
   {
133
      return false;
134
   }
135
   
136
   /**
125 137
    * Get the array of objects at the current result row.
126 138
    *
127 139
    * @return  Object array or {@code null}.
new/src/com/goldencode/p2j/persist/ResultsAdapter.java 2023-03-15 10:08:10 +0000
2 2
** Module   : ResultsAdapter.java
3 3
** Abstract : Adapter object which abstracts underlying Results implementation
4 4
**
5
** Copyright (c) 2004-2020, Golden Code Development Corporation.
5
** Copyright (c) 2004-2023, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- --JPRM-- ----------------------------Description-----------------------------
8 8
** 001 ECF 20060803   @28376 Created initial version. Adapter object which abstracts the
......
24 24
**                           to true.
25 25
** 007 ECF 20190427          Fixed results caching.
26 26
** 008 ECF 20200906          New ORM implementation.
27
** 009 AL2 20230315          Implemented isAutoFetch.
27 28
*/
28 29

  
29 30
/*
......
81 82

  
82 83
package com.goldencode.p2j.persist;
83 84

  
84
import java.io.*;
85

  
86 85
/**
87 86
 * An implementation of the {@code Results} interface which delegates all work to another {@code
88 87
 * Results} implementation.  A worker can be connected at any time using {@link #setResults}, or
......
203 202
   }
204 203
   
205 204
   /**
205
    * Is the result delegate responsible for fetching? This is usually true when using
206
    * query delegates which handle the fetching process already.
207
    * 
208
    * @return   {@code true} for complex results which also do the fetching.
209
    * 
210
    */
211
   @Override
212
   public boolean isAutoFetch()
213
   {
214
      return results.isAutoFetch();
215
   }
216
   
217
   /**
206 218
    * Get the array of objects at the current result row.
207 219
    *
208 220
    * @return  Object array or {@code null}.