Skip to content

Commit cc62db7

Browse files
committed
Add tests for Xorm first argument of varargs slice
1 parent 5a0cd2e commit cc62db7

File tree

1 file changed

+61
-56
lines changed
  • go/ql/test/library-tests/semmle/go/frameworks/SQL

1 file changed

+61
-56
lines changed

go/ql/test/library-tests/semmle/go/frameworks/SQL/xorm.go

Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,68 +10,73 @@ import (
1010

1111
func xormtest() {
1212
query := "UntrustedString"
13+
arg := "arg"
1314

1415
engine1 := xorm1.Engine{}
15-
engine1.Query(query) // $ querystring=query
16-
engine1.QueryString(query) // $ querystring=query
17-
engine1.QueryInterface(query) // $ querystring=query
18-
engine1.SQL(query) // $ querystring=query
19-
engine1.Where(query) // $ querystring=query
20-
engine1.Alias(query) // $ querystring=query
21-
engine1.NotIn(query) // $ querystring=query
22-
engine1.In(query) // $ querystring=query
23-
engine1.Select(query) // $ querystring=query
24-
engine1.SetExpr(query, nil) // $ querystring=query
25-
engine1.OrderBy(query) // $ querystring=query
26-
engine1.Having(query) // $ querystring=query
27-
engine1.GroupBy(query) // $ querystring=query
16+
engine1.Query(query, arg) // $ querystring=query
17+
engine1.Exec(query, arg) // $ querystring=query
18+
engine1.QueryString(query, arg) // $ querystring=query
19+
engine1.QueryInterface(query, arg) // $ querystring=query
20+
engine1.SQL(query) // $ querystring=query
21+
engine1.Where(query) // $ querystring=query
22+
engine1.Alias(query) // $ querystring=query
23+
engine1.NotIn(query) // $ querystring=query
24+
engine1.In(query) // $ querystring=query
25+
engine1.Select(query) // $ querystring=query
26+
engine1.SetExpr(query, nil) // $ querystring=query
27+
engine1.OrderBy(query) // $ querystring=query
28+
engine1.Having(query) // $ querystring=query
29+
engine1.GroupBy(query) // $ querystring=query
2830

2931
engine2 := xorm2.Engine{}
30-
engine2.Query(query) // $ querystring=query
31-
engine2.QueryString(query) // $ querystring=query
32-
engine2.QueryInterface(query) // $ querystring=query
33-
engine2.SQL(query) // $ querystring=query
34-
engine2.Where(query) // $ querystring=query
35-
engine2.Alias(query) // $ querystring=query
36-
engine2.NotIn(query) // $ querystring=query
37-
engine2.In(query) // $ querystring=query
38-
engine2.Select(query) // $ querystring=query
39-
engine2.SetExpr(query, nil) // $ querystring=query
40-
engine2.OrderBy(query) // $ querystring=query
41-
engine2.Having(query) // $ querystring=query
42-
engine2.GroupBy(query) // $ querystring=query
32+
engine2.Query(query, arg) // $ querystring=query
33+
engine2.Exec(query, arg) // $ querystring=query
34+
engine2.QueryString(query, arg) // $ querystring=query
35+
engine2.QueryInterface(query, arg) // $ querystring=query
36+
engine2.SQL(query) // $ querystring=query
37+
engine2.Where(query) // $ querystring=query
38+
engine2.Alias(query) // $ querystring=query
39+
engine2.NotIn(query) // $ querystring=query
40+
engine2.In(query) // $ querystring=query
41+
engine2.Select(query) // $ querystring=query
42+
engine2.SetExpr(query, nil) // $ querystring=query
43+
engine2.OrderBy(query) // $ querystring=query
44+
engine2.Having(query) // $ querystring=query
45+
engine2.GroupBy(query) // $ querystring=query
4346

4447
session1 := xorm1.Session{}
45-
session1.Query(query) // $ querystring=query
46-
session1.QueryString(query) // $ querystring=query
47-
session1.QueryInterface(query) // $ querystring=query
48-
session1.SQL(query) // $ querystring=query
49-
session1.Where(query) // $ querystring=query
50-
session1.Alias(query) // $ querystring=query
51-
session1.NotIn(query) // $ querystring=query
52-
session1.In(query) // $ querystring=query
53-
session1.Select(query) // $ querystring=query
54-
session1.SetExpr(query, nil) // $ querystring=query
55-
session1.OrderBy(query) // $ querystring=query
56-
session1.Having(query) // $ querystring=query
57-
session1.GroupBy(query) // $ querystring=query
58-
session1.And(query) // $ querystring=query
59-
session1.Or(query) // $ querystring=query
48+
session1.Query(query, arg) // $ querystring=query
49+
session1.Exec(query, arg) // $ querystring=query
50+
session1.QueryString(query, arg) // $ querystring=query
51+
session1.QueryInterface(query, arg) // $ querystring=query
52+
session1.SQL(query) // $ querystring=query
53+
session1.Where(query) // $ querystring=query
54+
session1.Alias(query) // $ querystring=query
55+
session1.NotIn(query) // $ querystring=query
56+
session1.In(query) // $ querystring=query
57+
session1.Select(query) // $ querystring=query
58+
session1.SetExpr(query, nil) // $ querystring=query
59+
session1.OrderBy(query) // $ querystring=query
60+
session1.Having(query) // $ querystring=query
61+
session1.GroupBy(query) // $ querystring=query
62+
session1.And(query) // $ querystring=query
63+
session1.Or(query) // $ querystring=query
6064

6165
session2 := xorm2.Session{}
62-
session2.Query(query) // $ querystring=query
63-
session2.QueryString(query) // $ querystring=query
64-
session2.QueryInterface(query) // $ querystring=query
65-
session2.SQL(query) // $ querystring=query
66-
session2.Where(query) // $ querystring=query
67-
session2.Alias(query) // $ querystring=query
68-
session2.NotIn(query) // $ querystring=query
69-
session2.In(query) // $ querystring=query
70-
session2.Select(query) // $ querystring=query
71-
session2.SetExpr(query, nil) // $ querystring=query
72-
session2.OrderBy(query) // $ querystring=query
73-
session2.Having(query) // $ querystring=query
74-
session2.GroupBy(query) // $ querystring=query
75-
session2.And(query) // $ querystring=query
76-
session2.Or(query) // $ querystring=query
66+
session2.Query(query, arg) // $ querystring=query
67+
session2.Exec(query, arg) // $ querystring=query
68+
session2.QueryString(query, arg) // $ querystring=query
69+
session2.QueryInterface(query, arg) // $ querystring=query
70+
session2.SQL(query) // $ querystring=query
71+
session2.Where(query) // $ querystring=query
72+
session2.Alias(query) // $ querystring=query
73+
session2.NotIn(query) // $ querystring=query
74+
session2.In(query) // $ querystring=query
75+
session2.Select(query) // $ querystring=query
76+
session2.SetExpr(query, nil) // $ querystring=query
77+
session2.OrderBy(query) // $ querystring=query
78+
session2.Having(query) // $ querystring=query
79+
session2.GroupBy(query) // $ querystring=query
80+
session2.And(query) // $ querystring=query
81+
session2.Or(query) // $ querystring=query
7782
}

0 commit comments

Comments
 (0)