parent
cfa1e0eac6
commit
4b39af8eb9
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>frog-runner</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,6 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding//src/test/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
@ -0,0 +1,5 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.jboss.ide.eclipse.as.core.singledeployable.deployableList=
|
@ -0,0 +1,110 @@
|
||||
<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>
|
||||
<groupId>at.compax.tools</groupId>
|
||||
<artifactId>frog-runner</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
<!-- PLUGINS -->
|
||||
<compiler.plugin.version>2.3.2</compiler.plugin.version>
|
||||
<surefire.version>2.9</surefire.version>
|
||||
<!-- DEPENDENCIES -->
|
||||
<commons.version>2.5</commons.version>
|
||||
<hibernate.version>3.6.8.Final</hibernate.version>
|
||||
<junit.version>4.8.2</junit.version>
|
||||
<log4j.version>1.2.14</log4j.version>
|
||||
<lombok.version>1.16.18</lombok.version>
|
||||
<mockito.version>1.8.5</mockito.version>
|
||||
<persistence.version>2.0-cr-1</persistence.version>
|
||||
<oracleDriver.version>11.2.0.2.0</oracleDriver.version>
|
||||
<xmlbeans.version>2.5.0</xmlbeans.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${surefire.version}</version>
|
||||
<inherited>true</inherited>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<optimize>true</optimize>
|
||||
<skipTests>true</skipTests>
|
||||
<includes>
|
||||
<include>**/*Test.java</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>${oracleDriver.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.8.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>public</id>
|
||||
<url>http://nexus.int.compax.at:8081/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>compax</id>
|
||||
<url>http://nexus.int.compax.at:8081/nexus/content/repositories/compax</url>
|
||||
<releases>
|
||||
</releases>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>compax-snapshot</id>
|
||||
<url>http://nexus.int.compax.at:8081/nexus/content/repositories/compax-snapshot</url>
|
||||
<snapshots>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>compax-thirdparty</id>
|
||||
<url>http://nexus.int.compax.at:8081/nexus/content/repositories/thirdparty</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
@ -0,0 +1,19 @@
|
||||
package at.compax.tools.sql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import at.compax.tools.sql.model.UserError;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SqlExecutionException extends Exception {
|
||||
private static final long serialVersionUID = 3684929762067312606L;
|
||||
|
||||
private final String message;
|
||||
private final List<UserError> userErrors;
|
||||
private Throwable cause;
|
||||
}
|
@ -0,0 +1,184 @@
|
||||
package at.compax.tools.sql;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLWarning;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Types;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import at.compax.tools.sql.model.QueryParameter;
|
||||
import at.compax.tools.sql.model.QueryResult;
|
||||
import at.compax.tools.sql.model.QueryResult.QueryResultBuilder;
|
||||
import at.compax.tools.sql.model.QueryResult.Row;
|
||||
import at.compax.tools.sql.model.QueryResult.Row.Column;
|
||||
import at.compax.tools.sql.model.QueryResult.Row.Column.ColumnBuilder;
|
||||
import at.compax.tools.sql.model.QueryResult.Row.RowBuilder;
|
||||
import at.compax.tools.sql.model.Result;
|
||||
import at.compax.tools.sql.model.Result.ResultBuilder;
|
||||
import at.compax.tools.sql.model.UserError;
|
||||
import at.compax.tools.sql.model.UserError.MessageLine;
|
||||
import at.compax.tools.sql.model.UserError.UserErrorBuilder;
|
||||
import lombok.Cleanup;
|
||||
import lombok.extern.log4j.Log4j;
|
||||
|
||||
@Log4j
|
||||
public class SqlExecutor {
|
||||
public static Result execute(Connection conn, String sql) throws SQLException, JsonProcessingException {
|
||||
log.trace("SQL: " + sql.trim());
|
||||
|
||||
@Cleanup
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.execute(sql.trim());
|
||||
log.info("Executed");
|
||||
|
||||
ResultBuilder resultBuilder = Result.builder();
|
||||
|
||||
try {
|
||||
handleUserErrors(conn, sql, stmt);
|
||||
} catch (SqlExecutionException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
resultBuilder.userErrors(e.getUserErrors());
|
||||
}
|
||||
|
||||
return resultBuilder.build();
|
||||
}
|
||||
|
||||
public static QueryResult executeQuery(Connection conn, QueryParameter parameters) throws SQLException {
|
||||
return executeQuery(conn, parameters.getSql(), parameters.getParameters());
|
||||
}
|
||||
|
||||
public static QueryResult executeQuery(Connection conn, String sql, Object... parameters) throws SQLException {
|
||||
log.trace("SQL: " + sql.trim());
|
||||
|
||||
@Cleanup
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
|
||||
int parameterIndex = 1;
|
||||
for (Object object : parameters) {
|
||||
if (object instanceof String) {
|
||||
stmt.setString(parameterIndex++, (String) object);
|
||||
} else if (object instanceof Integer || object instanceof Long) {
|
||||
stmt.setLong(parameterIndex++, (Long) object);
|
||||
} else {
|
||||
String message = "Unhandled paramter type: " + object.getClass().getName();
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Cleanup
|
||||
ResultSet rs = null;
|
||||
QueryResultBuilder queryResultBuilder = QueryResult.builder();
|
||||
try {
|
||||
rs = stmt.executeQuery();
|
||||
} catch (SQLException e) {
|
||||
return queryResultBuilder //
|
||||
.exception(e.getClass().getName()) //
|
||||
.exceptionMessage(e.getMessage()) //
|
||||
.build();
|
||||
}
|
||||
|
||||
try {
|
||||
handleUserErrors(conn, sql, stmt);
|
||||
} catch (SqlExecutionException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
return queryResultBuilder.userErrors(e.getUserErrors()).build();
|
||||
}
|
||||
|
||||
List<Row> rows = new Vector<Row>();
|
||||
while (rs.next()) {
|
||||
RowBuilder rowBuilder = Row.builder();
|
||||
List<Column> columns = new Vector<Column>();
|
||||
|
||||
ResultSetMetaData metaData = rs.getMetaData();
|
||||
int columnCount = metaData.getColumnCount();
|
||||
|
||||
for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) {
|
||||
ColumnBuilder columnBuilder = Column.builder();
|
||||
columnBuilder.name(metaData.getColumnLabel(columnIndex));
|
||||
|
||||
int columnType = metaData.getColumnType(columnIndex);
|
||||
if (columnType == Types.VARCHAR) {
|
||||
columnBuilder.value(rs.getString(columnIndex));
|
||||
} else if (columnType == Types.NUMERIC) {
|
||||
columnBuilder.value(rs.getLong(columnIndex));
|
||||
} else {
|
||||
String message = "Unhandled column type type: " + columnType;
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
columns.add(columnBuilder.build());
|
||||
}
|
||||
|
||||
rowBuilder.columns(columns);
|
||||
rows.add(rowBuilder.build());
|
||||
}
|
||||
|
||||
return queryResultBuilder.rows(rows).build();
|
||||
}
|
||||
|
||||
private static void handleUserErrors(Connection conn, String sql, Statement stmt)
|
||||
throws SQLException, SqlExecutionException {
|
||||
SQLWarning warnings = stmt.getWarnings();
|
||||
List<UserError> userErrors = new Vector<UserError>();
|
||||
if (warnings != null) {
|
||||
userErrors = parseUserErrors(conn);
|
||||
String message = String.format("Errors while executing SQL \"%s\"", sql);
|
||||
throw new SqlExecutionException(message, userErrors);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<UserError> parseUserErrors(Connection conn) throws SQLException {
|
||||
String userErrorsSql = "select name, type, sequence, line, position, text, attribute, message_number from user_errors where type <> 'JAVA CLASS' order by sequence";
|
||||
boolean first = true;
|
||||
|
||||
Vector<UserError> userErrors = new Vector<UserError>();
|
||||
Vector<MessageLine> lines = new Vector<UserError.MessageLine>();
|
||||
|
||||
UserErrorBuilder builder = UserError.builder();
|
||||
|
||||
@Cleanup
|
||||
PreparedStatement userErrorsStmt = conn.prepareStatement(userErrorsSql);
|
||||
@Cleanup
|
||||
ResultSet userErrorsRs = userErrorsStmt.executeQuery();
|
||||
|
||||
while (userErrorsRs.next()) {
|
||||
long messageNumber = userErrorsRs.getLong("message_number");
|
||||
if (messageNumber != 0) {
|
||||
if (!first) {
|
||||
builder.lines(lines);
|
||||
userErrors.add(builder.build());
|
||||
first = false;
|
||||
|
||||
builder = UserError.builder();
|
||||
lines = new Vector<UserError.MessageLine>();
|
||||
}
|
||||
|
||||
builder.name(userErrorsRs.getString("name"));
|
||||
builder.type(userErrorsRs.getString("type"));
|
||||
}
|
||||
|
||||
lines.add(UserError.MessageLine.builder() //
|
||||
.sequence(userErrorsRs.getLong("sequence")) //
|
||||
.line(userErrorsRs.getLong("line")) //
|
||||
.position(userErrorsRs.getLong("position")) //
|
||||
.text(userErrorsRs.getString("text")) //
|
||||
.attribute(userErrorsRs.getString("attribute")) //
|
||||
.messageNumber(userErrorsRs.getLong("message_number")) //
|
||||
.build());
|
||||
}
|
||||
|
||||
builder.lines(lines);
|
||||
userErrors.add(builder.build());
|
||||
|
||||
return userErrors;
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package at.compax.tools.sql.main;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.LogManager;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import at.compax.tools.sql.SqlExecutionException;
|
||||
import at.compax.tools.sql.SqlExecutor;
|
||||
import at.compax.tools.sql.model.QueryResult;
|
||||
import at.compax.tools.sql.model.Result;
|
||||
import at.compax.tools.sql.model.UserError;
|
||||
import lombok.Cleanup;
|
||||
import lombok.extern.log4j.Log4j;
|
||||
|
||||
@Log4j
|
||||
public class Main {
|
||||
|
||||
private static Connection getConnection(String dbIp, long port, String sid, String username, String password) {
|
||||
log.debug("Establishing conneciton...");
|
||||
Connection conn = null;
|
||||
|
||||
String jdbcConnection = String.format("jdbc:oracle:thin:@%s:%d:%s", dbIp, port, sid);
|
||||
|
||||
try {
|
||||
conn = DriverManager.getConnection(jdbcConnection, username, password);
|
||||
conn.setAutoCommit(false);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Couldn't connect to database", e);
|
||||
}
|
||||
|
||||
log.debug("Established conneciton!");
|
||||
return conn;
|
||||
}
|
||||
|
||||
private static QueryResult executeExampleQueryWithException(Connection conn)
|
||||
throws SQLException, JsonProcessingException {
|
||||
String sql = "SELECT id, version, workspac FROM s_settings";
|
||||
return SqlExecutor.executeQuery(conn, sql);
|
||||
}
|
||||
|
||||
private static QueryResult executeExampleQueryWithoutParameter(Connection conn)
|
||||
throws SQLException, JsonProcessingException {
|
||||
String sql = "SELECT id, version, workspace FROM s_settings";
|
||||
return SqlExecutor.executeQuery(conn, sql);
|
||||
}
|
||||
|
||||
private static QueryResult executeExampleQueryWithParameter(Connection conn)
|
||||
throws SQLException, JsonProcessingException {
|
||||
String sql = "select client from k_clients where id = ?";
|
||||
return SqlExecutor.executeQuery(conn, sql, 1L);
|
||||
}
|
||||
|
||||
private static Result compileExampleSpec(Connection conn) throws SQLException, JsonProcessingException {
|
||||
String specSql = "CREATE OR REPLACE PACKAGE aax2_wedel\n" + "AS\n"
|
||||
+ " PROCEDURE create_cli_migration_workflow(p_customer d_customers.id%type, p_migration_date date);\n"
|
||||
+ "END aax2_wedel;";
|
||||
|
||||
return SqlExecutor.execute(conn, specSql);
|
||||
}
|
||||
|
||||
private static Result compileExampleSpecWithErrors(Connection conn) throws SQLException, JsonProcessingException {
|
||||
String specSql = "CREATE OR REPLACE PACKAGE aax2_wedel\n" + "AS\n"
|
||||
+ " PROCEDURE create_cli_migration_workflow(p_customer d_customers.id%typ, p_migration_date date);\n"
|
||||
+ "END aax2_wedel;";
|
||||
|
||||
return SqlExecutor.execute(conn, specSql);
|
||||
}
|
||||
|
||||
private static void handleSqlExecutionException(SqlExecutionException e) throws JsonProcessingException {
|
||||
for (UserError userError : e.getUserErrors()) {
|
||||
log.debug(userError.toString());
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
System.out.println(mapper.writeValueAsString(userError));
|
||||
}
|
||||
}
|
||||
|
||||
private static String readFromStdIn() throws IOException {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||
String line;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
BasicConfigurator.configure();
|
||||
LogManager.getLogger("at.compax.tools.sql.main").setLevel(Level.ALL);
|
||||
LogManager.getLogger("at.compax.tools.sql").setLevel(Level.ALL);
|
||||
|
||||
// String stdInSql = readFromStdIn();
|
||||
|
||||
@Cleanup
|
||||
Connection conn = getConnection("172.19.13.66", 1521L, "aax2qc", "aax2qc", "aax2qc");
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
System.out.println(mapper.writeValueAsString(compileExampleSpec(conn)));
|
||||
System.out.println(mapper.writeValueAsString(compileExampleSpecWithErrors(conn)));
|
||||
System.out.println(mapper.writeValueAsString(executeExampleQueryWithException(conn)));
|
||||
System.out.println(mapper.writeValueAsString(executeExampleQueryWithoutParameter(conn)));
|
||||
System.out.println(mapper.writeValueAsString(executeExampleQueryWithParameter(conn)));
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package at.compax.tools.sql.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@ToString
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class QueryParameter {
|
||||
@JsonProperty("sql")
|
||||
private String sql;
|
||||
@JsonProperty("parameters")
|
||||
private List<Object> parameters;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package at.compax.tools.sql.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@ToString
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class QueryResult {
|
||||
@Getter
|
||||
@Builder
|
||||
@ToString
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class Row {
|
||||
@Getter
|
||||
@Builder
|
||||
@ToString
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class Column {
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("value")
|
||||
private Object value;
|
||||
}
|
||||
|
||||
@JsonProperty("columns")
|
||||
private List<Column> columns;
|
||||
}
|
||||
|
||||
@JsonProperty("rows")
|
||||
private List<Row> rows;
|
||||
@JsonProperty("userErrors")
|
||||
private List<UserError> userErrors;
|
||||
@JsonProperty("exception")
|
||||
private String exception;
|
||||
@JsonProperty("exceptionMessage")
|
||||
private String exceptionMessage;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package at.compax.tools.sql.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@ToString
|
||||
public class Result {
|
||||
private List<UserError> userErrors;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package at.compax.tools.sql.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@ToString
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class UserError {
|
||||
@Getter
|
||||
@Builder
|
||||
@ToString
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class MessageLine {
|
||||
private Long sequence;
|
||||
@JsonProperty("line")
|
||||
private Long line;
|
||||
@JsonProperty("position")
|
||||
private Long position;
|
||||
@JsonProperty("text")
|
||||
private String text;
|
||||
@JsonProperty("attribute")
|
||||
private String attribute;
|
||||
private Long messageNumber;
|
||||
}
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("type")
|
||||
private String type;
|
||||
@JsonProperty("lines")
|
||||
private List<MessageLine> lines;
|
||||
|
||||
}
|
Loading…
Reference in new issue