format the code
This commit is contained in:
parent
76f82481f5
commit
2add95e9fe
|
@ -33,9 +33,9 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* insert or import sql template pattern, the template are the following:
|
* insert or import sql template pattern, the template are the following:
|
||||||
*
|
* <p>
|
||||||
* insert/import into tableName [(field1, field2, ...)] [using stables tags(?, ?, ...) ] values(?, ?, ...) (?, ?, ...)
|
* insert/import into tableName [(field1, field2, ...)] [using stables tags(?, ?, ...) ] values(?, ?, ...) (?, ?, ...)
|
||||||
*
|
* <p>
|
||||||
* we split it to three part:
|
* we split it to three part:
|
||||||
* 1. prefix, insert/import
|
* 1. prefix, insert/import
|
||||||
* 2. middle, tableName [(field1, field2, ...)] [using stables tags(?, ?, ...) ]
|
* 2. middle, tableName [(field1, field2, ...)] [using stables tags(?, ?, ...) ]
|
||||||
|
@ -70,9 +70,9 @@ public class SavedPreparedStatement {
|
||||||
/**
|
/**
|
||||||
* default param value
|
* default param value
|
||||||
*/
|
*/
|
||||||
private static final String DEFAULT_VALUE= "NULL";
|
private static final String DEFAULT_VALUE = "NULL";
|
||||||
|
|
||||||
private static final String PLACEHOLDER= "?";
|
private static final String PLACEHOLDER = "?";
|
||||||
|
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class SavedPreparedStatement {
|
||||||
*/
|
*/
|
||||||
private boolean isAddBatch;
|
private boolean isAddBatch;
|
||||||
|
|
||||||
public SavedPreparedStatement(String sql, TSDBPreparedStatement tsdbPreparedStatement)throws SQLException {
|
public SavedPreparedStatement(String sql, TSDBPreparedStatement tsdbPreparedStatement) throws SQLException {
|
||||||
this.sql = sql;
|
this.sql = sql;
|
||||||
this.tsdbPreparedStatement = tsdbPreparedStatement;
|
this.tsdbPreparedStatement = tsdbPreparedStatement;
|
||||||
this.sqlParamList = new ArrayList<>();
|
this.sqlParamList = new ArrayList<>();
|
||||||
|
@ -91,17 +91,18 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parse the init param according the sql param
|
* parse the init param according the sql param
|
||||||
|
*
|
||||||
* @param sql
|
* @param sql
|
||||||
*/
|
*/
|
||||||
private void parsePreparedParam(String sql)throws SQLException{
|
private void parsePreparedParam(String sql) throws SQLException {
|
||||||
|
|
||||||
Matcher matcher = sqlPattern.matcher(sql);
|
Matcher matcher = sqlPattern.matcher(sql);
|
||||||
|
|
||||||
if(matcher.find()){
|
if (matcher.find()) {
|
||||||
|
|
||||||
tableName = matcher.group("tablename");
|
tableName = matcher.group("tablename");
|
||||||
|
|
||||||
if (tableName != null && PLACEHOLDER.equals(tableName)){
|
if (tableName != null && PLACEHOLDER.equals(tableName)) {
|
||||||
// the table name is dynamic
|
// the table name is dynamic
|
||||||
this.isTableNameDynamic = true;
|
this.isTableNameDynamic = true;
|
||||||
}
|
}
|
||||||
|
@ -110,26 +111,26 @@ public class SavedPreparedStatement {
|
||||||
middle = matcher.group(2);
|
middle = matcher.group(2);
|
||||||
valueList = matcher.group("valueList");
|
valueList = matcher.group("valueList");
|
||||||
|
|
||||||
if(middle != null && !"".equals(middle)){
|
if (middle != null && !"".equals(middle)) {
|
||||||
middleParamSize = parsePlaceholder(middle);
|
middleParamSize = parsePlaceholder(middle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(valueList != null && !"".equals(valueList)){
|
if (valueList != null && !"".equals(valueList)) {
|
||||||
valueListSize = parsePlaceholder(valueList);
|
valueListSize = parsePlaceholder(valueList);
|
||||||
}
|
}
|
||||||
|
|
||||||
initPreparedParam = initDefaultParam(tableName, middleParamSize, valueListSize);
|
initPreparedParam = initDefaultParam(tableName, middleParamSize, valueListSize);
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
// not match
|
// not match
|
||||||
throw new SQLException(TSDBConstants.WrapErrMsg("the sql is not complete!"));
|
throw new SQLException(TSDBConstants.WrapErrMsg("the sql is not complete!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TSDBPreparedParam initDefaultParam(String tableName, int middleParamSize, int valueListSize){
|
private TSDBPreparedParam initDefaultParam(String tableName, int middleParamSize, int valueListSize) {
|
||||||
|
|
||||||
TSDBPreparedParam tsdbPreparedParam = new TSDBPreparedParam(tableName);
|
TSDBPreparedParam tsdbPreparedParam = new TSDBPreparedParam(tableName);
|
||||||
|
|
||||||
tsdbPreparedParam.setMiddleParamList(getDefaultParamList(middleParamSize));
|
tsdbPreparedParam.setMiddleParamList(getDefaultParamList(middleParamSize));
|
||||||
|
|
||||||
|
@ -140,14 +141,15 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate the default param value list
|
* generate the default param value list
|
||||||
|
*
|
||||||
* @param paramSize
|
* @param paramSize
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<Object> getDefaultParamList(int paramSize){
|
private List<Object> getDefaultParamList(int paramSize) {
|
||||||
|
|
||||||
List<Object> paramList = new ArrayList<>(paramSize);
|
List<Object> paramList = new ArrayList<>(paramSize);
|
||||||
if (paramSize > 0){
|
if (paramSize > 0) {
|
||||||
for (int i = 0; i < paramSize; i++){
|
for (int i = 0; i < paramSize; i++) {
|
||||||
paramList.add(i, DEFAULT_VALUE);
|
paramList.add(i, DEFAULT_VALUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,17 +159,18 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculate the placeholder num
|
* calculate the placeholder num
|
||||||
|
*
|
||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private int parsePlaceholder(String value){
|
private int parsePlaceholder(String value) {
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile("[?]");
|
Pattern pattern = Pattern.compile("[?]");
|
||||||
|
|
||||||
Matcher matcher = pattern.matcher(value);
|
Matcher matcher = pattern.matcher(value);
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
while (matcher.find()){
|
while (matcher.find()) {
|
||||||
result++;
|
result++;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -175,34 +178,35 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set current row params
|
* set current row params
|
||||||
* @param parameterIndex the first parameter is 1, the second is 2, ...
|
*
|
||||||
* @param x the parameter value
|
* @param parameterIndex the first parameter is 1, the second is 2, ...
|
||||||
|
* @param x the parameter value
|
||||||
*/
|
*/
|
||||||
public void setParam(int parameterIndex, Object x) throws SQLException{
|
public void setParam(int parameterIndex, Object x) throws SQLException {
|
||||||
|
|
||||||
int paramSize = this.middleParamSize + this.valueListSize;
|
int paramSize = this.middleParamSize + this.valueListSize;
|
||||||
|
|
||||||
String errorMsg = String.format("the parameterIndex %s out of the range [1, %s]", parameterIndex, this.middleParamSize + this.valueListSize);
|
String errorMsg = String.format("the parameterIndex %s out of the range [1, %s]", parameterIndex, this.middleParamSize + this.valueListSize);
|
||||||
|
|
||||||
if (parameterIndex < 1 || parameterIndex > paramSize){
|
if (parameterIndex < 1 || parameterIndex > paramSize) {
|
||||||
throw new SQLException(TSDBConstants.WrapErrMsg(errorMsg));
|
throw new SQLException(TSDBConstants.WrapErrMsg(errorMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isAddBatch = false; //set isAddBatch to false
|
this.isAddBatch = false; //set isAddBatch to false
|
||||||
|
|
||||||
if (x == null){
|
if (x == null) {
|
||||||
x = DEFAULT_VALUE; // set default null string
|
x = DEFAULT_VALUE; // set default null string
|
||||||
}
|
}
|
||||||
|
|
||||||
parameterIndex = parameterIndex -1; // start from 0 in param list
|
parameterIndex = parameterIndex - 1; // start from 0 in param list
|
||||||
|
|
||||||
if (this.middleParamSize != 0 && parameterIndex >= 0 && parameterIndex < this.middleParamSize){
|
if (this.middleParamSize != 0 && parameterIndex >= 0 && parameterIndex < this.middleParamSize) {
|
||||||
|
|
||||||
this.initPreparedParam.setMiddleParam(parameterIndex, x);
|
this.initPreparedParam.setMiddleParam(parameterIndex, x);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.valueListSize != 0 && parameterIndex >= this.middleParamSize && parameterIndex < (this.middleParamSize + this.valueListSize)){
|
if (this.valueListSize != 0 && parameterIndex >= this.middleParamSize && parameterIndex < paramSize) {
|
||||||
|
|
||||||
this.initPreparedParam.setValueParam(parameterIndex - this.middleParamSize, x);
|
this.initPreparedParam.setValueParam(parameterIndex - this.middleParamSize, x);
|
||||||
return;
|
return;
|
||||||
|
@ -220,9 +224,9 @@ public class SavedPreparedStatement {
|
||||||
/**
|
/**
|
||||||
* add current param to batch list
|
* add current param to batch list
|
||||||
*/
|
*/
|
||||||
private void addCurrentRowParamToList(){
|
private void addCurrentRowParamToList() {
|
||||||
|
|
||||||
if (initPreparedParam != null && (this.middleParamSize > 0 || this.valueListSize > 0)){
|
if (initPreparedParam != null && (this.middleParamSize > 0 || this.valueListSize > 0)) {
|
||||||
this.sqlParamList.add(initPreparedParam); // add current param to batch list
|
this.sqlParamList.add(initPreparedParam); // add current param to batch list
|
||||||
}
|
}
|
||||||
this.isAddBatch = true;
|
this.isAddBatch = true;
|
||||||
|
@ -231,6 +235,7 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* execute the sql with batch sql
|
* execute the sql with batch sql
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
|
@ -238,13 +243,13 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
int result = executeBatchInternal();
|
int result = executeBatchInternal();
|
||||||
|
|
||||||
return new int[]{result};
|
return new int[]{result};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int executeBatchInternal() throws SQLException{
|
public int executeBatchInternal() throws SQLException {
|
||||||
|
|
||||||
if (!isAddBatch){
|
if (!isAddBatch) {
|
||||||
addCurrentRowParamToList(); // add current param to batch list
|
addCurrentRowParamToList(); // add current param to batch list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,26 +267,27 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate the batch sql
|
* generate the batch sql
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String generateExecuteSql(){
|
private String generateExecuteSql() {
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
stringBuilder.append(prefix);
|
stringBuilder.append(prefix);
|
||||||
stringBuilder.append(" into ");
|
stringBuilder.append(" into ");
|
||||||
|
|
||||||
if (!isTableNameDynamic){
|
if (!isTableNameDynamic) {
|
||||||
// tablename will not need to be replaced
|
// tablename will not need to be replaced
|
||||||
stringBuilder.append(middle);
|
stringBuilder.append(middle);
|
||||||
stringBuilder.append(" values");
|
stringBuilder.append(" values");
|
||||||
|
|
||||||
stringBuilder.append(replaceValueListParam(valueList, sqlParamList));
|
stringBuilder.append(replaceValueListParam(valueList, sqlParamList));
|
||||||
|
|
||||||
} else{
|
} else {
|
||||||
// need to replace tablename
|
// need to replace tablename
|
||||||
|
|
||||||
if (sqlParamList.size() > 0 ){
|
if (sqlParamList.size() > 0) {
|
||||||
|
|
||||||
TSDBPreparedParam firstPreparedParam = sqlParamList.get(0);
|
TSDBPreparedParam firstPreparedParam = sqlParamList.get(0);
|
||||||
|
|
||||||
|
@ -292,12 +298,12 @@ public class SavedPreparedStatement {
|
||||||
//the first param in the middleParamList is the tableName
|
//the first param in the middleParamList is the tableName
|
||||||
String lastTableName = firstPreparedParam.getMiddleParamList().get(0).toString();
|
String lastTableName = firstPreparedParam.getMiddleParamList().get(0).toString();
|
||||||
|
|
||||||
if (sqlParamList.size() > 1){
|
if (sqlParamList.size() > 1) {
|
||||||
|
|
||||||
for (int i = 1; i < sqlParamList.size(); i++){
|
for (int i = 1; i < sqlParamList.size(); i++) {
|
||||||
TSDBPreparedParam currentParam = sqlParamList.get(i);
|
TSDBPreparedParam currentParam = sqlParamList.get(i);
|
||||||
String currentTableName = currentParam.getMiddleParamList().get(0).toString();
|
String currentTableName = currentParam.getMiddleParamList().get(0).toString();
|
||||||
if (lastTableName.equalsIgnoreCase(currentTableName)){
|
if (lastTableName.equalsIgnoreCase(currentTableName)) {
|
||||||
// tablename is same with the last row ,so only need to append the part of value
|
// tablename is same with the last row ,so only need to append the part of value
|
||||||
|
|
||||||
String values = replaceTemplateParam(valueList, currentParam.getValueList());
|
String values = replaceTemplateParam(valueList, currentParam.getValueList());
|
||||||
|
@ -313,7 +319,7 @@ public class SavedPreparedStatement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
stringBuilder.append(middle);
|
stringBuilder.append(middle);
|
||||||
stringBuilder.append(" values");
|
stringBuilder.append(" values");
|
||||||
|
@ -327,10 +333,11 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replace the middle and value part
|
* replace the middle and value part
|
||||||
|
*
|
||||||
* @param tsdbPreparedParam
|
* @param tsdbPreparedParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String replaceMiddleAndValuePart(TSDBPreparedParam tsdbPreparedParam){
|
private String replaceMiddleAndValuePart(TSDBPreparedParam tsdbPreparedParam) {
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder(" ");
|
StringBuilder stringBuilder = new StringBuilder(" ");
|
||||||
|
|
||||||
|
@ -348,17 +355,18 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replace the placeholder of the template with TSDBPreparedParam list
|
* replace the placeholder of the template with TSDBPreparedParam list
|
||||||
|
*
|
||||||
* @param template
|
* @param template
|
||||||
* @param sqlParamList
|
* @param sqlParamList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String replaceValueListParam(String template, List<TSDBPreparedParam> sqlParamList){
|
private String replaceValueListParam(String template, List<TSDBPreparedParam> sqlParamList) {
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
if (sqlParamList.size() > 0 ){
|
if (sqlParamList.size() > 0) {
|
||||||
|
|
||||||
for (TSDBPreparedParam tsdbPreparedParam : sqlParamList){
|
for (TSDBPreparedParam tsdbPreparedParam : sqlParamList) {
|
||||||
|
|
||||||
String tmp = replaceTemplateParam(template, tsdbPreparedParam.getValueList());
|
String tmp = replaceTemplateParam(template, tsdbPreparedParam.getValueList());
|
||||||
|
|
||||||
|
@ -374,13 +382,14 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replace the placeholder of the template with paramList
|
* replace the placeholder of the template with paramList
|
||||||
|
*
|
||||||
* @param template
|
* @param template
|
||||||
* @param paramList
|
* @param paramList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String replaceTemplateParam(String template, List<Object> paramList){
|
private String replaceTemplateParam(String template, List<Object> paramList) {
|
||||||
|
|
||||||
if (paramList.size() > 0){
|
if (paramList.size() > 0) {
|
||||||
|
|
||||||
String tmp = template;
|
String tmp = template;
|
||||||
|
|
||||||
|
@ -402,20 +411,21 @@ public class SavedPreparedStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the string of param object
|
* get the string of param object
|
||||||
|
*
|
||||||
* @param paramObj
|
* @param paramObj
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getParamString(Object paramObj){
|
private String getParamString(Object paramObj) {
|
||||||
|
|
||||||
String paraStr = paramObj.toString();
|
String paraStr = paramObj.toString();
|
||||||
if (paramObj instanceof Timestamp || (paramObj instanceof String && !DEFAULT_VALUE.equalsIgnoreCase(paraStr))) {
|
if (paramObj instanceof Timestamp || (paramObj instanceof String && !DEFAULT_VALUE.equalsIgnoreCase(paraStr))) {
|
||||||
paraStr = "'" + paraStr + "'";
|
paraStr = "'" + paraStr + "'";
|
||||||
}
|
}
|
||||||
return paraStr;
|
return paraStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private int executeSql(String sql)throws SQLException{
|
private int executeSql(String sql) throws SQLException {
|
||||||
|
|
||||||
return tsdbPreparedStatement.executeUpdate(sql);
|
return tsdbPreparedStatement.executeUpdate(sql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,58 +30,59 @@ import java.util.regex.Pattern;
|
||||||
* compatibility needs.
|
* compatibility needs.
|
||||||
*/
|
*/
|
||||||
public class TSDBPreparedStatement extends TSDBStatement implements PreparedStatement {
|
public class TSDBPreparedStatement extends TSDBStatement implements PreparedStatement {
|
||||||
protected String rawSql;
|
protected String rawSql;
|
||||||
protected String sql;
|
protected String sql;
|
||||||
protected ArrayList<Object> parameters = new ArrayList<Object>();
|
protected ArrayList<Object> parameters = new ArrayList<Object>();
|
||||||
|
|
||||||
//start with insert or import and is case-insensitive
|
//start with insert or import and is case-insensitive
|
||||||
private static Pattern savePattern = Pattern.compile("(?i)^\\s*(insert|import)");
|
private static Pattern savePattern = Pattern.compile("(?i)^\\s*(insert|import)");
|
||||||
|
|
||||||
// is insert or import
|
// is insert or import
|
||||||
private boolean isSaved;
|
private boolean isSaved;
|
||||||
|
|
||||||
private SavedPreparedStatement savedPreparedStatement;
|
private SavedPreparedStatement savedPreparedStatement;
|
||||||
|
|
||||||
TSDBPreparedStatement(TSDBJNIConnector connecter, String sql) {
|
TSDBPreparedStatement(TSDBJNIConnector connecter, String sql) {
|
||||||
super(connecter);
|
super(connecter);
|
||||||
init(sql);
|
init(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init(String sql){
|
private void init(String sql) {
|
||||||
this.rawSql = sql;
|
this.rawSql = sql;
|
||||||
preprocessSql();
|
preprocessSql();
|
||||||
|
|
||||||
this.isSaved = isSavedSql(this.rawSql);
|
this.isSaved = isSavedSql(this.rawSql);
|
||||||
if (this.isSaved){
|
if (this.isSaved) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.savedPreparedStatement = new SavedPreparedStatement(this.rawSql, this);
|
this.savedPreparedStatement = new SavedPreparedStatement(this.rawSql, this);
|
||||||
} catch (SQLException e){
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if the precompiled sql is insert or import
|
* if the precompiled sql is insert or import
|
||||||
* @param sql
|
*
|
||||||
* @return
|
* @param sql
|
||||||
*/
|
* @return
|
||||||
private boolean isSavedSql(String sql){
|
*/
|
||||||
Matcher matcher = savePattern.matcher(sql);
|
private boolean isSavedSql(String sql) {
|
||||||
return matcher.find();
|
Matcher matcher = savePattern.matcher(sql);
|
||||||
}
|
return matcher.find();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] executeBatch() throws SQLException {
|
public int[] executeBatch() throws SQLException {
|
||||||
if (isSaved){
|
if (isSaved) {
|
||||||
return this.savedPreparedStatement.executeBatch();
|
return this.savedPreparedStatement.executeBatch();
|
||||||
} else {
|
} else {
|
||||||
return super.executeBatch();
|
return super.executeBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Object> getParameters() {
|
public ArrayList<Object> getParameters() {
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,41 +102,41 @@ public class TSDBPreparedStatement extends TSDBStatement implements PreparedStat
|
||||||
private void preprocessSql() {
|
private void preprocessSql() {
|
||||||
|
|
||||||
/***** For processing some of Spark SQLs*****/
|
/***** For processing some of Spark SQLs*****/
|
||||||
// should replace it first
|
// should replace it first
|
||||||
this.rawSql = this.rawSql.replaceAll("or (.*) is null", "");
|
this.rawSql = this.rawSql.replaceAll("or (.*) is null", "");
|
||||||
this.rawSql = this.rawSql.replaceAll(" where ", " WHERE ");
|
this.rawSql = this.rawSql.replaceAll(" where ", " WHERE ");
|
||||||
this.rawSql = this.rawSql.replaceAll(" or ", " OR ");
|
this.rawSql = this.rawSql.replaceAll(" or ", " OR ");
|
||||||
this.rawSql = this.rawSql.replaceAll(" and ", " AND ");
|
this.rawSql = this.rawSql.replaceAll(" and ", " AND ");
|
||||||
this.rawSql = this.rawSql.replaceAll(" is null", " IS NULL");
|
this.rawSql = this.rawSql.replaceAll(" is null", " IS NULL");
|
||||||
this.rawSql = this.rawSql.replaceAll(" is not null", " IS NOT NULL");
|
this.rawSql = this.rawSql.replaceAll(" is not null", " IS NOT NULL");
|
||||||
|
|
||||||
// SELECT * FROM db.tb WHERE 1=0
|
// SELECT * FROM db.tb WHERE 1=0
|
||||||
this.rawSql = this.rawSql.replaceAll("WHERE 1=0", "WHERE _c0=1");
|
this.rawSql = this.rawSql.replaceAll("WHERE 1=0", "WHERE _c0=1");
|
||||||
this.rawSql = this.rawSql.replaceAll("WHERE 1=2", "WHERE _c0=1");
|
this.rawSql = this.rawSql.replaceAll("WHERE 1=2", "WHERE _c0=1");
|
||||||
|
|
||||||
// SELECT "ts","val" FROM db.tb
|
// SELECT "ts","val" FROM db.tb
|
||||||
this.rawSql = this.rawSql.replaceAll("\"", "");
|
this.rawSql = this.rawSql.replaceAll("\"", "");
|
||||||
|
|
||||||
// SELECT 1 FROM db.tb
|
// SELECT 1 FROM db.tb
|
||||||
this.rawSql = this.rawSql.replaceAll("SELECT 1 FROM", "SELECT * FROM");
|
this.rawSql = this.rawSql.replaceAll("SELECT 1 FROM", "SELECT * FROM");
|
||||||
|
|
||||||
// SELECT "ts","val" FROM db.tb WHERE ts < 33 or ts is null
|
// SELECT "ts","val" FROM db.tb WHERE ts < 33 or ts is null
|
||||||
this.rawSql = this.rawSql.replaceAll("OR (.*) IS NULL", "");
|
this.rawSql = this.rawSql.replaceAll("OR (.*) IS NULL", "");
|
||||||
|
|
||||||
// SELECT "ts","val" FROM db.tb WHERE ts is null or ts < 33
|
// SELECT "ts","val" FROM db.tb WHERE ts is null or ts < 33
|
||||||
this.rawSql = this.rawSql.replaceAll("(.*) IS NULL OR", "");
|
this.rawSql = this.rawSql.replaceAll("(.*) IS NULL OR", "");
|
||||||
|
|
||||||
// SELECT 1 FROM db.tb WHERE (("val" IS NOT NULL) AND ("val" > 50)) AND (ts >= 66)
|
// SELECT 1 FROM db.tb WHERE (("val" IS NOT NULL) AND ("val" > 50)) AND (ts >= 66)
|
||||||
this.rawSql = this.rawSql.replaceAll("\\(\\((.*) IS NOT NULL\\) AND", "(");
|
this.rawSql = this.rawSql.replaceAll("\\(\\((.*) IS NOT NULL\\) AND", "(");
|
||||||
|
|
||||||
// SELECT 1 FROM db.tb WHERE ("val" IS NOT NULL) AND ("val" > 50) AND (ts >= 66)
|
// SELECT 1 FROM db.tb WHERE ("val" IS NOT NULL) AND ("val" > 50) AND (ts >= 66)
|
||||||
this.rawSql = this.rawSql.replaceAll("\\((.*) IS NOT NULL\\) AND", "");
|
this.rawSql = this.rawSql.replaceAll("\\((.*) IS NOT NULL\\) AND", "");
|
||||||
|
|
||||||
// SELECT "ts","val" FROM db.tb WHERE (("val" IS NOT NULL)) AND (ts < 33 or ts is null)
|
// SELECT "ts","val" FROM db.tb WHERE (("val" IS NOT NULL)) AND (ts < 33 or ts is null)
|
||||||
this.rawSql = this.rawSql.replaceAll("\\(\\((.*) IS NOT NULL\\)\\) AND", "");
|
this.rawSql = this.rawSql.replaceAll("\\(\\((.*) IS NOT NULL\\)\\) AND", "");
|
||||||
|
|
||||||
/***** For processing inner subqueries *****/
|
/***** For processing inner subqueries *****/
|
||||||
Pattern pattern = Pattern.compile("FROM\\s+((\\(.+\\))\\s+SUB_QRY)", Pattern.CASE_INSENSITIVE);
|
Pattern pattern = Pattern.compile("FROM\\s+((\\(.+\\))\\s+SUB_QRY)", Pattern.CASE_INSENSITIVE);
|
||||||
Matcher matcher = pattern.matcher(rawSql);
|
Matcher matcher = pattern.matcher(rawSql);
|
||||||
String tableFullName = "";
|
String tableFullName = "";
|
||||||
if (matcher.find() && matcher.groupCount() == 2) {
|
if (matcher.find() && matcher.groupCount() == 2) {
|
||||||
|
@ -149,328 +150,329 @@ public class TSDBPreparedStatement extends TSDBStatement implements PreparedStat
|
||||||
}
|
}
|
||||||
/***** for inner queries *****/
|
/***** for inner queries *****/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate parameters into prepared sql statements
|
* Populate parameters into prepared sql statements
|
||||||
|
*
|
||||||
* @return a string of the native sql statement for TSDB
|
* @return a string of the native sql statement for TSDB
|
||||||
*/
|
*/
|
||||||
private String getNativeSql() {
|
private String getNativeSql() {
|
||||||
this.sql = this.rawSql;
|
this.sql = this.rawSql;
|
||||||
for (int i = 0; i < parameters.size(); ++i) {
|
for (int i = 0; i < parameters.size(); ++i) {
|
||||||
Object para = parameters.get(i);
|
Object para = parameters.get(i);
|
||||||
if (para != null) {
|
if (para != null) {
|
||||||
String paraStr = para.toString();
|
String paraStr = para.toString();
|
||||||
if (para instanceof Timestamp || para instanceof String) {
|
if (para instanceof Timestamp || para instanceof String) {
|
||||||
paraStr = "'" + paraStr + "'";
|
paraStr = "'" + paraStr + "'";
|
||||||
}
|
}
|
||||||
this.sql = this.sql.replaceFirst("[?]", paraStr);
|
this.sql = this.sql.replaceFirst("[?]", paraStr);
|
||||||
} else {
|
} else {
|
||||||
this.sql = this.sql.replaceFirst("[?]", "NULL");
|
this.sql = this.sql.replaceFirst("[?]", "NULL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parameters.clear();
|
parameters.clear();
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultSet executeQuery() throws SQLException {
|
public ResultSet executeQuery() throws SQLException {
|
||||||
if (isSaved){
|
if (isSaved) {
|
||||||
this.savedPreparedStatement.executeBatchInternal();
|
this.savedPreparedStatement.executeBatchInternal();
|
||||||
return null;
|
return null;
|
||||||
}else {
|
} else {
|
||||||
return super.executeQuery(getNativeSql());
|
return super.executeQuery(getNativeSql());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int executeUpdate() throws SQLException {
|
public int executeUpdate() throws SQLException {
|
||||||
if (isSaved){
|
if (isSaved) {
|
||||||
return this.savedPreparedStatement.executeBatchInternal();
|
return this.savedPreparedStatement.executeBatchInternal();
|
||||||
} else {
|
} else {
|
||||||
return super.executeUpdate(getNativeSql());
|
return super.executeUpdate(getNativeSql());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNull(int parameterIndex, int sqlType) throws SQLException {
|
public void setNull(int parameterIndex, int sqlType) throws SQLException {
|
||||||
setObject(parameterIndex, new String("NULL"));
|
setObject(parameterIndex, new String("NULL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
|
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setByte(int parameterIndex, byte x) throws SQLException {
|
public void setByte(int parameterIndex, byte x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setShort(int parameterIndex, short x) throws SQLException {
|
public void setShort(int parameterIndex, short x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInt(int parameterIndex, int x) throws SQLException {
|
public void setInt(int parameterIndex, int x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLong(int parameterIndex, long x) throws SQLException {
|
public void setLong(int parameterIndex, long x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFloat(int parameterIndex, float x) throws SQLException {
|
public void setFloat(int parameterIndex, float x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDouble(int parameterIndex, double x) throws SQLException {
|
public void setDouble(int parameterIndex, double x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
|
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setString(int parameterIndex, String x) throws SQLException {
|
public void setString(int parameterIndex, String x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBytes(int parameterIndex, byte[] x) throws SQLException {
|
public void setBytes(int parameterIndex, byte[] x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDate(int parameterIndex, Date x) throws SQLException {
|
public void setDate(int parameterIndex, Date x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTime(int parameterIndex, Time x) throws SQLException {
|
public void setTime(int parameterIndex, Time x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
|
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
|
||||||
setObject(parameterIndex, x);
|
setObject(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
|
public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
|
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
|
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearParameters() throws SQLException {
|
public void clearParameters() throws SQLException {
|
||||||
parameters.clear();
|
parameters.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
|
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setObject(int parameterIndex, Object x) throws SQLException {
|
public void setObject(int parameterIndex, Object x) throws SQLException {
|
||||||
if (isSaved){
|
if (isSaved) {
|
||||||
this.savedPreparedStatement.setParam(parameterIndex, x);
|
this.savedPreparedStatement.setParam(parameterIndex, x);
|
||||||
}else{
|
} else {
|
||||||
parameters.add(x);
|
parameters.add(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute() throws SQLException {
|
public boolean execute() throws SQLException {
|
||||||
if (isSaved){
|
if (isSaved) {
|
||||||
int result = this.savedPreparedStatement.executeBatchInternal();
|
int result = this.savedPreparedStatement.executeBatchInternal();
|
||||||
return result > 0;
|
return result > 0;
|
||||||
} else {
|
} else {
|
||||||
return super.execute(getNativeSql());
|
return super.execute(getNativeSql());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBatch() throws SQLException {
|
public void addBatch() throws SQLException {
|
||||||
if (isSaved){
|
if (isSaved) {
|
||||||
this.savedPreparedStatement.addBatch();
|
this.savedPreparedStatement.addBatch();
|
||||||
}else {
|
} else {
|
||||||
|
|
||||||
if (this.batchedArgs == null) {
|
if (this.batchedArgs == null) {
|
||||||
batchedArgs = new ArrayList<String>();
|
batchedArgs = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
super.addBatch(getNativeSql());
|
super.addBatch(getNativeSql());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
|
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRef(int parameterIndex, Ref x) throws SQLException {
|
public void setRef(int parameterIndex, Ref x) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlob(int parameterIndex, Blob x) throws SQLException {
|
public void setBlob(int parameterIndex, Blob x) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setClob(int parameterIndex, Clob x) throws SQLException {
|
public void setClob(int parameterIndex, Clob x) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setArray(int parameterIndex, Array x) throws SQLException {
|
public void setArray(int parameterIndex, Array x) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultSetMetaData getMetaData() throws SQLException {
|
public ResultSetMetaData getMetaData() throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
|
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
|
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
|
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
|
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setURL(int parameterIndex, URL x) throws SQLException {
|
public void setURL(int parameterIndex, URL x) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParameterMetaData getParameterMetaData() throws SQLException {
|
public ParameterMetaData getParameterMetaData() throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRowId(int parameterIndex, RowId x) throws SQLException {
|
public void setRowId(int parameterIndex, RowId x) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNString(int parameterIndex, String value) throws SQLException {
|
public void setNString(int parameterIndex, String value) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException {
|
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNClob(int parameterIndex, NClob value) throws SQLException {
|
public void setNClob(int parameterIndex, NClob value) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
|
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
|
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
|
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
|
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException {
|
public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
|
public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
|
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException {
|
public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
|
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
|
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {
|
public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
|
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setClob(int parameterIndex, Reader reader) throws SQLException {
|
public void setClob(int parameterIndex, Reader reader) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
|
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
|
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class TSDBPreparedParam {
|
||||||
this.middleParamList = middleParamList;
|
this.middleParamList = middleParamList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMiddleParam(int parameterIndex, Object x){
|
public void setMiddleParam(int parameterIndex, Object x) {
|
||||||
this.middleParamList.set(parameterIndex, x);
|
this.middleParamList.set(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class TSDBPreparedParam {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setValueParam(int parameterIndex, Object x){
|
public void setValueParam(int parameterIndex, Object x) {
|
||||||
this.valueList.set(parameterIndex, x);
|
this.valueList.set(parameterIndex, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue