-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathparser_ap_stack_test.go
70 lines (64 loc) · 2.98 KB
/
parser_ap_stack_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package parser
import "testing"
func TestDynamicSQL(t *testing.T) {
testParserQuery(t, true, `
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sqls id="Bc" longname="批量SQL" package="cn.tt"
xsi:noNamespaceSchemaLocation="ltts-model.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<procedure method="normal" id="Make_Daily" longname="test1">
<sql type="oracle"><![CDATA[call sqle.users(#acctdt#,#erorcd#,#errmsg#)]]></sql>
</procedure>
<procedure method="normal" id="Backup_Hist" longname="test2">
<sql type="oracle"><![CDATA[call sqle.workflows(#acctdt#,#erorcd#,#errmsg#)]]></sql>
</procedure>
<dynamicSelect cache="none" method="selectAll" type="sql" id="test1" longname="test">
<dynamicSql type="mysql">
<str type="Str"><![CDATA[
select tranno from rps_errr_detl where ckdate = #ckdate# and hadres in (3,7)
]]></str>
</dynamicSql>
</dynamicSelect>
<dynamicUpdate method="update" id="test" longname="test">
<dynamicSql type="mysql">
<str type="Str"><![CDATA[
UPDATE rps_mesg_push p SET p.msgsta=4,p.gmt_modified=now(6) WHERE p.msgsta IN (1,3) AND p.temcod=${temcod}
]]></str>
</dynamicSql>
</dynamicUpdate>
<dynamicDelete method="delete" id="delTableDaByid" longname="test">
<dynamicSql type="mysql">
<str type="Str"><![CDATA[delete from ${tablena} ]]></str>
<where type="Where">
<str type="Str"><![CDATA[id between #minid# and #maxid# limit ${limitcout} ]]></str>
</where>
</dynamicSql>
</dynamicDelete>
<dynamicSelect cache="none" method="selectOne" type="sql" id="selWarnInfoDa" longname="test">
<dynamicSql type="mysql">
<if test="schema!=null && schema!=""" type="If">
<str type="Str"><![CDATA[${schema}]]></str>
</if>
<if test="schema!=null && schema!=""" type="If">
<str type="Str"><![CDATA[${schema}]]></str>
</if>
<str type="Str"><![CDATA[select count(*) from rps_warn_info ]]></str>
<where type="Where">
<and type="And">
<if test="warnty!=""&&warnty!=null" type="If">
<str type="Str"><![CDATA[warnty in (${warnty})]]></str>
</if>
<str type="Str"><![CDATA[gmt_modified between #starttime# and #endtime#]]></str>
</and>
</where>
</dynamicSql>
</dynamicSelect>
</sqls>
`, []string{
"call sqle.users(?,?,?)",
"call sqle.workflows(?,?,?)",
"SELECT `tranno` FROM `rps_errr_detl` WHERE `ckdate`=? AND `hadres` IN (3,7)",
"UPDATE `rps_mesg_push` AS `p` SET `p`.`msgsta`=4, `p`.`gmt_modified`=now(6) WHERE `p`.`msgsta` IN (1,3) AND `p`.`temcod`=?",
" delete from ? WHERE id between ? and ? limit ?",
"SELECT count(1) FROM `rps_warn_info` WHERE (`warnty` IN (?)) AND (`gmt_modified` BETWEEN ? AND ?)",
})
}