mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修正测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@162 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -41,37 +41,37 @@ public class MySqlSelectParser extends SQLSelectParser {
|
||||
|
||||
@Override
|
||||
protected final String as() throws ParserException {
|
||||
String rtnValue = null;
|
||||
String alias = null;
|
||||
|
||||
if (lexer.token() == Token.AS) {
|
||||
lexer.nextToken();
|
||||
|
||||
if (lexer.token() == Token.LITERAL_ALIAS) {
|
||||
rtnValue = lexer.stringVal();
|
||||
alias = '"' + lexer.stringVal() + '"';
|
||||
lexer.nextToken();
|
||||
return rtnValue;
|
||||
return alias;
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.IDENTIFIER) {
|
||||
rtnValue = lexer.stringVal();
|
||||
alias = lexer.stringVal();
|
||||
lexer.nextToken();
|
||||
return rtnValue;
|
||||
return alias;
|
||||
}
|
||||
|
||||
throw new ParserException("Error", 0, 0);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LITERAL_ALIAS) {
|
||||
rtnValue = lexer.stringVal();
|
||||
alias = '"' + lexer.stringVal() + '"';
|
||||
lexer.nextToken();
|
||||
} else if (lexer.token() == Token.IDENTIFIER) {
|
||||
rtnValue = lexer.stringVal();
|
||||
alias = lexer.stringVal();
|
||||
lexer.nextToken();
|
||||
} else if (lexer.token() == Token.LITERAL_CHARS) {
|
||||
rtnValue = "'" + lexer.stringVal() + "'";
|
||||
alias = "'" + lexer.stringVal() + "'";
|
||||
lexer.nextToken();
|
||||
}
|
||||
return rtnValue;
|
||||
return alias;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,14 +16,14 @@ import com.alibaba.druid.util.JdbcUtils;
|
||||
public class MySqlParserResourceTest extends TestCase {
|
||||
|
||||
public void test_0() throws Exception {
|
||||
// exec_test("bvt/parser/mysql-0.txt");
|
||||
// exec_test("bvt/parser/mysql-1.txt");
|
||||
// exec_test("bvt/parser/mysql-2.txt");
|
||||
// exec_test("bvt/parser/mysql-3.txt");
|
||||
// exec_test("bvt/parser/mysql-4.txt");
|
||||
// exec_test("bvt/parser/mysql-5.txt");
|
||||
// exec_test("bvt/parser/mysql-6.txt");
|
||||
// exec_test("bvt/parser/mysql-7.txt");
|
||||
exec_test("bvt/parser/mysql-0.txt");
|
||||
exec_test("bvt/parser/mysql-1.txt");
|
||||
exec_test("bvt/parser/mysql-2.txt");
|
||||
exec_test("bvt/parser/mysql-3.txt");
|
||||
exec_test("bvt/parser/mysql-4.txt");
|
||||
exec_test("bvt/parser/mysql-5.txt");
|
||||
exec_test("bvt/parser/mysql-6.txt");
|
||||
exec_test("bvt/parser/mysql-7.txt");
|
||||
exec_test("bvt/parser/mysql-8.txt");
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ ON a.panel_id = c.panel_id
|
||||
WHERE b.user_id = ? and ((b.is_grid='y' and c.param_name='is_hidden' and c.param_value='false') or b.is_grid != 'y')
|
||||
ORDER BY a.col ASC, a.position ASC
|
||||
---------------------------
|
||||
SELECT DISTINCT a.id AS id, a.col AS col, a.position AS position, a.panel_id AS panel_id
|
||||
SELECT DISTINCT a.id AS "id", a.col AS "col", a.position AS "position", a.panel_id AS "panelId"
|
||||
FROM view_position_info a LEFT JOIN view_portal b ON a.panel_id = b.panel_id LEFT JOIN view_portal_panel c ON a.panel_id = c.panel_id
|
||||
WHERE b.user_id = ? AND (b.is_grid = 'y' AND c.param_name = 'is_hidden' AND c.param_value = 'false' OR b.is_grid != 'y')
|
||||
ORDER BY a.col ASC, a.position ASC
|
||||
ORDER BY a.col ASC, a.position ASC
|
||||
@@ -7,7 +7,7 @@
|
||||
ORDER BY sequence desc
|
||||
LIMIT ?, ?
|
||||
---------------------------
|
||||
SELECT id, item_type AS 'itemType', item_id AS 'itemId', item_name AS 'itemName', app_id AS 'appId', sequence, refresh_intv AS refresh_intv
|
||||
SELECT id, item_type AS 'itemType', item_id AS 'itemId', item_name AS 'itemName', app_id AS 'appId', sequence, refresh_intv AS "refreshIntv"
|
||||
FROM view_portal_info
|
||||
WHERE 1 = 1 AND item_type = ? AND app_id = ?
|
||||
ORDER BY sequence DESC
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
FROM sys_user
|
||||
LIMIT ?, ?
|
||||
---------------------------
|
||||
SELECT id AS id, username AS username, password AS password, name AS name, staff_num AS staff_num, wangwang AS wangwang, email AS email, mobile AS mobile, is_deleted AS is_deleted, is_admin AS is_admin, gmt_create AS gmt_create
|
||||
SELECT id AS "id", username AS "username", password AS "password", name AS "name", staff_num AS "staffNumber", wangwang AS "wangwang", email AS "email", mobile AS "mobile", is_deleted AS "isDeleted", is_admin AS "isAdmin", gmt_create AS "gmtCreate"
|
||||
FROM sys_user
|
||||
LIMIT ?, ?
|
||||
Reference in New Issue
Block a user