MCPcopy Create free account
hub / github.com/araddon/qlbridge / TestSqlParseOnly

Function TestSqlParseOnly

rel/parse_sql_test.go:85–321  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

83}
84
85func TestSqlParseOnly(t *testing.T) {
86 t.Parallel()
87
88 parseSqlTest(t, `
89 SELECT exists(firstname), x
90 -- lets use the user table
91 -- another for good meausre
92 FROM user
93 -- a comment
94 WHERE x = y;
95 `)
96
97 parseSqlTest(t, "SELECT exists(firstname), user_id FROM user")
98
99 parseSqlTest(t, `
100 SELECT exists(firstname), x
101 -- lets use the user table
102 -- another for good meausre
103 FROM user;
104 `)
105
106 parseSqlTest(t, `
107 SELECT
108 event AS my_event
109 IF event != "stuff"
110 AND NOT(hasprefix(event,"gh."))
111 AND NOT(hasprefix(event,"software."))
112 AND NOT(hasprefix(event,"devstatus."))
113 AND NOT(hasprefix(event,"devstatus."))
114 AND NOT(hasprefix(event,"devsummary."))
115 AND NOT(hasprefix(event,"dvcsconnector."))
116 FROM nothing`)
117 parseSqlTest(t, `
118 SELECT event FROM nothing
119 WHERE
120 (
121 not(exists(@@whitelist))
122 OR len(@@whitelist) == 0
123 OR host(url) IN hosts(@@whitelist)
124 )
125 AND exists(version)
126 AND eq(version, 4)
127 `)
128
129 parseSqlTest(t, `
130 SELECT a.language, a.template, Count(*) AS count
131 FROM
132 (Select Distinct language, template FROM content) AS a
133 Left Join users AS b
134 On b.language = a.language AND b.template = b.template
135 GROUP BY a.language, a.template`)
136
137 parseSqlTest(t, `SELECT
138 lol AS notlol IF AND (
139 or (
140 event IN ("rq", "ab"),
141 NOT EXISTS event
142 )

Callers

nothing calls this directly

Calls 2

parseSqlTestFunction · 0.70
parseSqlErrorFunction · 0.70

Tested by

no test coverage detected