37 MOZ_COUNT_CTOR(sbSQLWhereBuilder);
48 NS_ENSURE_ARG_POINTER(aCriterion);
58 NS_ENSURE_ARG_POINTER(aCriterion);
60 PRBool success =
mCritera.RemoveObject(aCriterion);
62 return NS_ERROR_NOT_AVAILABLE;
69 sbSQLWhereBuilder::CreateMatchCriterionString(
const nsAString& aTableName,
70 const nsAString& aSrcColumnName,
75 NS_ENSURE_ARG_POINTER(_retval);
77 nsCOMPtr<sbISQLBuilderCriterion> criterion =
79 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
81 NS_ADDREF(*_retval = criterion);
86 sbSQLWhereBuilder::CreateMatchCriterionBetweenString(
const nsAString& aTableName,
87 const nsAString& aSrcColumnName,
88 const nsAString& aLeftValue,
89 const nsAString& aRightValue,
92 NS_ENSURE_ARG_POINTER(_retval);
94 nsCOMPtr<sbISQLBuilderCriterion> criterion =
96 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
98 NS_ADDREF(*_retval = criterion);
103 sbSQLWhereBuilder::CreateMatchCriterionNotBetweenString(
const nsAString& aTableName,
104 const nsAString& aSrcColumnName,
105 const nsAString& aLeftValue,
106 const nsAString& aRightValue,
109 NS_ENSURE_ARG_POINTER(_retval);
111 nsCOMPtr<sbISQLBuilderCriterion> criterion =
113 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
115 NS_ADDREF(*_retval = criterion);
120 sbSQLWhereBuilder::CreateMatchCriterionLong(
const nsAString& aTableName,
121 const nsAString& aSrcColumnName,
126 NS_ENSURE_ARG_POINTER(_retval);
128 nsCOMPtr<sbISQLBuilderCriterion> criterion =
130 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
132 NS_ADDREF(*_retval = criterion);
137 sbSQLWhereBuilder::CreateMatchCriterionLongLong(
const nsAString& aTableName,
138 const nsAString& aSrcColumnName,
143 NS_ENSURE_ARG_POINTER(_retval);
145 nsCOMPtr<sbISQLBuilderCriterion> criterion =
147 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
149 NS_ADDREF(*_retval = criterion);
154 sbSQLWhereBuilder::CreateMatchCriterionNull(
const nsAString& aTableName,
155 const nsAString& aSrcColumnName,
159 NS_ENSURE_ARG_POINTER(_retval);
161 nsCOMPtr<sbISQLBuilderCriterion> criterion =
163 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
165 NS_ADDREF(*_retval = criterion);
170 sbSQLWhereBuilder::CreateMatchCriterionParameter(
const nsAString& aTableName,
171 const nsAString& aSrcColumnName,
175 NS_ENSURE_ARG_POINTER(_retval);
177 nsCOMPtr<sbISQLBuilderCriterion> criterion =
179 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
181 NS_ADDREF(*_retval = criterion);
186 sbSQLWhereBuilder::CreateMatchCriterionTable(
const nsAString& aLeftTableName,
187 const nsAString& aLeftColumnName,
189 const nsAString& aRightTableName,
190 const nsAString& aRightColumnName,
193 NS_ENSURE_ARG_POINTER(_retval);
195 nsCOMPtr<sbISQLBuilderCriterion> criterion =
197 aRightTableName, aRightColumnName);
198 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
200 NS_ADDREF(*_retval = criterion);
205 sbSQLWhereBuilder::CreateMatchCriterionIn(
const nsAString& aTableName,
206 const nsAString& aSrcColumnName,
209 NS_ENSURE_ARG_POINTER(_retval);
211 nsCOMPtr<sbISQLBuilderCriterionIn> criterion =
213 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
215 NS_ADDREF(*_retval = criterion);
225 NS_ENSURE_ARG_POINTER(aLeft);
226 NS_ENSURE_ARG_POINTER(aRight);
227 NS_ENSURE_ARG_POINTER(_retval);
229 nsCOMPtr<sbISQLBuilderCriterion> criterion =
231 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
233 NS_ADDREF(*_retval = criterion);
242 NS_ENSURE_ARG_POINTER(aLeft);
243 NS_ENSURE_ARG_POINTER(aRight);
244 NS_ENSURE_ARG_POINTER(_retval);
246 nsCOMPtr<sbISQLBuilderCriterion> criterion =
248 NS_ENSURE_TRUE(criterion, NS_ERROR_OUT_OF_MEMORY);
250 NS_ADDREF(*_retval = criterion);
257 sbSQLBuilderBase::Reset();
270 aBuffer.AppendLiteral(
" where ");
271 for (PRUint32
i = 0;
i < len;
i++) {
272 nsCOMPtr<sbISQLBuilderCriterion> criterion =
274 NS_ENSURE_SUCCESS(rv, rv);
276 rv = criterion->ToString(str);
277 NS_ENSURE_SUCCESS(rv, rv);
280 aBuffer.AppendLiteral(
" and ");
NS_IMPL_ISUPPORTS_INHERITED1(sbSQLWhereBuilder, sbSQLBuilderBase, sbISQLWhereBuilder) sbSQLWhereBuilder
Interface for building WHERE expressions.
nsresult AppendWhere(nsAString &aBuffer)
Interface for "in" SQL critera.
nsCOMArray< sbISQLBuilderCriterion > mCritera
Interface for SQL critera. This interface has no public methods as it is used only as a return type f...
virtual ~sbSQLWhereBuilder()
_getSelectedPageStyle s i