Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.0.1
-
None
Description
I believe that the JDBC Control is trying to protect the end-user from causing a run-time crash by setting the default value of the array max to 1024. In the case that end-users are adjusting the value, they currently have to pick a magic number for the max value because '0' is not an option. Not allowing a value of 0 seems like a bug because some users may find 0 as the most appropriate value for the setting; in addition, an enhancement that would be helpful in the documentation would be giving some additional detail about the setting.
For example, consider changing the javadoc around arrayMaxLength in two ways: 1. warn that the value defaults to 1024 in an effort to keep unknowing end-users from getting a runtime error from trying to stuff too much data into the return array and that a value of 0 may cause a runtime failure if the runtime database returns much larger result sets than testing 2. define why arrayMaxLength is different than maxRows and that a JDBCControl method returning an array forces all processing and array contents to go into memory.
Current docs are here:
http://beehive.apache.org/docs/1.0.1/system-controls/jdbc/apidocs/javadoc/org/apache/beehive/controls/system/jdbc/JdbcControl.SQL.html#arrayMaxLength()
Repro (rev 415831)
1. build beehive
2. cd beehive/system-controls
3. ant drt
4. edit test/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/ResultsTestCtrl.jcx
- change @SQL(statement="SELECT * FROM USERS", arrayMaxLength=2)
to @SQL(statement="SELECT * FROM USERS", arrayMaxLength=0)
5. ant drt
Expected:
- no difference
Actual:
[xmlbean] Time to compile code: 2.075 seconds
[echo] ** Phase One **
Trying to override old definition of task apt
[apt] Compiling 1 source file to /home/jerjohns/projects/beehive/system-co
ntrols/build/test-classes/controls
[apt] warning: Annotation types without processors: [org.apache.beehive.co
ntrols.system.jdbc.JdbcControl.ConnectionDriver, org.apache.beehive.controls.sys
tem.jdbc.JdbcControl.SQL]
[apt] /home/jerjohns/projects/beehive/system-controls/build/test-classes/c
ontrols-generated-src/org/apache/beehive/controls/system/jdbc/test/results/Resul
tsTestCtrl.java:187: SQL annotation on method: getCustomerArrayLimitedSize : arr
ayMaxLength set to invalid value (must be greater than 0): 0
[apt] public Customer[] getCustomerArrayLimitedSize() throws SQLExcept
ion;
[apt] ^
[apt] 1 error
[apt] 1 warning