File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 1+ [ Docs Home] ( ../../index.md )
2+
3+ ## DaoGen API reference
4+
5+ [ javadoc api] ( https://javadoc.io/static/org.fugerit.java/fj-core/8.0.0/org/fugerit/java/core/db/daogen/package-summary.html )
6+
7+ API Tutorial :
8+ * [ SelectHelper] ( select_helper.md )
Original file line number Diff line number Diff line change 1+ [ DaoGen API Home] ( index.md ) | [ Docs Home] ( ../../index.md )
2+
3+ # SelectHelper
4+
5+ The SelectHelper class is basically a wrapper for parameters needed in a ` java.sql.PreparedStatement `
6+
7+
8+ Here is a sample code :
9+
10+
11+ ```
12+ // SelectHelper setup
13+ BasicDAOHelper<String> daoHelper = new BasicDAOHelper<>(context);
14+ SelectHelper selectHelper = daoHelper.newSelectHelper( "fugerit.address" );
15+ // select helper is basically a query builder, it is possible to add functions, instead of the simple column name
16+ String column = String.format( "UPPER(%s)" , COL_INFO ); // will add 'UPPER(INFO)'
17+ // it is possible to transform upper case the value to be compared
18+ String value = "test address 01".toUpperCase();
19+ // this will perform an ignore case comparison, as both the column and the value are now UPPERCASE
20+ selectHelper.andEqualParam( column , value );
21+ logger.info( "sql -> {}", selectHelper.getQueryContent() ); // method getQueryContent() provides access to current query buffer
22+ // the result
23+ String res = daoHelper.loadOneHelper( selectHelper, RSE_ADDRESS_COL_INFO );
24+ logger.info( "res -> {}", res );
25+ ```
26+
27+ The method ` selectHelper.getQueryContent() ` gives access to the current query buffer.
28+
29+ You can find some examples as Junit too :
30+ * [ Simple select sample] ( ../../fj-core/src/test/java/test/org/fugerit/java/core/db/dao/daogen/TestSelectHelperSimple.java )
31+ * [ Ignore case select sample] ( ../../fj-core/src/test/java/test/org/fugerit/java/core/db/dao/daogen/TestSelectHelperUpper.java )
Original file line number Diff line number Diff line change 1010## Module fj-core index
1111
1212* [ javadoc main] ( https://www.fugerit.org/data/java/javadoc/fj-core/overview-summary.html ) / [ javadoc alt] ( https://javadoc.io/doc/org.fugerit.java/fj-core/latest/index.html )
13- * [ Validator Catalog reference] ( docs/validator/index.md )
13+ * [ Validator Catalog reference] ( docs/validator/index.md )
14+ * [ DaoGen API] ( docs/daogen/index.md )
You can’t perform that action at this time.
0 commit comments