mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve SQL Eval support
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.bvt.filter.wall;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.wall.WallUtils;
|
||||
|
||||
/**
|
||||
* SQLServerWallTest
|
||||
*
|
||||
* @author RaymondXiu
|
||||
* @version 1.0, 2012-3-18
|
||||
* @see
|
||||
*/
|
||||
public class TAEWallTest extends TestCase {
|
||||
|
||||
public void test_true() throws Exception {
|
||||
Assert.assertTrue(WallUtils.isValidateMySql(//
|
||||
"select * from t where 1=1 AND status = 1")); //
|
||||
}
|
||||
|
||||
public void test_false() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateMySql(//
|
||||
"select * from t where status = 1 AND 1=1")); //
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
|
||||
public class EvalMethodBinTest extends TestCase {
|
||||
public void test_reverse() throws Exception {
|
||||
Assert.assertEquals(32, SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "BIT_LENGTH('text')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
|
||||
public class EvalMethodBitLengthTest extends TestCase {
|
||||
public void test_reverse() throws Exception {
|
||||
Assert.assertEquals("1100", SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "BIN(12)"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
|
||||
public class EvalMethodTest_Char extends TestCase {
|
||||
public void test_reverse() throws Exception {
|
||||
Assert.assertEquals("MySQL", SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "CHAR(77,121,83,81,'76')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
|
||||
public class EvalMethodTest_Char_1 extends TestCase {
|
||||
public void test_reverse() throws Exception {
|
||||
Assert.assertEquals("MMM", SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "CHAR(77,77.3,'77.3')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_Elt extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("ej",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "ELT(1, 'ej', 'Heja', 'hej', 'foo')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_Elt_1 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals(null,
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "ELT(11, 'ej', 'Heja', 'hej', 'foo')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_insert extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("Quadratic",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "INSERT('Quadratic', -1, 4, 'What')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_insert_1 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("QuWhattic",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "INSERT('Quadratic', 3, 4, 'What')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_insert_2 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("QuWhat",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "INSERT('Quadratic', 3, 100, 'What')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_instr extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals(4, SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "INSTR('foobarbar', 'bar')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_instr_1 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals(0, SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "INSTR('xbar', 'foobar')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_lcase extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("quadratically",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LOWER('QUADRATICALLY')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_left extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("fooba",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LEFT('foobarbar', 5)"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_len extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals(4, SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LENGTH('text')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_locate extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals(4, SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LOCATE('bar', 'foobarbar')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_locate_1 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals(0, SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LOCATE('xbar', 'foobar')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_locate_2 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals(7, SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LOCATE('bar', 'foobarbar', 5)"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_lower extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("quadratically",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LOWER('QUADRATICALLY')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_lpad extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("??hi", SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LPAD('hi',4,'??')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_lpad_1 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("h", SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LPAD('hi',1,'??')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_ltrim extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("barbar", SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "LTRIM(' barbar')"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_mid extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("ratically", SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "mid('Quadratically',5)"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_substring extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("barbar",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "SUBSTRING('foobarbar' FROM 4)"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_substring_1 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("ratica",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "SUBSTRING('Quadratically',5,6)"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_substring_2 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("ila",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "SUBSTRING('Sakila', -3)"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_substring_3 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("aki",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "SUBSTRING('Sakila', -5, 3)"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.druid.bvt.sql.eval;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class EvalMethodTest_substring_4 extends TestCase {
|
||||
|
||||
public void test_method() throws Exception {
|
||||
Assert.assertEquals("ki",
|
||||
SQLEvalVisitorUtils.evalExpr(JdbcConstants.MYSQL, "SUBSTRING('Sakila' FROM -4 FOR 2)"));
|
||||
}
|
||||
}
|
||||
@@ -519,7 +519,7 @@ public class StringFunctionsTest extends TestCase {
|
||||
|
||||
String text = output(stmtList);
|
||||
|
||||
Assert.assertEquals("SELECT SUBSTRING('Sakila' FROM -4 FOR 2);", text);
|
||||
Assert.assertEquals("SELECT SUBSTRING('Sakila', -4, 2);", text);
|
||||
}
|
||||
|
||||
public void test_45() throws Exception {
|
||||
@@ -530,7 +530,7 @@ public class StringFunctionsTest extends TestCase {
|
||||
|
||||
String text = output(stmtList);
|
||||
|
||||
Assert.assertEquals("SELECT SUBSTRING('foobarbar' FROM 4);", text);
|
||||
Assert.assertEquals("SELECT SUBSTRING('foobarbar', 4);", text);
|
||||
}
|
||||
|
||||
public void test_46() throws Exception {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.bvt.sql.postgresql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.PGTest;
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGSchemaStatVisitor;
|
||||
|
||||
public class PGSelectTest10 extends PGTest {
|
||||
|
||||
public void test_0() throws Exception {
|
||||
String sql = "SELECT nextval('passport_id_seq'::regclass) as id";
|
||||
|
||||
PGSQLStatementParser parser = new PGSQLStatementParser(sql);
|
||||
List<SQLStatement> statementList = parser.parseStatementList();
|
||||
SQLStatement statemen = statementList.get(0);
|
||||
print(statementList);
|
||||
|
||||
Assert.assertEquals(1, statementList.size());
|
||||
|
||||
PGSchemaStatVisitor visitor = new PGSchemaStatVisitor();
|
||||
statemen.accept(visitor);
|
||||
|
||||
System.out.println("Tables : " + visitor.getTables());
|
||||
System.out.println("fields : " + visitor.getColumns());
|
||||
System.out.println("coditions : " + visitor.getConditions());
|
||||
|
||||
Assert.assertEquals(0, visitor.getColumns().size());
|
||||
Assert.assertEquals(0, visitor.getTables().size());
|
||||
}
|
||||
}
|
||||
|
||||
// select categoryId , offerIds from cnres.function_select_get_spt_p4p_offer_list (' 1031918 , 1031919 , 1037004 ') as
|
||||
// a(categoryId numeric,offerIds character varying(4000))
|
||||
// select memberId , offerIds from cnres.function_select_get_seller_hot_offer_list('\'gzyyd168\'') as a(memberId
|
||||
// character varying(20),offerIds character varying(4000))
|
||||
|
||||
@@ -35,9 +35,9 @@ public class MySqlHexTest extends TestCase {
|
||||
private DruidDataSource dataSource;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
jdbcUrl = "jdbc:mysql://10.20.149.16:3306/circe0_test";
|
||||
user = "circe";
|
||||
password = "circe";
|
||||
jdbcUrl = "jdbc:mysql://hbase-01:3306/sonar";
|
||||
user = "sonar";
|
||||
password = "sonar";
|
||||
driverClass = "com.mysql.jdbc.Driver";
|
||||
|
||||
dataSource = new DruidDataSource();
|
||||
@@ -54,7 +54,7 @@ public class MySqlHexTest extends TestCase {
|
||||
|
||||
Connection conn = dataSource.getConnection();
|
||||
|
||||
String sql = "select hex('123'),hex(123)";
|
||||
String sql = "SELECT INSERT('Quadratic', 1, 4, 'What')";
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user