@USE
388-sql.html
@main[]
^connect[$SQL.drivers.connect]{
^prepare-data[]
^basic-tests[]
^multi-tests[]
$SPARSE(1)
^basic-tests-sparse[]
$DISTINCT(1)
^prepare-data[]
^multi-tests[]
}
@basic-tests[]
basic tests
2.1 ^a[select * from pets]
2.2 ^a[select * from pets; $.type[table]]
2.3 ^a[select pet from pets]
2.4 ^a[select pet from pets; $.type[string] ]
2.5 ^try-catch{ ^a[select * from pets; $.type[string] ]}
2.6 ^try-catch{ ^a[select * from pets; $.distinct(true) ]}
2.7 ^a[select * from pets; $.type[table] $.limit(1) $.offset(1) ]
2.8 ^a[select aggressive from pets; $.type[table] ]
2.9 ^try-catch{ ^a[select 2+2; $.bug(1) ] }
@basic-tests-sparse[]
basic tests sparse
3.1 ^a[select weigth as id, pet from pets; $.type[table] $.distinct(true) ]
3.1.1 ^try-catch{ ^a[select weigth as id, pet from pets; $.type[table] ] }
3.2 ^a[select weigth as id, pet from pets; $.type[string] $.distinct(true) ]
3.2.1 ^try-catch{ ^a[select weigth as id, pet from pets; $.type[string] ] }
^void:sql{delete from pets where pet='hamster'}
3.3 ^a[select weigth, pets.* from pets]
3.4 ^a[select weigth, pets.* from pets; $.type[table]]
3.5 ^a[select weigth, food from pets; $.type[string] ]
3.6 ^try-catch{ ^a[select weigth, pets.* from pets; $.type[string] ]}
3.7. ^a[select weigth, pets.* from pets; $.type[table] $.limit(1) $.offset(1) ]
3.8 ^try-catch{ ^a[select '1', pet from pets; $.type[string] ]}
3.9 ^a[select weigth, pet from pets]
3.10 ^a[select weigth from pets]
3.11 ^try-catch{ ^a[select -1 from pets] }
@multi-tests[]
multi statements tests
1.1 ^a[delete from pets where pet='']
1.2 ^a[select 0,pets.* from pets^;select 1,pets.* from pets; $.type[table] ]
1.3 ^a[select 0,pets.* from pets^;select 0,pets.* from pets; $.type[table] ]
1.4 ^a[select 0,pets.* from pets^;select 0, 2+2; $.type[table] ]
1.5 ^a[select 0,pets.* from pets limit 2^;delete from pets where pet=''^;select 1,pets.* from pets limit 1; $.type[table] ]
1.6 ^a[select 0,pets.* from pets^;delete from pets where pet=''^;select 1,pets.* from pets; $.type[table] $.limit(1) ] - minor bug: limit for last query only
1.7 ^a[select weigth,food from pets^;select weigth+10,pets.* from pets; $.type[table] ]
1.8 ^a[select weigth,food from pets^;select weigth+10,pets.* from pets; ]
1.9 ^a[select 0,pets.* from pets^;select 0, 2+2; $.type[hash] ]
1.10 ^a[select 0, 2+2^;select 0,pets.* from pets; $.type[hash] ]
1.11 ^a[select 0,food from pets^;select 1,pets.* from pets; $.type[table] ]
1.12 ^a[select 0,food from pets^;select 0,pets.* from pets; $.type[table] ]
@a[query;options]
$h[^array::sql{$query}[$options ^if($SPARSE){ $.sparse(true) } ^if($DISTINCT){ $.distinct(true) } ]]
^json:string[$h; $.indent(1) ^if($SPARSE){ $.array[object] } ]
E-mail: