Annotation of parser3/tests/388-sql.html, revision 1.1
1.1 ! moko 1: @main[]
! 2: ^connect[sqlite://:memory:]{
! 3: 1. 2 + 2 = ^string:sql{select 2+2}
! 4:
! 5:
! 6: 2. void
! 7:
! 8: 2.1 ^void:sql{create table pets (pet varchar, food varchar, aggressive varchar, weigth varchar)}
! 9:
! 10: 2.2 ^void:sql{insert into pets values
! 11: ('cat', 'milk', '^taint['very']', 5),
! 12: ('dog', 'bone', '^taint["never"]', 10),
! 13: ('parrot', 'grain', 'alwayws', 1)
! 14: }
! 15:
! 16: 2.3 ^try-catch{ ^void:sql{select * from pets} }
! 17: 2.4 ^try-catch{ ^void:sql{query}[ $.unknown[yes] ] }
! 18: 2.5 ^try-catch{ ^void:sql{query}[ $.bind[ $.name[value] ] ] }
! 19:
! 20:
! 21: 3. int/double
! 22:
! 23: 3.1 $v(^int:sql{select 2}) $v $v.CLASS_NAME
! 24: 3.2 ^try-catch{ ^int:sql{select 2}[ $.limit(0) ] }
! 25: 3.3 ^int:sql{select 2}[ $.limit(0) $.default[1] ]
! 26:
! 27: 3.4 $v(^double:sql{select -2}) $v $v.CLASS_NAME
! 28: 3.5 ^try-catch{ ^double:sql{select -2}[ $.limit(0) ] }
! 29: 3.6 ^double:sql{select -2}[ $.limit(0) $.default[1] ]
! 30:
! 31:
! 32: 4. hash
! 33:
! 34: 4.1 ^h[select * from pets]
! 35:
! 36: 4.2 ^h[select * from pets; $.type[table]]
! 37:
! 38: 4.3 ^h[select pet, food from pets; $.type[string] ]
! 39:
! 40: 4.4 ^try-catch{ ^h[select * from pets; $.type[string] ]}
! 41:
! 42: 4.5. ^h[select * from pets; $.type[table] $.limit(1) $.offset(1) ]
! 43:
! 44:
! 45: 5. table
! 46:
! 47: 5.1 ^t[select * from pets]
! 48:
! 49: 5.2. ^t[select * from pets; $.limit(1) $.offset(1) ]
! 50:
! 51:
! 52: 6. file
! 53:
! 54: 6.1 ^f[select aggressive,'test.txt' from pets; $.limit(1) $.content-type[text/plain] ]
! 55:
! 56: 6.2 ^f[select aggressive,'test.txt','unknown' from pets; $.limit(1) $.name[unknown] $.offset(1) ]
! 57:
! 58: 6.3 ^try-catch{ ^f[select * from pets; $.limit(1) ] }
! 59:
! 60: 6.4 ^try-catch{ ^f[select aggressive from pets; $.limit(0) ] }
! 61:
! 62: 6.5 ^try-catch{ ^f[select 1 from pets] } - bug!
! 63:
! 64: 6.6 ^try-catch{ ^f[select 1,2 from pets] }
! 65:
! 66: 6.7 ^try-catch{ ^f[select aggressive from pets; $.unknown[yes] ] }
! 67:
! 68: 6.8 $f[^file::create["'test'"]] ^f.sql-string[]
! 69:
! 70:
! 71: }
! 72:
! 73: @h[query;options]
! 74: $h[^hash::sql{$query}[$options]]
! 75: ^json:string[$h; $.indent(1) ]
! 76:
! 77: @t[query;options]
! 78: $t[^table::sql{$query}[$options]]
! 79: ^json:string[$t; $.indent(1) ]
! 80:
! 81: @f[query;options]
! 82: $f[^file::sql{$query}[$options]]
! 83: ^json:string[$f; $.indent(1) $.file[text] ]
E-mail: