updated from comments

This commit is contained in:
Willem 2015-12-27 16:38:49 +01:00
parent ceab91eb5d
commit 8833933ebe
4 changed files with 20 additions and 15 deletions

View file

@ -20,7 +20,7 @@ FF-TPQuery is a java8 library providing templated prepared statements.
<dependency> <dependency>
<groupId>net.forwardfire.tpquery</groupId> <groupId>net.forwardfire.tpquery</groupId>
<artifactId>tpquery-store</artifactId> <artifactId>ff-tpquery-store</artifactId>
<version>1.5.0-SNAPSHOT</version> <version>1.5.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -33,9 +33,9 @@ FF-TPQuery is a java8 library providing templated prepared statements.
* readme.md - This file. * readme.md - This file.
* todo.md - Small todo list. * todo.md - Small todo list.
* src - site source. * src - site source.
* tpquery-executor-jdbc - Jdbc executor implementation. * ff-tpquery-executor-jdbc - Jdbc executor implementation.
* tpquery-executor-jpa - JPA executor implementation. * ff-tpquery-executor-jpa - JPA executor implementation.
* tpquery-store - The query store library. * ff-tpquery-store - The query store library.
## Contributing ## Contributing

View file

@ -9,7 +9,10 @@
* finish jdoc * finish jdoc
* finish site * finish site
* rename prepared writers * rename prepared writers
* check type checking; lang-or-executor
* Add jmx stats bean * Add jmx stats bean
* Add ldap support ?
* Add mongo support ?
## Ideas ## Ideas

View file

@ -77,7 +77,7 @@ public final class TPQFactory {
public void initializeConfig(TPQConfig config) { public void initializeConfig(TPQConfig config) {
// temp here move to better place. // temp here move to better place.
config.setTreePathSeperator(TPQFactory.DEFAULT_TREEPATH_SEPERATOR); config.setTreePathSeperator(TPQFactory.DEFAULT_TREEPATH_SEPERATOR);
config.setDefaultParameterNullable(DEFAULT_PARAMETER_NULLABLE); config.setDefaultParameterNullable(TPQFactory.DEFAULT_PARAMETER_NULLABLE);
config.setDefaultParameterType(TPQFactory.StatementParameter.VALUE); config.setDefaultParameterType(TPQFactory.StatementParameter.VALUE);
config.setStatementCache(new TPQStoreManagerStatementCache()); config.setStatementCache(new TPQStoreManagerStatementCache());
} }
@ -191,7 +191,7 @@ public final class TPQFactory {
public void initializeConfig(TPQConfig config) { public void initializeConfig(TPQConfig config) {
config.addStatementParameter(new TPQStatementParameterValue(VALUE)); config.addStatementParameter(new TPQStatementParameterValue(VALUE));
config.addStatementParameter(new TPQStatementParameterList(LIST)); config.addStatementParameter(new TPQStatementParameterList(LIST));
config.addStatementParameter(new TPQStatementParameterRaw(RAW,"")); config.addStatementParameter(new TPQStatementParameterRaw(RAW,"")); // TODO: write best-practice-example and remove raw* from default ?
config.addStatementParameter(new TPQStatementParameterRaw(RAW_NULL,"null")); config.addStatementParameter(new TPQStatementParameterRaw(RAW_NULL,"null"));
} }
} }
@ -250,6 +250,8 @@ public final class TPQFactory {
@Override @Override
public void initializeConfig(TPQConfig config) { public void initializeConfig(TPQConfig config) {
// pure java types
addValueType(config, JAVA_OBJECT); addValueType(config, JAVA_OBJECT);
addValueType(config, BIGDECIMAL); addValueType(config, BIGDECIMAL);
addValueType(config, BOOLEAN); addValueType(config, BOOLEAN);
@ -262,6 +264,7 @@ public final class TPQFactory {
addValueType(config, URL); addValueType(config, URL);
addValueType(config, BYTE_DATA); addValueType(config, BYTE_DATA);
// jdbc sql types
addValueType(config, SQL_ARRAY); addValueType(config, SQL_ARRAY);
addValueType(config, SQL_BLOB); addValueType(config, SQL_BLOB);
addValueType(config, SQL_CLOB); addValueType(config, SQL_CLOB);
@ -275,7 +278,6 @@ public final class TPQFactory {
addValueType(config, SQL_TIMESTAMP); addValueType(config, SQL_TIMESTAMP);
} }
// load here because in builder we like to use static fields.(as text)
private void addValueType(TPQConfig config,String className) { private void addValueType(TPQConfig config,String className) {
try { try {
config.addValueType(ClassUtils.getClass(className)); config.addValueType(ClassUtils.getClass(className));
@ -501,7 +503,7 @@ public final class TPQFactory {
private TPQueryStoreScriptEngine createScriptEngine() { private TPQueryStoreScriptEngine createScriptEngine() {
ScriptEngine engine = new ScriptEngineManager().getEngineByMimeType(DEFAULT_SCRIPT_ENGINE_MINE_TYPE); ScriptEngine engine = new ScriptEngineManager().getEngineByMimeType(DEFAULT_SCRIPT_ENGINE_MINE_TYPE);
Validate.isInstanceOf(Compilable.class, engine, "ScriptEngine does not implement Compilable interface."); Validate.isInstanceOf(Compilable.class, engine, "ScriptEngine does not implement Compilable interface.");// TODO: use TPQueryStoreScriptEngine interface list
Validate.isInstanceOf(Invocable.class, engine, "ScriptEngine does not implement Invocable interface."); Validate.isInstanceOf(Invocable.class, engine, "ScriptEngine does not implement Invocable interface.");
return (TPQueryStoreScriptEngine) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{TPQueryStoreScriptEngine.class}, new InvocationHandler() { return (TPQueryStoreScriptEngine) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{TPQueryStoreScriptEngine.class}, new InvocationHandler() {
@Override @Override

View file

@ -56,7 +56,7 @@ public class TPQStatementLanguageHql extends AbstractTPQStatementLanguage {
@Override @Override
public void appendQueryParameter(TPQueryStoreStatementMapper valueMapper) { public void appendQueryParameter(TPQueryStoreStatementMapper valueMapper) {
super.appendQueryParameter(valueMapper); super.appendQueryParameter(valueMapper);
getOutputBuffer().append(getQueryParameterMapping().size()); getOutputBuffer().append(getQueryParameterMapping().size()); // append parameter index
} }
} }
} }