You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ab...@apache.org on 2015/08/20 05:54:17 UTC
sqoop git commit: SQOOP-2460: Sqoop2: Refactor repository-common to
use methods
Repository: sqoop
Updated Branches:
refs/heads/sqoop2 668703cfe -> 281ac3983
SQOOP-2460: Sqoop2: Refactor repository-common to use methods
(Colin Ma via Abraham Elmahrek)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/281ac398
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/281ac398
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/281ac398
Branch: refs/heads/sqoop2
Commit: 281ac3983756af44f28f1989f4507e548c6337f6
Parents: 668703c
Author: Abraham Elmahrek <ab...@apache.org>
Authored: Wed Aug 19 20:50:52 2015 -0700
Committer: Abraham Elmahrek <ab...@apache.org>
Committed: Wed Aug 19 20:50:52 2015 -0700
----------------------------------------------------------------------
.../common/CommonRepositoryHandler.java | 46 +++---
...RepositoryInsertUpdateDeleteSelectQuery.java | 155 +++++++++---------
.../repository/common/RepositoryQuery.java | 163 +++++++++++++++++++
.../derby/DerbyRepositoryHandler.java | 6 +-
4 files changed, 272 insertions(+), 98 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/281ac398/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java
----------------------------------------------------------------------
diff --git a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java
index 1b5e2fb..ef16fd6 100644
--- a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java
+++ b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java
@@ -17,6 +17,20 @@
*/
package org.apache.sqoop.repository.common;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.sqoop.common.Direction;
@@ -29,12 +43,10 @@ import org.apache.sqoop.common.SupportedDirections;
import org.apache.sqoop.driver.Driver;
import org.apache.sqoop.error.code.CommonRepositoryError;
import org.apache.sqoop.model.InputEditable;
-import org.apache.sqoop.model.MConfigUpdateEntityType;
-import org.apache.sqoop.model.MLongInput;
-import org.apache.sqoop.model.SubmissionError;
import org.apache.sqoop.model.MBooleanInput;
import org.apache.sqoop.model.MConfig;
import org.apache.sqoop.model.MConfigType;
+import org.apache.sqoop.model.MConfigUpdateEntityType;
import org.apache.sqoop.model.MConfigurableType;
import org.apache.sqoop.model.MConnector;
import org.apache.sqoop.model.MDriver;
@@ -47,10 +59,12 @@ import org.apache.sqoop.model.MIntegerInput;
import org.apache.sqoop.model.MJob;
import org.apache.sqoop.model.MLink;
import org.apache.sqoop.model.MLinkConfig;
+import org.apache.sqoop.model.MLongInput;
import org.apache.sqoop.model.MMapInput;
import org.apache.sqoop.model.MStringInput;
import org.apache.sqoop.model.MSubmission;
import org.apache.sqoop.model.MToConfig;
+import org.apache.sqoop.model.SubmissionError;
import org.apache.sqoop.repository.JdbcRepositoryHandler;
import org.apache.sqoop.repository.RepositoryError;
import org.apache.sqoop.submission.SubmissionStatus;
@@ -58,20 +72,6 @@ import org.apache.sqoop.submission.counter.Counter;
import org.apache.sqoop.submission.counter.CounterGroup;
import org.apache.sqoop.submission.counter.Counters;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
/**
* Set of methods required from each JDBC based repository.
*/
@@ -80,7 +80,7 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
private static final Logger LOG =
Logger.getLogger(CommonRepositoryHandler.class);
- protected CommonRepositoryInsertUpdateDeleteSelectQuery crudQueries;
+ protected RepositoryQuery crudQueries;
public CommonRepositoryHandler() {
crudQueries = new CommonRepositoryInsertUpdateDeleteSelectQuery();
@@ -197,7 +197,8 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
try {
updateConnectorStatement = conn.prepareStatement(crudQueries.getStmtUpdateConfigurable());
- deleteInputRelation = conn.prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_DELETE_INPUT_RELATIONS_FOR_INPUT);
+ deleteInputRelation = conn.prepareStatement(crudQueries
+ .getStmtDeleteInputRelationsForInput());
deleteInput = conn.prepareStatement(crudQueries.getStmtDeleteInputsForConfigurable());
deleteConfigDirection = conn.prepareStatement(crudQueries.getStmtDeleteDirectionsForConfigurable());
deleteConfig = conn.prepareStatement(crudQueries.getStmtDeleteConfigsForConfigurable());
@@ -244,7 +245,8 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
PreparedStatement deleteInputRelation = null;
try {
updateDriverStatement = conn.prepareStatement(crudQueries.getStmtUpdateConfigurable());
- deleteInputRelation = conn.prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_DELETE_INPUT_RELATIONS_FOR_INPUT);
+ deleteInputRelation = conn.prepareStatement(crudQueries
+ .getStmtDeleteInputRelationsForInput());
deleteInput = conn.prepareStatement(crudQueries.getStmtDeleteInputsForConfigurable());
deleteConfig = conn.prepareStatement(crudQueries.getStmtDeleteConfigsForConfigurable());
updateDriverStatement.setString(1, mDriver.getUniqueName());
@@ -2045,8 +2047,8 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
private void insertConfigInputRelationship(Long parent, Long child, Connection conn) {
PreparedStatement baseInputRelationStmt = null;
try {
- baseInputRelationStmt = conn
- .prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_INSERT_INTO_INPUT_RELATION);
+ baseInputRelationStmt = conn.prepareStatement(crudQueries
+ .getStmtInsertIntoInputRelation());
baseInputRelationStmt.setLong(1, parent);
baseInputRelationStmt.setLong(2, child);
baseInputRelationStmt.executeUpdate();
http://git-wip-us.apache.org/repos/asf/sqoop/blob/281ac398/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
----------------------------------------------------------------------
diff --git a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
index 28f5f6a..c4675c4 100644
--- a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
+++ b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
@@ -19,16 +19,17 @@ package org.apache.sqoop.repository.common;
import static org.apache.sqoop.repository.common.CommonRepositorySchemaConstants.*;
-public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+public class CommonRepositoryInsertUpdateDeleteSelectQuery implements
+ RepositoryQuery {
/**
* ****DIRECTION TABLE *************
*/
- public static final String STMT_SELECT_SQD_ID_BY_SQD_NAME =
+ private static final String STMT_SELECT_SQD_ID_BY_SQD_NAME =
"SELECT " + CommonRepoUtils.escapeColumnName(COLUMN_SQD_ID)
+ " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_DIRECTION_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQD_NAME) + "=?";
- public static final String STMT_SELECT_SQD_NAME_BY_SQD_ID =
+ private static final String STMT_SELECT_SQD_NAME_BY_SQD_ID =
"SELECT " + CommonRepoUtils.escapeColumnName(COLUMN_SQD_NAME)
+ " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_DIRECTION_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQD_ID) + "=?";
@@ -37,7 +38,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
* ******CONFIGURABLE TABLE **************
*/
//DML: Get configurable by given name
- public static final String STMT_SELECT_FROM_CONFIGURABLE =
+ private static final String STMT_SELECT_FROM_CONFIGURABLE =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQC_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQC_NAME) + ", "
@@ -47,7 +48,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQC_NAME) + " = ?";
//DML: Get all configurables for a given type
- public static final String STMT_SELECT_CONFIGURABLE_ALL_FOR_TYPE =
+ private static final String STMT_SELECT_CONFIGURABLE_ALL_FOR_TYPE =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQC_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQC_NAME) + ", "
@@ -57,7 +58,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQC_TYPE) + " = ?";
//DML: Insert into configurable
- public static final String STMT_INSERT_INTO_CONFIGURABLE =
+ private static final String STMT_INSERT_INTO_CONFIGURABLE =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONFIGURABLE_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQC_NAME) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQC_CLASS) + ", "
@@ -66,12 +67,12 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ ") VALUES (?, ?, ?, ?)";
//Delete all configs for a given configurable
- public static final String STMT_DELETE_CONFIGS_FOR_CONFIGURABLE =
+ private static final String STMT_DELETE_CONFIGS_FOR_CONFIGURABLE =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONFIG_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_CONFIGURABLE) + " = ?";
//Delete all inputs for a given configurable
- public static final String STMT_DELETE_INPUTS_FOR_CONFIGURABLE =
+ private static final String STMT_DELETE_INPUTS_FOR_CONFIGURABLE =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_INPUT_NAME)
+ " WHERE "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_CONFIG)
@@ -81,7 +82,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_CONFIGURABLE) + " = ?)";
- public static final String STMT_DELETE_INPUT_RELATIONS_FOR_INPUT =
+ private static final String STMT_DELETE_INPUT_RELATIONS_FOR_INPUT =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_INPUT_RELATION_NAME)
+ " WHERE "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQIR_PARENT)
@@ -97,7 +98,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_CONFIGURABLE) + " = ?))";
//Update the configurable
- public static final String STMT_UPDATE_CONFIGURABLE =
+ private static final String STMT_UPDATE_CONFIGURABLE =
"UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONFIGURABLE_NAME)
+ " SET " + CommonRepoUtils.escapeColumnName(COLUMN_SQC_NAME) + " = ?, "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQC_CLASS) + " = ?, "
@@ -109,7 +110,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
* *******CONFIG TABLE *************
*/
//DML: Get all configs for a given configurable
- public static final String STMT_SELECT_CONFIG_FOR_CONFIGURABLE =
+ private static final String STMT_SELECT_CONFIG_FOR_CONFIGURABLE =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_CONFIGURABLE) + ", "
@@ -122,7 +123,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
//DML: Insert into config
- public static final String STMT_INSERT_INTO_CONFIG =
+ private static final String STMT_INSERT_INTO_CONFIG =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONFIG_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_CONFIGURABLE) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_NAME) + ", "
@@ -134,7 +135,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
* ******* INPUT TABLE *************
*/
// DML: Get inputs for a given config
- public static final String STMT_SELECT_INPUT =
+ private static final String STMT_SELECT_INPUT =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_NAME) + ", "
@@ -151,7 +152,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " ORDER BY " + CommonRepoUtils.escapeColumnName(COLUMN_SQI_INDEX);
// DML get Input by Id
- public static final String STMT_SELECT_INPUT_BY_ID =
+ private static final String STMT_SELECT_INPUT_BY_ID =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_NAME)
@@ -159,7 +160,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQI_ID) + " = ?";
// DML get Input by name
- public static final String STMT_SELECT_INPUT_BY_NAME =
+ private static final String STMT_SELECT_INPUT_BY_NAME =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_NAME)
@@ -167,7 +168,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQI_NAME) + " = ?";
// DML: Insert into config input
- public static final String STMT_INSERT_INTO_INPUT =
+ private static final String STMT_INSERT_INTO_INPUT =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_INPUT_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_NAME) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_CONFIG) + ", "
@@ -180,13 +181,13 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
/********** INPUT-RELATIONSHIP TABLE **************/
- public static final String STMT_INSERT_INTO_INPUT_RELATION =
+ private static final String STMT_INSERT_INTO_INPUT_RELATION =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_INPUT_RELATION_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQIR_PARENT) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQIR_CHILD)
+ ") VALUES (?, ?)";
- public static final String STMT_FETCH_SQ_INPUT_OVERRIDES =
+ private static final String STMT_FETCH_SQ_INPUT_OVERRIDES =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQIR_CHILD)
+ " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_INPUT_RELATION_NAME)
@@ -196,7 +197,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
* *******LINK INPUT TABLE *************
*/
//DML: Get inputs and values for a given link
- public static final String STMT_FETCH_LINK_INPUT =
+ private static final String STMT_FETCH_LINK_INPUT =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_NAME) + ", "
@@ -219,7 +220,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
* *******JOB INPUT TABLE *************
*/
//DML: Fetch inputs and values for a given job
- public static final String STMT_FETCH_JOB_INPUT =
+ private static final String STMT_FETCH_JOB_INPUT =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQI_NAME) + ", "
@@ -242,7 +243,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
* *******LINK TABLE *************
*/
// DML: Insert new link
- public static final String STMT_INSERT_LINK =
+ private static final String STMT_INSERT_LINK =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_CONFIGURABLE) + ", "
@@ -254,7 +255,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ ") VALUES (?, ?, ?, ?, ?, ?, ?)";
// DML: Insert new link inputs
- public static final String STMT_INSERT_LINK_INPUT =
+ private static final String STMT_INSERT_LINK_INPUT =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_INPUT_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_LINK) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_INPUT) + ", "
@@ -262,7 +263,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ ") VALUES (?, ?, ?)";
// DML: Update link
- public static final String STMT_UPDATE_LINK =
+ private static final String STMT_UPDATE_LINK =
"UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_NAME) + " SET "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + " = ?, "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_UPDATE_USER) + " = ?, "
@@ -270,31 +271,31 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " = ?";
// DML: Enable or disable link
- public static final String STMT_ENABLE_LINK =
+ private static final String STMT_ENABLE_LINK =
"UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_NAME) + " SET "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ENABLED) + " = ? "
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " = ?";
// UPDATE the LINK Input
- public static final String STMT_UPDATE_LINK_INPUT =
+ private static final String STMT_UPDATE_LINK_INPUT =
"UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_INPUT_NAME) + " SET "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_VALUE) + " = ? "
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_INPUT) + " = ?"
+ " AND " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_LINK) + " = ?";
// DML: Delete rows from link input table
- public static final String STMT_DELETE_LINK_INPUT =
+ private static final String STMT_DELETE_LINK_INPUT =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_INPUT_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_LINK) + " = ?";
// DML: Delete row from link table
- public static final String STMT_DELETE_LINK =
+ private static final String STMT_DELETE_LINK =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " = ?";
// DML: Select one specific link
- public static final String STMT_SELECT_LINK_SINGLE =
+ private static final String STMT_SELECT_LINK_SINGLE =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + ", "
@@ -308,7 +309,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " = ?";
// DML: Select one specific link by name
- public static final String STMT_SELECT_LINK_SINGLE_BY_NAME =
+ private static final String STMT_SELECT_LINK_SINGLE_BY_NAME =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + ", "
@@ -322,7 +323,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + " = ?";
// DML: Select all links
- public static final String STMT_SELECT_LINK_ALL =
+ private static final String STMT_SELECT_LINK_ALL =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + ", "
@@ -335,7 +336,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_NAME);
// DML: Select all links for a specific connector.
- public static final String STMT_SELECT_LINK_FOR_CONNECTOR_CONFIGURABLE =
+ private static final String STMT_SELECT_LINK_FOR_CONNECTOR_CONFIGURABLE =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + ", "
@@ -349,7 +350,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_CONFIGURABLE) + " = ?";
// DML: Check if given link exists
- public static final String STMT_SELECT_LINK_CHECK_BY_ID =
+ private static final String STMT_SELECT_LINK_CHECK_BY_ID =
"SELECT count(*) FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " = ?";
@@ -357,7 +358,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
* *******JOB TABLE *************
*/
// DML: Insert new job
- public static final String STMT_INSERT_JOB =
+ private static final String STMT_INSERT_JOB =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQB_NAME) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQB_FROM_LINK) + ", "
@@ -370,14 +371,14 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
// DML: Insert new job inputs
- public static final String STMT_INSERT_JOB_INPUT =
+ private static final String STMT_INSERT_JOB_INPUT =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_INPUT_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQBI_JOB) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQBI_INPUT) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQBI_VALUE)
+ ") VALUES (?, ?, ?)";
- public static final String STMT_UPDATE_JOB =
+ private static final String STMT_UPDATE_JOB =
"UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_NAME) + " SET "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQB_NAME) + " = ?, "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQB_UPDATE_USER) + " = ?, "
@@ -385,35 +386,35 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID) + " = ?";
// DML: Enable or disable job
- public static final String STMT_ENABLE_JOB =
+ private static final String STMT_ENABLE_JOB =
"UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_NAME) + " SET "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQB_ENABLED) + " = ? "
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID) + " = ?";
// UPDATE the JOB Input
- public static final String STMT_UPDATE_JOB_INPUT =
+ private static final String STMT_UPDATE_JOB_INPUT =
"UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_INPUT_NAME) + " SET "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQBI_VALUE) + " = ? "
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQBI_INPUT) + " = ?"
+ " AND " + CommonRepoUtils.escapeColumnName(COLUMN_SQBI_JOB) + " = ?";
// DML: Delete rows from job input table
- public static final String STMT_DELETE_JOB_INPUT =
+ private static final String STMT_DELETE_JOB_INPUT =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_INPUT_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQBI_JOB) + " = ?";
// DML: Delete row from job table
- public static final String STMT_DELETE_JOB =
+ private static final String STMT_DELETE_JOB =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID) + " = ?";
// DML: Check if given job exists
- public static final String STMT_SELECT_JOB_CHECK_BY_ID =
+ private static final String STMT_SELECT_JOB_CHECK_BY_ID =
"SELECT count(*) FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID) + " = ?";
// DML: Check if there are jobs for given link
- public static final String STMT_SELECT_JOBS_FOR_LINK_CHECK =
+ private static final String STMT_SELECT_JOBS_FOR_LINK_CHECK =
"SELECT"
+ " count(*)"
+ " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_NAME)
@@ -422,7 +423,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " = ? ";
//DML: Select all jobs
- public static final String STMT_SELECT_JOB_ALL =
+ private static final String STMT_SELECT_JOB_ALL =
"SELECT "
+ "FROM_CONNECTOR." + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_CONFIGURABLE) + ", "
+ "TO_CONNECTOR." + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_CONFIGURABLE) + ", "
@@ -442,22 +443,22 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " ON " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_TO_LINK) + " = TO_CONNECTOR." + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID);
//DML: Select all jobs with order
- public static final String STMT_SELECT_JOB_ALL_WITH_ORDER =
+ private static final String STMT_SELECT_JOB_ALL_WITH_ORDER =
STMT_SELECT_JOB_ALL +
" ORDER BY JOB." + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID);
// DML: Select one specific job
- public static final String STMT_SELECT_JOB_SINGLE_BY_ID =
+ private static final String STMT_SELECT_JOB_SINGLE_BY_ID =
STMT_SELECT_JOB_ALL +
" WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID) + " = ?";
// DML: Select one specific job
- public static final String STMT_SELECT_JOB_SINGLE_BY_NAME =
+ private static final String STMT_SELECT_JOB_SINGLE_BY_NAME =
STMT_SELECT_JOB_ALL +
" WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_NAME) + " = ?";
// DML: Select all jobs for a Connector
- public static final String STMT_SELECT_ALL_JOBS_FOR_CONNECTOR_CONFIGURABLE =
+ private static final String STMT_SELECT_ALL_JOBS_FOR_CONNECTOR_CONFIGURABLE =
STMT_SELECT_JOB_ALL +
" WHERE FROM_CONNECTOR." + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_CONFIGURABLE) + " = ?" +
" OR TO_CONNECTOR." + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_CONFIGURABLE) + " = ?";
@@ -466,7 +467,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
* *******SUBMISSION TABLE *************
*/
// DML: Insert new submission
- public static final String STMT_INSERT_SUBMISSION =
+ private static final String STMT_INSERT_SUBMISSION =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_SUBMISSION_NAME) + "("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_JOB) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_STATUS) + ", "
@@ -481,7 +482,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " VALUES(?, ?, ?, ?, ?, ?, ?, substr(?, 1, 150) , substr(?, 1, 150), substr(?, 1, 750))";
// DML: Update existing submission
- public static final String STMT_UPDATE_SUBMISSION =
+ private static final String STMT_UPDATE_SUBMISSION =
"UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_SUBMISSION_NAME) + " SET "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_STATUS) + " = ?, "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_UPDATE_USER) + " = ?, "
@@ -491,19 +492,19 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQS_ID) + " = ?";
// DML: Check if given submission exists
- public static final String STMT_SELECT_SUBMISSION_CHECK =
+ private static final String STMT_SELECT_SUBMISSION_CHECK =
"SELECT"
+ " count(*)"
+ " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_SUBMISSION_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQS_ID) + " = ?";
// DML: Purge old entries
- public static final String STMT_PURGE_SUBMISSIONS =
+ private static final String STMT_PURGE_SUBMISSIONS =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_SUBMISSION_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQS_UPDATE_DATE) + " < ?";
// DML: Get unfinished
- public static final String STMT_SELECT_SUBMISSION_UNFINISHED =
+ private static final String STMT_SELECT_SUBMISSION_UNFINISHED =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_JOB) + ", "
@@ -520,7 +521,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQS_STATUS) + " = ?";
// DML : Get all submissions
- public static final String STMT_SELECT_SUBMISSIONS =
+ private static final String STMT_SELECT_SUBMISSIONS =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_JOB) + ", "
@@ -537,7 +538,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " ORDER BY " + CommonRepoUtils.escapeColumnName(COLUMN_SQS_UPDATE_DATE) + " DESC";
// DML: Get submissions for a job
- public static final String STMT_SELECT_SUBMISSIONS_FOR_JOB =
+ private static final String STMT_SELECT_SUBMISSIONS_FOR_JOB =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQS_JOB) + ", "
@@ -555,7 +556,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " ORDER BY " + CommonRepoUtils.escapeColumnName(COLUMN_SQS_UPDATE_DATE) + " DESC";
// DML: Select context type
- public static final String STMT_SELECT_CONTEXT_TYPE =
+ private static final String STMT_SELECT_CONTEXT_TYPE =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCT_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCT_NAME) + " "
@@ -563,13 +564,13 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ "WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQCT_NAME) + " = substr(?, 1, 25)";
// DML: Insert new context type
- public static final String STMT_INSERT_CONTEXT_TYPE =
+ private static final String STMT_INSERT_CONTEXT_TYPE =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONTEXT_TYPE) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCT_NAME) + ") "
+ "VALUES (substr(?, 1, 25))";
// DML: Select context property
- public static final String STMT_SELECT_CONTEXT_PROPERTY =
+ private static final String STMT_SELECT_CONTEXT_PROPERTY =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCP_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCP_NAME) + " "
@@ -577,13 +578,13 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ "WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQCP_NAME) + " = substr(?, 1, 500)";
// DML: Insert new context property
- public static final String STMT_INSERT_CONTEXT_PROPERTY =
+ private static final String STMT_INSERT_CONTEXT_PROPERTY =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONTEXT_PROPERTY) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCP_NAME) + ") "
+ "VALUES (substr(?, 1, 500))";
// DML: Insert new context
- public static final String STMT_INSERT_CONTEXT =
+ private static final String STMT_INSERT_CONTEXT =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONTEXT) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCO_SUBMISSION) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCO_TYPE) + ", "
@@ -592,7 +593,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ "VALUES (?, ?, ?, substr(?, 1, 500))";
// DML: Select context
- public static final String STMT_SELECT_CONTEXT =
+ private static final String STMT_SELECT_CONTEXT =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCP_NAME) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCO_VALUE) + " "
@@ -603,7 +604,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ " AND " + CommonRepoUtils.escapeColumnName(COLUMN_SQCO_TYPE) + " = ? ";
// DML: Select counter group
- public static final String STMT_SELECT_COUNTER_GROUP =
+ private static final String STMT_SELECT_COUNTER_GROUP =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQG_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQG_NAME) + " "
@@ -611,13 +612,13 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ "WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQG_NAME) + " = substr(?, 1, 75)";
// DML: Insert new counter group
- public static final String STMT_INSERT_COUNTER_GROUP =
+ private static final String STMT_INSERT_COUNTER_GROUP =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_COUNTER_GROUP_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQG_NAME) + ") "
+ "VALUES (substr(?, 1, 75))";
// DML: Select counter
- public static final String STMT_SELECT_COUNTER =
+ private static final String STMT_SELECT_COUNTER =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQR_ID) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQR_NAME) + " "
@@ -625,13 +626,13 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ "WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQR_NAME) + " = substr(?, 1, 75)";
// DML: Insert new counter
- public static final String STMT_INSERT_COUNTER =
+ private static final String STMT_INSERT_COUNTER =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_COUNTER_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQR_NAME) + ") "
+ "VALUES (substr(?, 1, 75))";
// DML: Insert new counter submission
- public static final String STMT_INSERT_COUNTER_SUBMISSION =
+ private static final String STMT_INSERT_COUNTER_SUBMISSION =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_COUNTER_SUBMISSION_NAME) + " ("
+ CommonRepoUtils.escapeColumnName(COLUMN_SQRS_GROUP) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQRS_COUNTER) + ", "
@@ -640,7 +641,7 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ "VALUES (?, ?, ?, ?)";
// DML: Select counter submission
- public static final String STMT_SELECT_COUNTER_SUBMISSION =
+ private static final String STMT_SELECT_COUNTER_SUBMISSION =
"SELECT "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQG_NAME) + ", "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQR_NAME) + ", "
@@ -653,41 +654,41 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
+ "WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQRS_SUBMISSION) + " = ? ";
// DML: Delete rows from counter submission table
- public static final String STMT_DELETE_COUNTER_SUBMISSION =
+ private static final String STMT_DELETE_COUNTER_SUBMISSION =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_COUNTER_SUBMISSION_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQRS_SUBMISSION) + " = ?";
/**
* **** CONFIG and CONNECTOR DIRECTIONS ***
*/
- public static final String STMT_INSERT_SQ_CONNECTOR_DIRECTIONS =
+ private static final String STMT_INSERT_SQ_CONNECTOR_DIRECTIONS =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONNECTOR_DIRECTIONS_NAME) + " "
+ "(" + CommonRepoUtils.escapeColumnName(COLUMN_SQCD_CONNECTOR) + ", " + CommonRepoUtils.escapeColumnName(COLUMN_SQCD_DIRECTION) + ")"
+ " VALUES (?, ?)";
- public static final String STMT_INSERT_SQ_CONFIG_DIRECTIONS =
+ private static final String STMT_INSERT_SQ_CONFIG_DIRECTIONS =
"INSERT INTO " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONFIG_DIRECTIONS_NAME) + " "
+ "(" + CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_DIR_CONFIG) + ", " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_DIR_DIRECTION) + ")"
+ " VALUES (?, ?)";
- public static final String STMT_SELECT_SQ_CONNECTOR_DIRECTIONS_ALL =
+ private static final String STMT_SELECT_SQ_CONNECTOR_DIRECTIONS_ALL =
"SELECT " + CommonRepoUtils.escapeColumnName(COLUMN_SQCD_CONNECTOR) + ", " + CommonRepoUtils.escapeColumnName(COLUMN_SQCD_DIRECTION)
+ " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONNECTOR_DIRECTIONS_NAME);
- public static final String STMT_SELECT_SQ_CONNECTOR_DIRECTIONS =
+ private static final String STMT_SELECT_SQ_CONNECTOR_DIRECTIONS =
STMT_SELECT_SQ_CONNECTOR_DIRECTIONS_ALL + " WHERE "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQCD_CONNECTOR) + " = ?";
- public static final String STMT_SELECT_SQ_CONFIG_DIRECTIONS_ALL =
+ private static final String STMT_SELECT_SQ_CONFIG_DIRECTIONS_ALL =
"SELECT " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_DIR_CONFIG) + ", " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_DIR_DIRECTION)
+ " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONFIG_DIRECTIONS_NAME);
- public static final String STMT_SELECT_SQ_CONFIG_DIRECTIONS =
+ private static final String STMT_SELECT_SQ_CONFIG_DIRECTIONS =
STMT_SELECT_SQ_CONFIG_DIRECTIONS_ALL + " WHERE "
+ CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_DIR_CONFIG) + " = ?";
// Delete the config directions for a connector
- public static final String STMT_DELETE_DIRECTIONS_FOR_CONFIGURABLE =
+ private static final String STMT_DELETE_DIRECTIONS_FOR_CONFIGURABLE =
"DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONFIG_DIRECTIONS_NAME)
+ " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_DIR_CONFIG)
+ " IN (SELECT " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_CFG_ID) + " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_CONFIG_NAME)
@@ -968,4 +969,12 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
public String getStmtDeleteDirectionsForConfigurable() {
return STMT_DELETE_DIRECTIONS_FOR_CONFIGURABLE;
}
+
+ public String getStmtDeleteInputRelationsForInput() {
+ return STMT_DELETE_INPUT_RELATIONS_FOR_INPUT;
+ }
+
+ public String getStmtInsertIntoInputRelation() {
+ return STMT_INSERT_INTO_INPUT_RELATION;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sqoop/blob/281ac398/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/RepositoryQuery.java
----------------------------------------------------------------------
diff --git a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/RepositoryQuery.java b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/RepositoryQuery.java
new file mode 100644
index 0000000..54726e0
--- /dev/null
+++ b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/RepositoryQuery.java
@@ -0,0 +1,163 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sqoop.repository.common;
+
+public interface RepositoryQuery {
+ public String getStmtSelectSqdIdBySqdName();
+
+ public String getStmtSelectSqConfigDirections();
+
+ public String getStmtDeleteInputsForConfigurable();
+
+ public String getStmtUpdateConfigurable();
+
+ public String getStmtSelectConfigForConfigurable();
+
+ public String getStmtInsertIntoConfig();
+
+ public String getStmtSelectInput();
+
+ public String getStmtSelectInputById();
+
+ public String getStmtSelectInputByName();
+
+ public String getStmtSelectInputOverrides();
+
+ public String getStmtInsertIntoInput();
+
+ public String getStmtFetchLinkInput();
+
+ public String getStmtFetchJobInput();
+
+ public String getStmtInsertLink();
+
+ public String getStmtInsertLinkInput();
+
+ public String getStmtUpdateLink();
+
+ public String getStmtEnableLink();
+
+ public String getStmtUpdateLinkInput();
+
+ public String getStmtDeleteLinkInput();
+
+ public String getStmtDeleteLink();
+
+ public String getStmtSelectLinkSingle();
+
+ public String getStmtSelectLinkSingleByName();
+
+ public String getStmtSelectLinkAll();
+
+ public String getStmtSelectLinkForConnectorConfigurable();
+
+ public String getStmtSelectLinkCheckById();
+
+ public String getStmtInsertJob();
+
+ public String getStmtInsertJobInput();
+
+ public String getStmtUpdateJob();
+
+ public String getStmtEnableJob();
+
+ public String getStmtUpdateJobInput();
+
+ public String getStmtDeleteJobInput();
+
+ public String getStmtDeleteJob();
+
+ public String getStmtSelectJobCheckById();
+
+ public String getStmtSelectJobsForLinkCheck();
+
+ public String getStmtSelectJobAllWithOrder();
+
+ public String getStmtSelectJobSingleById();
+
+ public String getStmtSelectJobSingleByName();
+
+ public String getStmtSelectAllJobsForConnectorConfigurable();
+
+ public String getStmtInsertSubmission();
+
+ public String getStmtUpdateSubmission();
+
+ public String getStmtSelectSubmissionCheck();
+
+ public String getStmtPurgeSubmissions();
+
+ public String getStmtSelectSubmissionUnfinished();
+
+ public String getStmtSelectSubmissions();
+
+ public String getStmtSelectSubmissionsForJob();
+
+ public String getStmtSelectContextType();
+
+ public String getStmtInsertContextType();
+
+ public String getStmtSelectContextProperty();
+
+ public String getStmtInsertContextProperty();
+
+ public String getStmtInsertContext();
+
+ public String getStmtSelectContext();
+
+ public String getStmtSelectCounterGroup();
+
+ public String getStmtInsertCounterGroup();
+
+ public String getStmtSelectCounter();
+
+ public String getStmtInsertCounter();
+
+ public String getStmtInsertCounterSubmission();
+
+ public String getStmtSelectCounterSubmission();
+
+ public String getStmtDeleteCounterSubmission();
+
+ public String getStmtInsertSqConnectorDirections();
+
+ public String getStmtInsertSqConfigDirections();
+
+ public String getStmtSelectSqConnectorDirectionsAll();
+
+ public String getStmtSelectSqConnectorDirections();
+
+ public String getStmtSelectSqConfigDirectionsAll();
+
+ public String getStmtSelectSqdNameBySqdId();
+
+ public String getStmtSelectFromConfigurable();
+
+ public String getStmtSelectConfigurableAllForType();
+
+ public String getStmtInsertIntoConfigurable();
+
+ public String getStmtDeleteConfigsForConfigurable();
+
+ public String getStmtDeleteDirectionsForConfigurable();
+
+ public String getStmtDeleteInputRelationsForInput();
+
+ public String getStmtInsertIntoInputRelation();
+}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/281ac398/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
index 2ba3384..2408558 100644
--- a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
+++ b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
@@ -577,7 +577,7 @@ public class DerbyRepositoryHandler extends CommonRepositoryHandler {
String directionString = directions.remove(0);
if (directionString != null && !directionString.isEmpty()) {
Direction direction = Direction.valueOf(directionString);
- runQuery(STMT_INSERT_SQ_CONFIG_DIRECTIONS, conn, configId, directionMap.get(direction));
+ runQuery(crudQueries.getStmtInsertSqConfigDirections(), conn, configId, directionMap.get(direction));
}
}
@@ -597,7 +597,7 @@ public class DerbyRepositoryHandler extends CommonRepositoryHandler {
for (Long connectorId : connectorIds) {
for (Long directionId : directionMap.values()) {
- runQuery(STMT_INSERT_SQ_CONNECTOR_DIRECTIONS, conn, connectorId, directionId);
+ runQuery(crudQueries.getStmtInsertSqConnectorDirections(), conn, connectorId, directionId);
}
}
}
@@ -737,7 +737,7 @@ public class DerbyRepositoryHandler extends CommonRepositoryHandler {
PreparedStatement baseDriverStmt = null;
try {
- baseDriverStmt = conn.prepareStatement(STMT_INSERT_INTO_CONFIGURABLE,
+ baseDriverStmt = conn.prepareStatement(crudQueries.getStmtInsertIntoConfigurable(),
Statement.RETURN_GENERATED_KEYS);
baseDriverStmt.setString(1, MDriver.DRIVER_NAME);
baseDriverStmt.setString(2, Driver.getClassName());