khfaraaz82@gmail.com | c526fe9 | 2012-08-10 22:09:13 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Testcase Name : startwith02.aql |
| 3 | * Description : Positive tests |
| 4 | * Success : Yes |
| 5 | * Date : 19th April 2012 |
| 6 | */ |
| 7 | |
| 8 | // Create internal dataset, insert string data into string field and pass the string field as first input to start-with function |
| 9 | |
| 10 | drop dataverse test if exists; |
| 11 | create dataverse test; |
| 12 | use dataverse test; |
| 13 | |
| 14 | create type TestType as { |
| 15 | name:string |
| 16 | } |
| 17 | |
| 18 | create dataset testds(TestType) partitioned by key name; |
| 19 | |
| 20 | insert into dataset testds({"name":"John Smith"}); |
| 21 | insert into dataset testds({"name":"John Doe"}); |
| 22 | insert into dataset testds({"name":"John Wayne"}); |
| 23 | insert into dataset testds({"name":"Johnson Ben"}); |
| 24 | insert into dataset testds({"name":"Johnny Walker"}); |
| 25 | insert into dataset testds({"name":"David Smith"}); |
| 26 | insert into dataset testds({"name":"Not a Name"}); |
| 27 | |
| 28 | write output to nc1:"rttest/string_startwith03.adm; |
| 29 | |
| 30 | // Return all names that start with John |
| 31 | |
| 32 | for $l in dataset('testds') |
| 33 | order by $l.name |
| 34 | where start-with($l.name,"John") |
| 35 | return $l |