42 q.baseTableName =
"bbc"
43 q.addColumn(
null,
"name");
44 q.addColumn(
null,
"region");
45 q.addColumn(
null,
"population");
46 sql =
"select name, region, population from bbc";
50 q.baseTableName =
"bbc"
51 q.addColumn(
null,
"name");
52 c = q.createMatchCriterionLong(
null,
"population",
53 Ci.sbISQLBuilder.MATCH_GREATEREQUAL,
56 sql =
"select name from bbc where population >= 200000000";
60 q.baseTableName =
"bbc"
61 q.addColumn(
null,
"name");
62 q.addColumn(
null,
"gdp / population");
63 c = q.createMatchCriterionLong(
null,
"population",
64 Ci.sbISQLBuilder.MATCH_GREATEREQUAL,
67 sql =
"select name, gdp / population from bbc where population >= 200000000";
71 q.baseTableName =
"bbc"
72 q.addColumn(
null,
"name");
73 q.addColumn(
null,
"round(population / 1000000)");
74 c = q.createMatchCriterionString(
null,
"region",
75 Ci.sbISQLBuilder.MATCH_EQUALS,
78 sql =
"select name, round(population / 1000000) from bbc where region = 'South Asia'";
82 q.baseTableName =
"bbc"
83 q.addColumn(
null,
"name");
84 q.addColumn(
null,
"population");
85 c1 = q.createMatchCriterionString(
null,
"name",
86 Ci.sbISQLBuilder.MATCH_EQUALS,
88 c2 = q.createMatchCriterionString(
null,
"name",
89 Ci.sbISQLBuilder.MATCH_EQUALS,
91 c3 = q.createMatchCriterionString(
null,
"name",
92 Ci.sbISQLBuilder.MATCH_EQUALS,
94 c = q.createOrCriterion(c1, c2);
95 c = q.createOrCriterion(c, c3);
97 sql =
"select name, population from bbc where ((name = 'France' or name = 'Germany') or name = 'Italy')"
101 q.baseTableName =
"bbc"
102 q.addColumn(
null,
"name");
103 c = q.createMatchCriterionString(
null,
"name",
104 Ci.sbISQLBuilder.MATCH_LIKE,
107 sql =
"select name from bbc where name like '%United%' ESCAPE '\\'";
112 q.baseTableName =
"bbc"
113 q.addColumn(
null,
"name");
114 c = q.createMatchCriterionLongLong(
null,
"population",
115 Ci.sbISQLBuilder.MATCH_GREATEREQUAL,
118 sql =
"select name from bbc where population >= 20000000000";
121 return Components.results.NS_OK;
126 return Cc[
"@songbirdnest.com/Songbird/SQLBuilder/Select;1"]
127 .createInstance(
Ci.sbISQLSelectBuilder);
function assertEqual(aExpected, aActual, aMessage)
function runTest()
Test file.