mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for 1) tddl insert merge, 2) slf4j dependency problem
This commit is contained in:
@@ -29,7 +29,7 @@ public class SQLExprTableSource extends SQLTableSourceImpl {
|
||||
}
|
||||
|
||||
public SQLExprTableSource(SQLExpr expr){
|
||||
this.expr = expr;
|
||||
this.setExpr(expr);
|
||||
}
|
||||
|
||||
public SQLExpr getExpr() {
|
||||
|
||||
@@ -874,7 +874,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
print("INTO ");
|
||||
|
||||
x.getTableName().accept(this);
|
||||
x.getTableSource().accept(this);
|
||||
|
||||
if (x.getColumns().size() > 0) {
|
||||
incrementIndent();
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ public class MySqlParameterizedOutputVisitor extends MySqlOutputVisitor {
|
||||
|
||||
print("INTO ");
|
||||
|
||||
x.getTableName().accept(this);
|
||||
x.getTableSource().accept(this);
|
||||
|
||||
if (x.getColumns().size() > 0) {
|
||||
print(" (");
|
||||
|
||||
@@ -1627,7 +1627,7 @@ public class OracleOutputVisitor extends SQLASTOutputVisitor implements OracleAS
|
||||
public boolean visit(InsertIntoClause x) {
|
||||
print("INTO ");
|
||||
|
||||
x.getTableName().accept(this);
|
||||
x.getTableSource().accept(this);
|
||||
|
||||
if (x.getColumns().size() > 0) {
|
||||
incrementIndent();
|
||||
|
||||
@@ -329,7 +329,7 @@ public class PGOutputVisitor extends SQLASTOutputVisitor implements PGASTVisitor
|
||||
|
||||
print("INSERT INTO ");
|
||||
|
||||
x.getTableName().accept(this);
|
||||
x.getTableSource().accept(this);
|
||||
|
||||
if (x.getColumns().size() > 0) {
|
||||
incrementIndent();
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public class SQLServerOutputVisitor extends SQLASTOutputVisitor implements SQLSe
|
||||
public boolean visit(SQLServerInsertStatement x) {
|
||||
print("INSERT INTO ");
|
||||
|
||||
x.getTableName().accept(this);
|
||||
x.getTableSource().accept(this);
|
||||
|
||||
if (x.getColumns().size() > 0) {
|
||||
incrementIndent();
|
||||
|
||||
@@ -39,11 +39,11 @@ public class ParameterizedOutputVisitorUtils {
|
||||
public static String parameterize(String sql, String dbType) {
|
||||
SQLStatementParser parser = SQLParserUtils.createSQLStatementParser(sql, dbType);
|
||||
List<SQLStatement> statementList = parser.parseStatementList();
|
||||
SQLStatement statemen = statementList.get(0);
|
||||
SQLStatement stmt = statementList.get(0);
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
SQLASTOutputVisitor visitor = createParameterizedOutputVisitor(out, dbType);
|
||||
statemen.accept(visitor);
|
||||
stmt.accept(visitor);
|
||||
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter {
|
||||
public boolean visit(SQLInsertStatement x) {
|
||||
print("INSERT INTO ");
|
||||
|
||||
x.getTableName().accept(this);
|
||||
x.getTableSource().accept(this);
|
||||
|
||||
if (x.getColumns().size() > 0) {
|
||||
incrementIndent();
|
||||
|
||||
@@ -26,7 +26,7 @@ public class LogFactory {
|
||||
// TODO add slf4j logging
|
||||
|
||||
// 优先选择log4j,而非Apache Common Logging. 因为后者无法设置真实Log调用者的信息
|
||||
tryImplementation("org.slf4j.Logger", "com.alibaba.druid.support.logging.SLF4JImpl");
|
||||
tryImplementation("org.slf4j.Logger", "com.alibaba.druid.support.logging.SLF4JImpl");
|
||||
tryImplementation("org.apache.log4j.Logger", "com.alibaba.druid.support.logging.Log4jImpl");
|
||||
tryImplementation("java.util.logging.Logger", "com.alibaba.druid.support.logging.Jdk14LoggingImpl");
|
||||
tryImplementation("org.apache.commons.logging.LogFactory",
|
||||
@@ -57,6 +57,12 @@ public class LogFactory {
|
||||
if (!Log.class.isAssignableFrom(declareClass)) {
|
||||
logConstructor = null;
|
||||
}
|
||||
|
||||
try {
|
||||
logConstructor.newInstance(LogFactory.class);
|
||||
} catch (Throwable t) {
|
||||
logConstructor = null;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
// skip
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 1999-2011 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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 com.alibaba.druid.support.logging;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
Reference in New Issue
Block a user