You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

package-info.java 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. /*
  2. Copyright (c) 2018 James Ahlborn
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * Jackcess has support for evaluating Access expressions (beta support as of
  15. * the 2.2.0 release). This functionality is currently disabled by default
  16. * but can be globally enabled via the system property
  17. * "com.healthmarketscience.jackcess.enableExpressionEvaluation" or
  18. * selectively enabled on a per database basis using {@link com.healthmarketscience.jackcess.Database#setEvaluateExpressions(Boolean)}.
  19. * <p/>
  20. * The expression evaluation engine implementation does its best to follow all
  21. * the warts and idiosyncracies of Access expression evaluation (both those
  22. * that are documented as well as those discovered through experimentation).
  23. * These include such things as value conversions, "Null" handling, rounding
  24. * rules, and implicit interpretations of expression in certain contexts.
  25. * <p/>
  26. * Expressions can be used in a number of different places within an Access
  27. * database. When enabled, Jackcess supports the following usage:
  28. * <ul>
  29. * <li><b>Default Values:</b> When a row is added which has a
  30. * {@code null} value for a field which has a default value
  31. * expression defined, that expression will be evaluated and the
  32. * result will be inserted for that field. Like an auto-generated
  33. * id, the generated default value will be returned in the input
  34. * row array.</li>
  35. * <li><b>Calculated Fields:</b> In databases which support calculated
  36. * fields, any input value for a calculated field will be ignored.
  37. * Instead, the result of evaluating the calculated field
  38. * expression will be inserted. Like an auto-generated id, the
  39. * calculated value will be returned in the input row array.</li>
  40. * <li><b>Field Validation:</b> Field validation rules will be
  41. * evaluated whenever a field value is updated. If the rule fails,
  42. * the update operation will fail. The failure message will
  43. * specify which field's validation rule failed and include the
  44. * custom validation rule message if defined.</li>
  45. * <li><b>Record Validation:</b> Similar to field validation rules,
  46. * record validation rules will be run for the entire record before
  47. * update. Failures are handled in a similar manner.</li>
  48. * </ul>
  49. * <p/>
  50. * <h2>Supporting Classes</h2>
  51. * <p/>
  52. * The classes in this package make up the public api for expression handling
  53. * in Jackcess. They generally fall into two categories:
  54. * <p/>
  55. * <h3>General Use Classes</h3>
  56. * <p/>
  57. * <ul>
  58. * <li>{@link com.healthmarketscience.jackcess.expr.EvalConfig} allows for customization of the expression
  59. * evaluation context for a given {@link com.healthmarketscience.jackcess.Database} instance.</li>
  60. * <li>{@link com.healthmarketscience.jackcess.expr.TemporalConfig} encapsulates date/time formatting options for
  61. * expression evaluation.</li>
  62. * <li>{@link com.healthmarketscience.jackcess.expr.NumericConfig} encapsulates number formatting options for
  63. * expression evaluation.</li>
  64. * <li>{@link com.healthmarketscience.jackcess.expr.FunctionLookup} provides a source for {@link com.healthmarketscience.jackcess.expr.Function} instances
  65. * used during expression evaluation.</li>
  66. * <li>{@link com.healthmarketscience.jackcess.expr.EvalException} wrapper exception thrown for failures which occur
  67. * during expression evaluation.</li>
  68. * <li>{@link com.healthmarketscience.jackcess.expr.ParseException} wrapper exception thrown for failures which
  69. * occur during expression parsing.</li>
  70. * </ul>
  71. * <p/>
  72. * <h3>Advanced Use Classes</h3>
  73. * <p/>
  74. * <ul>
  75. * <li>{@link com.healthmarketscience.jackcess.expr.EvalContext} encapsulates all shared state for expression
  76. * parsing and evaluation.</li>
  77. * <li>{@link com.healthmarketscience.jackcess.expr.Expression} provides an executable handle to an actual
  78. * Access expression.</li>
  79. * <li>{@link com.healthmarketscience.jackcess.expr.Function} provides an invokable handle to external functionality
  80. * to an expression.</li>
  81. * <li>{@link com.healthmarketscience.jackcess.expr.Identifier} identifies a database entity (e.g. the name of a
  82. * database field).</li>
  83. * <li>{@link com.healthmarketscience.jackcess.expr.Value} represents a typed primitive value.</li>
  84. * </ul>
  85. * <p/>
  86. * <h2>Function Support</h2>
  87. * <p/>
  88. * Jackcess supports many of the standard Access functions. The following
  89. * tables list the (hopefully) current status of support built into Jackcess.
  90. *
  91. * <h3>Conversion</h3>
  92. *
  93. * <table border="1" width="25%" cellpadding="3" cellspacing="0">
  94. * <tr class="TableHeadingColor" align="left"><th>Function</th><th>Supported</th></tr>
  95. * <tr class="TableRowColor"><td>Asc</td><td>Y</td></tr>
  96. * <tr class="TableRowColor"><td>AscW</td><td>Y</td></tr>
  97. * <tr class="TableRowColor"><td>Chr</td><td>Y</td></tr>
  98. * <tr class="TableRowColor"><td>ChrW</td><td>Y</td></tr>
  99. * <tr class="TableRowColor"><td>EuroConvert</td><td></td></tr>
  100. * <tr class="TableRowColor"><td>FormatCurrency</td><td></td></tr>
  101. * <tr class="TableRowColor"><td>FormatDateTime</td><td></td></tr>
  102. * <tr class="TableRowColor"><td>FormatNumber</td><td></td></tr>
  103. * <tr class="TableRowColor"><td>FormatPercent</td><td></td></tr>
  104. * <tr class="TableRowColor"><td>GUIDFromString</td><td></td></tr>
  105. * <tr class="TableRowColor"><td>Hex[$]</td><td>Y</td></tr>
  106. * <tr class="TableRowColor"><td>Nz</td><td>Y</td></tr>
  107. * <tr class="TableRowColor"><td>Oct[$]</td><td>Y</td></tr>
  108. * <tr class="TableRowColor"><td>Str[$]</td><td>Y</td></tr>
  109. * <tr class="TableRowColor"><td>StringFromGUID</td><td></td></tr>
  110. * <tr class="TableRowColor"><td>Val</td><td>Y</td></tr>
  111. * <tr class="TableRowColor"><td>CBool</td><td>Y</td></tr>
  112. * <tr class="TableRowColor"><td>CByte</td><td>Y</td></tr>
  113. * <tr class="TableRowColor"><td>CCur</td><td>Y</td></tr>
  114. * <tr class="TableRowColor"><td>CDate</td><td>Y</td></tr>
  115. * <tr class="TableRowColor"><td>CVDate</td><td>Y</td></tr>
  116. * <tr class="TableRowColor"><td>CDbl</td><td>Y</td></tr>
  117. * <tr class="TableRowColor"><td>CDec</td><td>Y</td></tr>
  118. * <tr class="TableRowColor"><td>CInt</td><td>Y</td></tr>
  119. * <tr class="TableRowColor"><td>CLng</td><td>Y</td></tr>
  120. * <tr class="TableRowColor"><td>CSng</td><td>Y</td></tr>
  121. * <tr class="TableRowColor"><td>CStr</td><td>Y</td></tr>
  122. * <tr class="TableRowColor"><td>CVar</td><td>Y</td></tr>
  123. * </table>
  124. *
  125. * <h3>Date/Time</h3>
  126. *
  127. * <table border="1" width="25%" cellpadding="3" cellspacing="0">
  128. * <tr class="TableHeadingColor" align="left"><th>Function</th><th>Supported</th></tr>
  129. * <tr class="TableRowColor"><td>Day</td><td>Y</td></tr>
  130. * <tr class="TableRowColor"><td>Date </td><td>Y</td></tr>
  131. * <tr class="TableRowColor"><td>DateAdd</td><td>Y</td></tr>
  132. * <tr class="TableRowColor"><td>DateDiff</td><td></td></tr>
  133. * <tr class="TableRowColor"><td>DatePart</td><td>Y</td></tr>
  134. * <tr class="TableRowColor"><td>DateSerial</td><td>Y</td></tr>
  135. * <tr class="TableRowColor"><td>DateValue</td><td>Y</td></tr>
  136. * <tr class="TableRowColor"><td>Hour</td><td>Y</td></tr>
  137. * <tr class="TableRowColor"><td>Minute</td><td>Y</td></tr>
  138. * <tr class="TableRowColor"><td>Month</td><td>Y</td></tr>
  139. * <tr class="TableRowColor"><td>MonthName</td><td>Y</td></tr>
  140. * <tr class="TableRowColor"><td>Now</td><td>Y</td></tr>
  141. * <tr class="TableRowColor"><td>Second</td><td>Y</td></tr>
  142. * <tr class="TableRowColor"><td>Time</td><td>Y</td></tr>
  143. * <tr class="TableRowColor"><td>Timer</td><td>Y</td></tr>
  144. * <tr class="TableRowColor"><td>TimeSerial</td><td>Y</td></tr>
  145. * <tr class="TableRowColor"><td>TimeValue</td><td>Y</td></tr>
  146. * <tr class="TableRowColor"><td>Weekday</td><td>Y</td></tr>
  147. * <tr class="TableRowColor"><td>WeekdayName</td><td>Y</td></tr>
  148. * <tr class="TableRowColor"><td>Year</td><td>Y</td></tr>
  149. * </table>
  150. *
  151. * <h3>Financial</h3>
  152. *
  153. * <table border="1" width="25%" cellpadding="3" cellspacing="0">
  154. * <tr class="TableHeadingColor" align="left"><th>Function</th><th>Supported</th></tr>
  155. * <tr class="TableRowColor"><td>DDB</td><td>Y</td></tr>
  156. * <tr class="TableRowColor"><td>FV</td><td>Y</td></tr>
  157. * <tr class="TableRowColor"><td>IPmt</td><td>Y</td></tr>
  158. * <tr class="TableRowColor"><td>NPer</td><td>Y</td></tr>
  159. * <tr class="TableRowColor"><td>Pmt</td><td>Y</td></tr>
  160. * <tr class="TableRowColor"><td>PPmt</td><td>Y</td></tr>
  161. * <tr class="TableRowColor"><td>PV</td><td>Y</td></tr>
  162. * <tr class="TableRowColor"><td>Rate</td><td>Y</td></tr>
  163. * <tr class="TableRowColor"><td>SLN</td><td>Y</td></tr>
  164. * <tr class="TableRowColor"><td>SYD</td><td>Y</td></tr>
  165. * </table>
  166. *
  167. * <h3>Inspection</h3>
  168. *
  169. * <table border="1" width="25%" cellpadding="3" cellspacing="0">
  170. * <tr class="TableHeadingColor" align="left"><th>Function</th><th>Supported</th></tr>
  171. * <tr class="TableRowColor"><td>IsDate</td><td>Partial</td></tr>
  172. * <tr class="TableRowColor"><td>IsEmpty</td><td></td></tr>
  173. * <tr class="TableRowColor"><td>IsError</td><td></td></tr>
  174. * <tr class="TableRowColor"><td>IsMissing</td><td></td></tr>
  175. * <tr class="TableRowColor"><td>IsNull</td><td>Y</td></tr>
  176. * <tr class="TableRowColor"><td>IsNumeric</td><td>Y</td></tr>
  177. * <tr class="TableRowColor"><td>IsObject</td><td></td></tr>
  178. * <tr class="TableRowColor"><td>TypeName</td><td>Y</td></tr>
  179. * <tr class="TableRowColor"><td>VarType</td><td>Y</td></tr>
  180. * </table>
  181. *
  182. * <h3>Math</h3>
  183. *
  184. * <table border="1" width="25%" cellpadding="3" cellspacing="0">
  185. * <tr class="TableHeadingColor" align="left"><th>Function</th><th>Supported</th></tr>
  186. * <tr class="TableRowColor"><td>Abs</td><td>Y</td></tr>
  187. * <tr class="TableRowColor"><td>Atn</td><td>Y</td></tr>
  188. * <tr class="TableRowColor"><td>Cos</td><td>Y</td></tr>
  189. * <tr class="TableRowColor"><td>Exp</td><td>Y</td></tr>
  190. * <tr class="TableRowColor"><td>Int</td><td>Y</td></tr>
  191. * <tr class="TableRowColor"><td>Fix</td><td>Y</td></tr>
  192. * <tr class="TableRowColor"><td>Log</td><td>Y</td></tr>
  193. * <tr class="TableRowColor"><td>Rnd</td><td>Y</td></tr>
  194. * <tr class="TableRowColor"><td>Round</td><td>Y</td></tr>
  195. * <tr class="TableRowColor"><td>Sgn</td><td>Y</td></tr>
  196. * <tr class="TableRowColor"><td>Sin</td><td>Y</td></tr>
  197. * <tr class="TableRowColor"><td>Sqr</td><td>Y</td></tr>
  198. * <tr class="TableRowColor"><td>Tan</td><td>Y</td></tr>
  199. * </table>
  200. *
  201. * <h3>Program Flow</h3>
  202. *
  203. * <table border="1" width="25%" cellpadding="3" cellspacing="0">
  204. * <tr class="TableHeadingColor" align="left"><th>Function</th><th>Supported</th></tr>
  205. * <tr class="TableRowColor"><td>Choose</td><td>Y</td></tr>
  206. * <tr class="TableRowColor"><td>IIf</td><td>Y</td></tr>
  207. * <tr class="TableRowColor"><td>Switch</td><td>Y</td></tr>
  208. * </table>
  209. *
  210. * <h3>Text</h3>
  211. *
  212. * <table border="1" width="25%" cellpadding="3" cellspacing="0">
  213. * <tr class="TableHeadingColor" align="left"><th>Function</th><th>Supported</th></tr>
  214. * <tr class="TableRowColor"><td>Format[$]</td><td></td></tr>
  215. * <tr class="TableRowColor"><td>InStr</td><td>Y</td></tr>
  216. * <tr class="TableRowColor"><td>InStrRev</td><td>Y</td></tr>
  217. * <tr class="TableRowColor"><td>LCase[$]</td><td>Y</td></tr>
  218. * <tr class="TableRowColor"><td>Left[$]</td><td>Y</td></tr>
  219. * <tr class="TableRowColor"><td>Len</td><td>Y</td></tr>
  220. * <tr class="TableRowColor"><td>LTrim[$]</td><td>Y</td></tr>
  221. * <tr class="TableRowColor"><td>RTrim[$]</td><td>Y</td></tr>
  222. * <tr class="TableRowColor"><td>Trim[$]</td><td>Y</td></tr>
  223. * <tr class="TableRowColor"><td>Mid[$]</td><td>Y</td></tr>
  224. * <tr class="TableRowColor"><td>Replace</td><td>Y</td></tr>
  225. * <tr class="TableRowColor"><td>Right[$]</td><td>Y</td></tr>
  226. * <tr class="TableRowColor"><td>Space[$]</td><td>Y</td></tr>
  227. * <tr class="TableRowColor"><td>StrComp</td><td>Y</td></tr>
  228. * <tr class="TableRowColor"><td>StrConv[$]</td><td>Partial</td></tr>
  229. * <tr class="TableRowColor"><td>String[$]</td><td>Y</td></tr>
  230. * <tr class="TableRowColor"><td>StrReverse</td><td>Y</td></tr>
  231. * <tr class="TableRowColor"><td>UCase[$]</td><td>Y</td></tr>
  232. * </table>
  233. *
  234. *
  235. *
  236. */
  237. package com.healthmarketscience.jackcess.expr;