Skip to content

Commit 619be2b

Browse files
committed
DaoGen API documentation #17
1 parent adefdc3 commit 619be2b

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

docs/daogen/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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)

docs/daogen/select_helper.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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)

index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
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)

0 commit comments

Comments
 (0)