Spaces:
Runtime error
Runtime error
File size: 2,157 Bytes
ebd078b |
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
============
Basic select
============
import javascript
select
"hello world" as foo,
"other",
"string with escaped \\ backslashes \" quotes \n\r\t whitespace",
1234,
1234.4321,
true,
false
---
(ql
(moduleMember (importDirective (importModuleExpr (moduleExpr (simpleId)))))
(moduleMember (select (asExprs
(asExpr (literal (string)) (varName (simpleId)))
(asExpr (literal (string)))
(asExpr (literal (string)))
(asExpr (literal (integer)))
(asExpr (literal (float)))
(asExpr (literal (bool (true))))
(asExpr (literal (bool (false))))))))
============
Select with variables and order by
============
from
Foo foo,
some::submodule::Bar bar,
@dbtype bar,
boolean b,
date d,
float f,
int i,
string s
select "hello world"
order by foo, bar desc, baz asc
---
(ql (moduleMember
(select
(varDecl (typeExpr (className)) (varName (simpleId)))
(varDecl (typeExpr (moduleExpr (moduleExpr (simpleId)) (simpleId)) (className)) (varName (simpleId)))
(varDecl (typeExpr (dbtype)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(asExprs
(asExpr (literal (string))))
(orderBys
(orderBy (variable (varName (simpleId))))
(orderBy (variable (varName (simpleId))) (direction))
(orderBy (variable (varName (simpleId))) (direction))))))
========================
Annotations and comments
========================
private import foo // some other comment
/*
* Some comment
*/
pragma[noinline]
bindingset[foobar, this]
import bar
---
(ql
(moduleMember (annotation (annotName)) (importDirective (importModuleExpr (moduleExpr (simpleId)))))
(line_comment) (block_comment)
(moduleMember
(annotation (annotName) (annotArg (simpleId)))
(annotation (annotName) (annotArg (simpleId)) (annotArg (this)))
(importDirective (importModuleExpr (moduleExpr (simpleId))))))
|