42 q.baseTableName =
"ttms"
43 q.addColumn(
null,
"who");
44 q.addColumn(
"country",
"name");
45 q.addJoin(
Ci.sbISQLBuilder.JOIN_INNER,
"country",
null,
"id",
"ttms",
47 c = q.createMatchCriterionLong(
null,
"games",
48 Ci.sbISQLBuilder.MATCH_EQUALS,
51 sql =
"select who, country.name from ttms join country on ttms.country = country.id where games = 2000";
56 q.baseTableName =
"ttms"
57 q.addColumn(
null,
"who");
58 q.addColumn(
null,
"color");
59 q.addJoin(
Ci.sbISQLBuilder.JOIN_INNER,
"country",
null,
"id",
"ttms",
61 c = q.createMatchCriterionString(
null,
"name",
62 Ci.sbISQLBuilder.MATCH_EQUALS,
65 sql =
"select who, color from ttms join country on ttms.country = country.id where name = 'Sweden'";
69 q.baseTableName =
"ttms"
70 q.addColumn(
null,
"games");
71 q.addJoin(
Ci.sbISQLBuilder.JOIN_INNER,
"country",
null,
"id",
"ttms",
73 c = q.createMatchCriterionString(
null,
"name",
74 Ci.sbISQLBuilder.MATCH_EQUALS,
77 c = q.createMatchCriterionString(
null,
"color",
78 Ci.sbISQLBuilder.MATCH_EQUALS,
81 sql =
"select games from ttms join country on ttms.country = country.id where name = 'China' and color = 'gold'";
85 q.baseTableName =
"ttws"
86 q.addColumn(
null,
"who");
87 q.addJoin(
Ci.sbISQLBuilder.JOIN_INNER,
"games",
null,
"yr",
"ttws",
"games");
88 c = q.createMatchCriterionString(
null,
"city",
89 Ci.sbISQLBuilder.MATCH_EQUALS,
92 sql =
"select who from ttws join games on ttws.games = games.yr where city = 'Barcelona'";
99 q.baseTableName =
"leftTable"
100 q.addColumn(
null,
"bar");
101 c = q.createMatchCriterionTable(
"leftTable",
"a",
102 Ci.sbISQLBuilder.MATCH_EQUALS,
104 q.addJoinWithCriterion(
Ci.sbISQLBuilder.JOIN_INNER,
"right",
null, c);
105 sql =
"select bar from leftTable join right on leftTable.a = rightTable.b";
108 return Components.results.NS_OK;
113 return Cc[
"@songbirdnest.com/Songbird/SQLBuilder/Select;1"]
114 .createInstance(
Ci.sbISQLSelectBuilder);
function assertEqual(aExpected, aActual, aMessage)
function runTest()
Test file.