2020-08-27 05:44:12 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# basic query
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT * FROM FOO"
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# no help for keyword flag
|
|
|
|
run_cap_test ./drive_sql_anno "TABLE"
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# nested function calls
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT foo(bar())"
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# nested function calls
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT foo(bar())" 2
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# caret in keyword whitespace
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT lower(abc)" 9
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# caret in function whitespace
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT lower( abc )" 14
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# caret in unfinished function call
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT lower(abc" 16
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# caret on the outer function
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT instr(lower(abc), '123')" 9
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# caret on a nested function
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT instr(lower(abc), '123')" 15
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# caret on a flag
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT instr(lower(abc), '123') FROM bar" 30
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# multiple help hits
|
|
|
|
run_cap_test ./drive_sql_anno "CREATE" 2
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# string vs ident
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT 'hello, world!' FROM \"my table\""
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# math
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT (1 + 2) AS three"
|
2020-08-27 05:44:12 +00:00
|
|
|
|
2022-07-11 07:09:08 +00:00
|
|
|
run_cap_test ./drive_sql_anno "SELECT (1.5 + 2.2) AS decim"
|
|
|
|
|
2022-04-30 20:05:42 +00:00
|
|
|
# subqueries
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT * FROM (SELECT foo, bar FROM baz)"
|
2022-07-01 23:02:14 +00:00
|
|
|
|
|
|
|
run_cap_test ./drive_sql_anno \
|
2022-07-06 18:58:25 +00:00
|
|
|
"SELECT * from vmw_log, regexp_capture(log_body, '--> /SessionStats/SessionPool/Session/(?<line>[abc]+)')"
|
2022-07-13 05:52:40 +00:00
|
|
|
|
|
|
|
run_cap_test ./drive_sql_anno "SELECT * FROM foo.bar"
|