mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge pull request #1206 from wenshao/master
bug fixed for SQLServerOutputVisitor visit 'with clause', for issue 1…
This commit is contained in:
+5
-5
@@ -258,17 +258,17 @@ public class SQLServerOutputVisitor extends SQLASTOutputVisitor implements SQLSe
|
||||
public boolean visit(SQLExprTableSource x) {
|
||||
x.getExpr().accept(this);
|
||||
|
||||
if (x.getAlias() != null) {
|
||||
print(' ');
|
||||
print0(x.getAlias());
|
||||
}
|
||||
|
||||
if (x.getHints() != null && x.getHints().size() > 0) {
|
||||
print0(ucase ? " WITH (" : " with (");
|
||||
printAndAccept(x.getHints(), ", ");
|
||||
print(')');
|
||||
}
|
||||
|
||||
if (x.getAlias() != null) {
|
||||
print(' ');
|
||||
print0(x.getAlias());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.alibaba.druid.bvt.sql;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.PagerUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class PagerUtilsTest_Limit_SQLServer_5 extends TestCase {
|
||||
|
||||
public void test_db2_union() throws Exception {
|
||||
String sql = " select * from test t with (nolock)";
|
||||
String result = PagerUtils.limit(sql, JdbcConstants.SQL_SERVER, 0, 10);
|
||||
Assert.assertEquals("SELECT TOP 10 *"
|
||||
+ "\nFROM test t WITH (nolock)", result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user