Renamed artifacts
This commit is contained in:
parent
79adfa251f
commit
eac98ca311
127 changed files with 18 additions and 17 deletions
|
|
@ -1,19 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>net.forwardfire.tpquery</groupId>
|
||||
<artifactId>tpquery</artifactId>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>tpquery-executor-jdbc</artifactId>
|
||||
<name>TPQuery Executor JDBC</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>tpquery-store</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2015, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.forwardfire.tpquery.store.executor.jdbc;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Wrap the SQLException as RuntimeException.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2015
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SQLExceptionRuntime extends RuntimeException {
|
||||
|
||||
protected SQLExceptionRuntime(SQLException parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the SQLException to an SQLExceptionRuntime.
|
||||
* @param e The SQLException to wrap.
|
||||
* @return The new SQLExceptionRuntime.
|
||||
*/
|
||||
public static SQLExceptionRuntime wrap(SQLException e) {
|
||||
return new SQLExceptionRuntime(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps and closes.
|
||||
* note: this is needed because with try-with-resources the compiler produces unreachable bytecode.
|
||||
*
|
||||
* @param closeable The auto closeable to close.
|
||||
* @param e The sql exception to wrap.
|
||||
* @return The new SQLExceptionRuntime.
|
||||
*/
|
||||
public static SQLExceptionRuntime wrapAndClose(AutoCloseable closeable,SQLException e) {
|
||||
return close(closeable,wrap(e));
|
||||
}
|
||||
|
||||
protected static SQLExceptionRuntime close(AutoCloseable closeable,SQLExceptionRuntime parent) {
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (Exception ee) {
|
||||
parent.addSuppressed(ee);
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2015, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.forwardfire.tpquery.store.executor.jdbc;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import net.forwardfire.tpquery.TPQFactory;
|
||||
import net.forwardfire.tpquery.store.executor.AbstractTPQExecutor;
|
||||
import net.forwardfire.tpquery.store.executor.TPQExecutorContext;
|
||||
|
||||
/**
|
||||
* The jdbc query executor.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2015
|
||||
*/
|
||||
public class TPQExecutorJdbc extends AbstractTPQExecutor<Connection,PreparedStatement> {
|
||||
|
||||
/**
|
||||
* Created the jdbc query executor.
|
||||
* @param context The executor context.
|
||||
*/
|
||||
public TPQExecutorJdbc(TPQExecutorContext context) {
|
||||
super(context);
|
||||
registrateStatementCreator(TPQFactory.StatementLanguage.SQL, (connection,statementText) -> {
|
||||
try {
|
||||
return connection.prepareStatement(statementText);
|
||||
} catch (SQLException e) {
|
||||
throw SQLExceptionRuntime.wrap(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Short hand to parameter-less queries.
|
||||
* @param connection The connection to create the prepared statement.
|
||||
* @param queryName The query to execute.
|
||||
* @return The executed prepared statement.
|
||||
*/
|
||||
public PreparedStatement execute(Connection connection,String queryName) {
|
||||
return execute(connection, queryName, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes and prepared statement.
|
||||
* @param connection The connection to create the prepared statement.
|
||||
* @param queryName The query to execute.
|
||||
* @param parameters The query parameters.
|
||||
* @return The executed prepared statement.
|
||||
*/
|
||||
public PreparedStatement execute(Connection connection,String queryName,Map<String,Object> parameters) {
|
||||
return execute(createPreparedStatement(connection, queryName, parameters));
|
||||
}
|
||||
|
||||
protected PreparedStatement execute(PreparedStatement statement) {
|
||||
Validate.notNull(statement,"Can't execute with null statement.");
|
||||
try {
|
||||
statement.execute();
|
||||
return statement;
|
||||
} catch (SQLException e) {
|
||||
throw SQLExceptionRuntime.wrapAndClose(statement, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int executeUpdate(PreparedStatement statement) {
|
||||
Validate.notNull(statement,"Can't execute update with null statement.");
|
||||
try {
|
||||
int result = statement.executeUpdate();
|
||||
statement.close();
|
||||
return result;
|
||||
} catch (SQLException e) {
|
||||
throw SQLExceptionRuntime.wrapAndClose(statement, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void prepareParameterValue(PreparedStatement statement,int index, Object value) {
|
||||
try {
|
||||
statement.setObject(index,value);
|
||||
} catch (SQLException e) {
|
||||
throw SQLExceptionRuntime.wrap(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void prepareTimeout(PreparedStatement statement, Integer timeout) {
|
||||
try {
|
||||
statement.setQueryTimeout(timeout);
|
||||
} catch (SQLException e) {
|
||||
throw SQLExceptionRuntime.wrap(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
/**
|
||||
* Default jdbc executor.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
*/
|
||||
package net.forwardfire.tpquery.store.executor.jdbc;
|
||||
|
|
@ -1,240 +0,0 @@
|
|||
package net.forwardfire.tpquery.store.executor.jdbc;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.tpquery.TPQManager;
|
||||
import net.forwardfire.tpquery.TPQFactory;
|
||||
import net.forwardfire.tpquery.store.executor.jdbc.SQLExceptionRuntime;
|
||||
import net.forwardfire.tpquery.store.executor.jdbc.TPQExecutorJdbc;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
|
||||
public class TPQExecutorJdbcTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void setupLogging() {
|
||||
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||
lc.reset(); // disable logging
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testAutoClose() throws Exception {
|
||||
SQLExceptionRuntime e = new SQLExceptionRuntime(new SQLException("junit"));
|
||||
SQLExceptionRuntime.close(new AutoCloseable() {
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
throw new IllegalArgumentException("test");
|
||||
}
|
||||
}, e);
|
||||
assertTrue(e.getSuppressed().length>0);
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testExecuteUpdateNull() throws Exception {
|
||||
try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:test;")) {
|
||||
TPQManager store = TPQFactory
|
||||
.createManagerBuilder()
|
||||
.createQuerySet("junit", "jar:junit:mem")
|
||||
.setLanguage(TPQFactory.StatementLanguage.SQL)
|
||||
.createQuery("createTable").appendText("CREATE TABLE test_table (id serial,data int)").build()
|
||||
.createQuery("insertData").appendText("INSERT INTO test_table (data) VALUES (0)").build()
|
||||
.createQuery("queryFail")
|
||||
.parseStatement("update test_table tt set tt.data=$$data$$")
|
||||
.createQueryParameter("data", Integer.class.getName())
|
||||
.setNullable(true)
|
||||
.build()
|
||||
.build()
|
||||
.createQuery("selectData").appendText("SELECT * FROM test_table").build()
|
||||
.createQuery("selectDataNull")
|
||||
.parseStatement("SELECT * FROM test_table tt WHERE (tt.data=$$data$$ OR ($$data$$ IS NULL AND tt.data IS NULL))")
|
||||
.createQueryParameter("data", Integer.class.getName())
|
||||
.setNullable(true)
|
||||
.build()
|
||||
.build()
|
||||
.build()
|
||||
.build();
|
||||
|
||||
TPQExecutorJdbc exe = new TPQExecutorJdbc(store.getQueryExecutorContext());
|
||||
exe.executeUpdate(connection, "junit.createTable");
|
||||
exe.executeUpdate(connection, "junit.insertData");
|
||||
|
||||
printData(exe.execute(connection, "junit.selectData"));
|
||||
|
||||
exe.executeUpdate(connection, "junit.queryFail");
|
||||
|
||||
printData(exe.execute(connection, "junit.selectData"));
|
||||
|
||||
Map<String,Object> testData = new HashMap<>();
|
||||
testData.put("data",null);
|
||||
|
||||
printData(exe.execute(connection, "junit.selectDataNull",testData));
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=SQLExceptionRuntime.class)
|
||||
public void testExecuteUpdateFail() throws Exception {
|
||||
try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:test;")) {
|
||||
TPQManager store = TPQFactory
|
||||
.createManagerBuilder()
|
||||
.createQuerySet("junit", "jar:junit:mem")
|
||||
.setLanguage(TPQFactory.StatementLanguage.SQL)
|
||||
.createQuery("createTable").appendText("CREATE TABLE test_table (id serial,data int)").build()
|
||||
.createQuery("insertData").appendText("INSERT INTO test_table (data) VALUES (0)").build()
|
||||
.createQuery("queryFail").appendText("update test_table tt set tt.data=10/(SELECT sum(t1.data) FROM test_table t1)").build()
|
||||
.build()
|
||||
.build();
|
||||
|
||||
TPQExecutorJdbc exe = new TPQExecutorJdbc(store.getQueryExecutorContext());
|
||||
exe.executeUpdate(connection, "junit.createTable");
|
||||
exe.executeUpdate(connection, "junit.insertData");
|
||||
exe.executeUpdate(connection, "junit.queryFail"); // runtime data failure, as prepared will go correctly
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=SQLExceptionRuntime.class)
|
||||
public void testExecuteSelectFail() throws Exception {
|
||||
try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:test;")) {
|
||||
|
||||
TPQManager store = TPQFactory
|
||||
.createManagerBuilder()
|
||||
.createQuerySet("junit", "jar:junit:mem")
|
||||
.setLanguage(TPQFactory.StatementLanguage.SQL)
|
||||
.createQuery("createTable").appendText("CREATE TABLE test_table (id serial,data int)").build()
|
||||
.createQuery("insertData").appendText("INSERT INTO test_table (data) VALUES (0)").build()
|
||||
.createQuery("queryFail").appendText("select tt.* from test_table tt where tt.data=10/(SELECT sum(t1.data) FROM test_table t1)").build()
|
||||
.build()
|
||||
.build();
|
||||
|
||||
TPQExecutorJdbc exe = new TPQExecutorJdbc(store.getQueryExecutorContext());
|
||||
exe.executeUpdate(connection, "junit.createTable");
|
||||
exe.executeUpdate(connection, "junit.insertData");
|
||||
exe.execute(connection, "junit.queryFail"); // runtime data failure, as prepared will go correctly
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=SQLExceptionRuntime.class)
|
||||
public void testExecuteSelectFailPrepare() throws Exception {
|
||||
try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:test;")) {
|
||||
TPQManager store = TPQFactory.createManagerBuilder()
|
||||
.createQuerySet("junit", "jar:junit:mem:testcaseFail")
|
||||
.setLanguage(TPQFactory.StatementLanguage.SQL)
|
||||
.createQuery("sql-fail").appendText("select * from article").build()
|
||||
.build()
|
||||
.build();
|
||||
TPQExecutorJdbc exe = new TPQExecutorJdbc(store.getQueryExecutorContext());
|
||||
exe.execute(connection, "junit.sql-fail");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=SQLExceptionRuntime.class)
|
||||
public void testTimeoutFail() throws Exception {
|
||||
try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:test;")) {
|
||||
TPQManager store = TPQFactory.createManagerBuilder()
|
||||
.createQuerySet("junit", "jar:junit:mem:test")
|
||||
.setLanguage(TPQFactory.StatementLanguage.SQL)
|
||||
.createQuery("createTable").appendText("CREATE TABLE test_table (id serial,data int)").build()
|
||||
.createQuery("test").appendText("select * from test_table").build()
|
||||
.build()
|
||||
.build();
|
||||
TPQExecutorJdbc exe = new TPQExecutorJdbc(store.getQueryExecutorContext());
|
||||
exe.executeUpdate(connection, "junit.createTable");
|
||||
PreparedStatement ps = exe.createPreparedStatement(connection, "junit.test", null);
|
||||
ps.close();
|
||||
exe.prepareTimeout(ps, 123);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=SQLExceptionRuntime.class)
|
||||
public void testParameterFail() throws Exception {
|
||||
try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:test;")) {
|
||||
TPQManager store = TPQFactory.createManagerBuilder()
|
||||
.createQuerySet("junit", "jar:junit:mem:test")
|
||||
.setLanguage(TPQFactory.StatementLanguage.SQL)
|
||||
.createQuery("createTable").appendText("CREATE TABLE test_table (id serial,data int)").build()
|
||||
.createQuery("test").appendText("select * from test_table").build()
|
||||
.build()
|
||||
.build();
|
||||
TPQExecutorJdbc exe = new TPQExecutorJdbc(store.getQueryExecutorContext());
|
||||
exe.executeUpdate(connection, "junit.createTable");
|
||||
PreparedStatement ps = exe.createPreparedStatement(connection, "junit.test", null);
|
||||
exe.prepareParameterValue(ps, 1, 123);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteBig() throws Exception {
|
||||
int sizeFactor = 1;
|
||||
try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:test;")) {
|
||||
TPQManager queryStore = TPQFactory.createManagerBuilder().readQuerySet("net/forwardfire/tpquery/executor/jdbc/test-big.xml").build();
|
||||
TPQExecutorJdbc exe = new TPQExecutorJdbc(queryStore.getQueryExecutorContext());
|
||||
//Thread.sleep(1000*5);
|
||||
|
||||
System.out.println("Creating big table...");
|
||||
int insertCount = exe.executeUpdate(connection, "TestBig.createTable");
|
||||
assertEquals(0,insertCount);
|
||||
|
||||
System.out.println("Creating big test table data...");
|
||||
Map<String,Object> testData = new HashMap<String,Object>();
|
||||
for (int i=0;i<50*sizeFactor;i++) {
|
||||
testData.put("id", i);
|
||||
for (int c=0;c<100;c++) {
|
||||
String colName = String.format("col%03d", c);
|
||||
testData.put(colName, ""+i+c);
|
||||
}
|
||||
insertCount = exe.executeUpdate(connection, "TestBig.insert",testData);
|
||||
assertEquals(1,insertCount);
|
||||
}
|
||||
|
||||
System.out.println("Selecting big test table data...");
|
||||
int rows = 0;
|
||||
testData = new HashMap<String,Object>();
|
||||
for (int i=1;i<30*sizeFactor;i++) {
|
||||
testData.put("col001", ""+1*i);
|
||||
testData.put("col002", ""+2+i);
|
||||
testData.put("col003", ""+3/i);
|
||||
testData.put("col004", ""+4+i);
|
||||
testData.put("col005", ""+5/i);
|
||||
testData.put("col006", ""+6*i);
|
||||
testData.put("col007", ""+7+i);
|
||||
testData.put("col008", ""+8/i);
|
||||
testData.put("col009", ""+9*i);
|
||||
testData.put("col000", ""+0+i);
|
||||
PreparedStatement ps = exe.execute(connection, "TestBig.getBy10Cols", testData);
|
||||
//ps.getParameterMetaData();
|
||||
ResultSet rs = ps.getResultSet();
|
||||
while (rs.next()) {
|
||||
rows++;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Done...rows: "+rows);
|
||||
}
|
||||
}
|
||||
|
||||
private void printData(PreparedStatement ps) throws SQLException {
|
||||
ResultSet rs = ps.getResultSet();
|
||||
ps.getParameterMetaData();
|
||||
|
||||
while (rs.next()) {
|
||||
System.out.println("data record:");
|
||||
for (int i=1;i<=ps.getMetaData().getColumnCount();i++) {
|
||||
String name = ps.getMetaData().getColumnName(i);
|
||||
Object value = rs.getObject(i);
|
||||
System.out.println("column: "+name+" value: "+value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,289 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<query-set name="TestBig" language="SQL">
|
||||
<query name="createTable" timeout="2000">
|
||||
<statement>CREATE TABLE test_big (
|
||||
id serial,
|
||||
col000 text,col001 text,col002 text,col003 text,col004 text,col005 text,col006 text,col007 text,col008 text,col009 text,
|
||||
col010 text,col011 text,col012 text,col013 text,col014 text,col015 text,col016 text,col017 text,col018 text,col019 text,
|
||||
col020 text,col021 text,col022 text,col023 text,col024 text,col025 text,col026 text,col027 text,col028 text,col029 text,
|
||||
col030 text,col031 text,col032 text,col033 text,col034 text,col035 text,col036 text,col037 text,col038 text,col039 text,
|
||||
col040 text,col041 text,col042 text,col043 text,col044 text,col045 text,col046 text,col047 text,col048 text,col049 text,
|
||||
col050 text,col051 text,col052 text,col053 text,col054 text,col055 text,col056 text,col057 text,col058 text,col059 text,
|
||||
col060 text,col061 text,col062 text,col063 text,col064 text,col065 text,col066 text,col067 text,col068 text,col069 text,
|
||||
col070 text,col071 text,col072 text,col073 text,col074 text,col075 text,col076 text,col077 text,col078 text,col079 text,
|
||||
col080 text,col081 text,col082 text,col083 text,col084 text,col085 text,col086 text,col087 text,col088 text,col089 text,
|
||||
col090 text,col091 text,col092 text,col093 text,col094 text,col095 text,col096 text,col097 text,col098 text,col099 text
|
||||
)
|
||||
</statement>
|
||||
</query>
|
||||
<query name="insertPara">
|
||||
<description>Tests insert parameters as raw</description>
|
||||
<statement>INSERT INTO test_big ($$col_names$$) VALUES ($$col_values$$)</statement>
|
||||
<parameter name="col_names" type="RAW" valueType="text"/>
|
||||
<parameter name="col_values" type="LIST" valueType="text"/>
|
||||
</query>
|
||||
<query name="insert">
|
||||
<statement>INSERT INTO test_big (
|
||||
id,
|
||||
$$inc:TestBig.inc.select.col00X$$ ,
|
||||
$$inc:TestBig.inc.select.col01X$$ ,
|
||||
$$inc:TestBig.inc.select.col02X$$ ,
|
||||
$$inc:TestBig.inc.select.col03X$$ ,
|
||||
$$inc:TestBig.inc.select.col04X$$ ,
|
||||
$$inc:TestBig.inc.select.col05X$$ ,
|
||||
$$inc:TestBig.inc.select.col06X$$ ,
|
||||
$$inc:TestBig.inc.select.col07X$$ ,
|
||||
$$inc:TestBig.inc.select.col08X$$ ,
|
||||
$$inc:TestBig.inc.select.col09X$$
|
||||
) VALUES (
|
||||
$$id$$ ,
|
||||
$$col000$$ ,$$col001$$ ,$$col002$$ ,$$col003$$ ,$$col004$$ ,$$col005$$ ,$$col006$$ ,$$col007$$ ,$$col008$$ ,$$col009$$ ,
|
||||
$$col010$$ ,$$col011$$ ,$$col012$$ ,$$col013$$ ,$$col014$$ ,$$col015$$ ,$$col016$$ ,$$col017$$ ,$$col018$$ ,$$col019$$ ,
|
||||
$$col020$$ ,$$col021$$ ,$$col022$$ ,$$col023$$ ,$$col024$$ ,$$col025$$ ,$$col026$$ ,$$col027$$ ,$$col028$$ ,$$col029$$ ,
|
||||
$$col030$$ ,$$col031$$ ,$$col032$$ ,$$col033$$ ,$$col034$$ ,$$col035$$ ,$$col036$$ ,$$col037$$ ,$$col038$$ ,$$col039$$ ,
|
||||
$$col040$$ ,$$col041$$ ,$$col042$$ ,$$col043$$ ,$$col044$$ ,$$col045$$ ,$$col046$$ ,$$col047$$ ,$$col048$$ ,$$col049$$ ,
|
||||
$$col050$$ ,$$col051$$ ,$$col052$$ ,$$col053$$ ,$$col054$$ ,$$col055$$ ,$$col056$$ ,$$col057$$ ,$$col058$$ ,$$col059$$ ,
|
||||
$$col060$$ ,$$col061$$ ,$$col062$$ ,$$col063$$ ,$$col064$$ ,$$col065$$ ,$$col066$$ ,$$col067$$ ,$$col068$$ ,$$col069$$ ,
|
||||
$$col070$$ ,$$col071$$ ,$$col072$$ ,$$col073$$ ,$$col074$$ ,$$col075$$ ,$$col076$$ ,$$col077$$ ,$$col078$$ ,$$col079$$ ,
|
||||
$$col080$$ ,$$col081$$ ,$$col082$$ ,$$col083$$ ,$$col084$$ ,$$col085$$ ,$$col086$$ ,$$col087$$ ,$$col088$$ ,$$col089$$ ,
|
||||
$$col090$$ ,$$col091$$ ,$$col092$$ ,$$col093$$ ,$$col094$$ ,$$col095$$ ,$$col096$$ ,$$col097$$ ,$$col098$$ ,$$col099$$
|
||||
)
|
||||
</statement>
|
||||
<parameter name="id" valueType="int" />
|
||||
<parameter name="col000" valueType="java.lang.String" />
|
||||
<parameter name="col001" valueType="java.lang.String" />
|
||||
<parameter name="col002" valueType="java.lang.String" />
|
||||
<parameter name="col003" valueType="java.lang.String" />
|
||||
<parameter name="col004" valueType="java.lang.String" />
|
||||
<parameter name="col005" valueType="java.lang.String" />
|
||||
<parameter name="col006" valueType="java.lang.String" />
|
||||
<parameter name="col007" valueType="java.lang.String" />
|
||||
<parameter name="col008" valueType="java.lang.String" />
|
||||
<parameter name="col009" valueType="java.lang.String" />
|
||||
|
||||
<parameter name="col010" valueType="java.lang.String" />
|
||||
<parameter name="col011" valueType="java.lang.String" />
|
||||
<parameter name="col012" valueType="java.lang.String" />
|
||||
<parameter name="col013" valueType="java.lang.String" />
|
||||
<parameter name="col014" valueType="java.lang.String" />
|
||||
<parameter name="col015" valueType="java.lang.String" />
|
||||
<parameter name="col016" valueType="java.lang.String" />
|
||||
<parameter name="col017" valueType="java.lang.String" />
|
||||
<parameter name="col018" valueType="java.lang.String" />
|
||||
<parameter name="col019" valueType="java.lang.String" />
|
||||
|
||||
<parameter name="col020" valueType="java.lang.String" />
|
||||
<parameter name="col021" valueType="java.lang.String" />
|
||||
<parameter name="col022" valueType="java.lang.String" />
|
||||
<parameter name="col023" valueType="java.lang.String" />
|
||||
<parameter name="col024" valueType="java.lang.String" />
|
||||
<parameter name="col025" valueType="java.lang.String" />
|
||||
<parameter name="col026" valueType="java.lang.String" />
|
||||
<parameter name="col027" valueType="java.lang.String" />
|
||||
<parameter name="col028" valueType="java.lang.String" />
|
||||
<parameter name="col029" valueType="java.lang.String" />
|
||||
|
||||
<parameter name="col030" valueType="java.lang.String" />
|
||||
<parameter name="col031" valueType="java.lang.String" />
|
||||
<parameter name="col032" valueType="java.lang.String" />
|
||||
<parameter name="col033" valueType="java.lang.String" />
|
||||
<parameter name="col034" valueType="java.lang.String" />
|
||||
<parameter name="col035" valueType="java.lang.String" />
|
||||
<parameter name="col036" valueType="java.lang.String" />
|
||||
<parameter name="col037" valueType="java.lang.String" />
|
||||
<parameter name="col038" valueType="java.lang.String" />
|
||||
<parameter name="col039" valueType="java.lang.String" />
|
||||
|
||||
<parameter name="col040" valueType="java.lang.String" />
|
||||
<parameter name="col041" valueType="java.lang.String" />
|
||||
<parameter name="col042" valueType="java.lang.String" />
|
||||
<parameter name="col043" valueType="java.lang.String" />
|
||||
<parameter name="col044" valueType="java.lang.String" />
|
||||
<parameter name="col045" valueType="java.lang.String" />
|
||||
<parameter name="col046" valueType="java.lang.String" />
|
||||
<parameter name="col047" valueType="java.lang.String" />
|
||||
<parameter name="col048" valueType="java.lang.String" />
|
||||
<parameter name="col049" valueType="java.lang.String" />
|
||||
|
||||
<parameter name="col050" valueType="java.lang.String" />
|
||||
<parameter name="col051" valueType="java.lang.String" />
|
||||
<parameter name="col052" valueType="java.lang.String" />
|
||||
<parameter name="col053" valueType="java.lang.String" />
|
||||
<parameter name="col054" valueType="java.lang.String" />
|
||||
<parameter name="col055" valueType="java.lang.String" />
|
||||
<parameter name="col056" valueType="java.lang.String" />
|
||||
<parameter name="col057" valueType="java.lang.String" />
|
||||
<parameter name="col058" valueType="java.lang.String" />
|
||||
<parameter name="col059" valueType="java.lang.String" />
|
||||
|
||||
<parameter name="col060" valueType="java.lang.String" />
|
||||
<parameter name="col061" valueType="java.lang.String" />
|
||||
<parameter name="col062" valueType="java.lang.String" />
|
||||
<parameter name="col063" valueType="java.lang.String" />
|
||||
<parameter name="col064" valueType="java.lang.String" />
|
||||
<parameter name="col065" valueType="java.lang.String" />
|
||||
<parameter name="col066" valueType="java.lang.String" />
|
||||
<parameter name="col067" valueType="java.lang.String" />
|
||||
<parameter name="col068" valueType="java.lang.String" />
|
||||
<parameter name="col069" valueType="java.lang.String" />
|
||||
|
||||
<parameter name="col070" valueType="java.lang.String" />
|
||||
<parameter name="col071" valueType="java.lang.String" />
|
||||
<parameter name="col072" valueType="java.lang.String" />
|
||||
<parameter name="col073" valueType="java.lang.String" />
|
||||
<parameter name="col074" valueType="java.lang.String" />
|
||||
<parameter name="col075" valueType="java.lang.String" />
|
||||
<parameter name="col076" valueType="java.lang.String" />
|
||||
<parameter name="col077" valueType="java.lang.String" />
|
||||
<parameter name="col078" valueType="java.lang.String" />
|
||||
<parameter name="col079" valueType="java.lang.String" />
|
||||
|
||||
<parameter name="col080" valueType="java.lang.String" />
|
||||
<parameter name="col081" valueType="java.lang.String" />
|
||||
<parameter name="col082" valueType="java.lang.String" />
|
||||
<parameter name="col083" valueType="java.lang.String" />
|
||||
<parameter name="col084" valueType="java.lang.String" />
|
||||
<parameter name="col085" valueType="java.lang.String" />
|
||||
<parameter name="col086" valueType="java.lang.String" />
|
||||
<parameter name="col087" valueType="java.lang.String" />
|
||||
<parameter name="col088" valueType="java.lang.String" />
|
||||
<parameter name="col089" valueType="java.lang.String" />
|
||||
|
||||
<parameter name="col090" valueType="java.lang.String" />
|
||||
<parameter name="col091" valueType="java.lang.String" />
|
||||
<parameter name="col092" valueType="java.lang.String" />
|
||||
<parameter name="col093" valueType="java.lang.String" />
|
||||
<parameter name="col094" valueType="java.lang.String" />
|
||||
<parameter name="col095" valueType="java.lang.String" />
|
||||
<parameter name="col096" valueType="java.lang.String" />
|
||||
<parameter name="col097" valueType="java.lang.String" />
|
||||
<parameter name="col098" valueType="java.lang.String" />
|
||||
<parameter name="col099" valueType="java.lang.String" />
|
||||
</query>
|
||||
|
||||
<query name="getAll">
|
||||
<statement>
|
||||
$$inc:TestBig.inc.selectWhere$$
|
||||
$$inc:TestBig.inc.orderBy$$
|
||||
</statement>
|
||||
</query>
|
||||
<query name="getBy10Cols">
|
||||
<statement>
|
||||
$$inc:TestBig.inc.selectWhere$$
|
||||
$$inc:TestBig.inc.where.col000$$
|
||||
$$inc:TestBig.inc.where.col001$$
|
||||
$$inc:TestBig.inc.where.col002$$
|
||||
$$inc:TestBig.inc.where.col003$$
|
||||
$$inc:TestBig.inc.where.col004$$
|
||||
$$inc:TestBig.inc.where.col005$$
|
||||
$$inc:TestBig.inc.where.col006$$
|
||||
$$inc:TestBig.inc.where.col007$$
|
||||
$$inc:TestBig.inc.where.col008$$
|
||||
$$inc:TestBig.inc.where.col009$$
|
||||
$$inc:TestBig.inc.orderBy$$
|
||||
</statement>
|
||||
</query>
|
||||
<query-set name="inc" template="true">
|
||||
<query-set name="select">
|
||||
<query name="col00X">
|
||||
<statement>col000,col001,col002,col003,col004,col005,col006,col007,col008,col009</statement>
|
||||
</query>
|
||||
<query name="col01X">
|
||||
<statement>col010,col011,col012,col013,col014,col015,col016,col017,col018,col019</statement>
|
||||
</query>
|
||||
<query name="col02X">
|
||||
<statement>col020,col021,col022,col023,col024,col025,col026,col027,col028,col029</statement>
|
||||
</query>
|
||||
<query name="col03X">
|
||||
<statement>col030,col031,col032,col033,col034,col035,col036,col037,col038,col039</statement>
|
||||
</query>
|
||||
<query name="col04X">
|
||||
<statement>col040,col041,col042,col043,col044,col045,col046,col047,col048,col049</statement>
|
||||
</query>
|
||||
<query name="col05X">
|
||||
<statement>col050,col051,col052,col053,col054,col055,col056,col057,col058,col059</statement>
|
||||
</query>
|
||||
<query name="col06X">
|
||||
<statement>col060,col061,col062,col063,col064,col065,col066,col067,col068,col069</statement>
|
||||
</query>
|
||||
<query name="col07X">
|
||||
<statement>col070,col071,col072,col073,col074,col075,col076,col077,col078,col079</statement>
|
||||
</query>
|
||||
<query name="col08X">
|
||||
<statement>col080,col081,col082,col083,col084,col085,col086,col087,col088,col089</statement>
|
||||
</query>
|
||||
<query name="col09X">
|
||||
<statement>col090,col091,col092,col093,col094,col095,col096,col097,col098,col099</statement>
|
||||
</query>
|
||||
</query-set>
|
||||
<query name="selectWhere">
|
||||
<statement>
|
||||
SELECT
|
||||
id,
|
||||
$$inc:TestBig.inc.select.col00X$$ ,
|
||||
$$inc:TestBig.inc.select.col01X$$ ,
|
||||
$$inc:TestBig.inc.select.col02X$$ ,
|
||||
$$inc:TestBig.inc.select.col03X$$ ,
|
||||
$$inc:TestBig.inc.select.col04X$$ ,
|
||||
$$inc:TestBig.inc.select.col05X$$ ,
|
||||
$$inc:TestBig.inc.select.col06X$$ ,
|
||||
$$inc:TestBig.inc.select.col07X$$ ,
|
||||
$$inc:TestBig.inc.select.col08X$$ ,
|
||||
$$inc:TestBig.inc.select.col09X$$
|
||||
FROM
|
||||
test_big
|
||||
WHERE
|
||||
true=true
|
||||
</statement>
|
||||
</query>
|
||||
<query-set name="where">
|
||||
<query name="col000">
|
||||
<statement> AND col000 = $$col000$$ </statement>
|
||||
<parameter name="col000" valueType="java.lang.String" />
|
||||
</query>
|
||||
<query name="col001">
|
||||
<statement> AND col001 = $$col001$$ </statement>
|
||||
<parameter name="col001" valueType="java.lang.String" />
|
||||
</query>
|
||||
<query name="col002">
|
||||
<statement> AND col002 = $$col002$$ </statement>
|
||||
<parameter name="col002" valueType="java.lang.String" />
|
||||
</query>
|
||||
<query name="col003">
|
||||
<statement> AND col003 = $$col003$$ </statement>
|
||||
<parameter name="col003" valueType="java.lang.String" />
|
||||
</query>
|
||||
<query name="col004">
|
||||
<statement> AND col004 = $$col004$$ </statement>
|
||||
<parameter name="col004" valueType="java.lang.String" />
|
||||
</query>
|
||||
<query name="col005">
|
||||
<statement> AND col005 = $$col005$$ </statement>
|
||||
<parameter name="col005" valueType="java.lang.String" />
|
||||
</query>
|
||||
<query name="col006">
|
||||
<statement> AND col006 = $$col006$$ </statement>
|
||||
<parameter name="col006" valueType="java.lang.String" />
|
||||
</query>
|
||||
<query name="col007">
|
||||
<statement> AND col007 = $$col007$$ </statement>
|
||||
<parameter name="col007" valueType="java.lang.String" />
|
||||
</query>
|
||||
<query name="col008">
|
||||
<statement> AND col008 = $$col008$$ </statement>
|
||||
<parameter name="col008" valueType="java.lang.String" />
|
||||
</query>
|
||||
<query name="col009">
|
||||
<statement> AND col009 = $$col009$$ </statement>
|
||||
<parameter name="col009" valueType="java.lang.String" />
|
||||
</query>
|
||||
</query-set>
|
||||
<query name="orderBy">
|
||||
<statement>ORDER BY $$orderColumn$$ $$orderDirection$$</statement>
|
||||
<parameter name="orderColumn" type="RAW" defaultValue="id" valueType="java.lang.String" />
|
||||
<parameter name="orderDirection" type="RAW" defaultValue="ASC" valueType="java.lang.String" />
|
||||
</query>
|
||||
</query-set>
|
||||
|
||||
</query-set>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue