Annotation of parser3/tests/388-sql.html, revision 1.2

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

E-mail: