36 const nsAString& aColumnName,
40 mTableName(aTableName),
41 mColumnName(aColumnName),
42 mMatchType(aMatchType),
53 aStr.AppendLiteral(
" = ");
56 aStr.AppendLiteral(
" != ");
59 aStr.AppendLiteral(
" > ");
62 aStr.AppendLiteral(
" >= ");
65 aStr.AppendLiteral(
" < ");
68 aStr.AppendLiteral(
" <= ");
71 aStr.AppendLiteral(
" like ");
74 aStr.AppendLiteral(
" not like ");
77 aStr.AppendLiteral(
" match ");
80 NS_NOTREACHED(
"Unknown Match Type");
89 aStr.AppendLiteral(
".");
98 aStr.AppendLiteral(
"(");
105 aStr.AppendLiteral(
" ");
106 aStr.Append(aOperator);
107 aStr.AppendLiteral(
" ");
114 aStr.AppendLiteral(
")");
122 const nsAString& aColumnName,
124 const nsAString&
aValue) :
137 nsAutoString escapedValue(mValue);
140 _retval.AppendLiteral(
"'");
141 _retval.Append(escapedValue);
142 _retval.AppendLiteral(
"'");
145 _retval.AppendLiteral(
" ESCAPE '\\'");
155 const nsAString& aColumnName,
156 const nsAString& aLeftValue,
157 const nsAString& aRightValue,
160 mLeftValue(aLeftValue),
161 mRightValue(aRightValue),
172 _retval.AppendLiteral(
" not ");
175 _retval.AppendLiteral(
" between ");
177 nsAutoString escapedLeftValue(mLeftValue);
180 nsAutoString escapedRightValue(mRightValue);
183 _retval.AppendLiteral(
"'");
184 _retval.Append(mLeftValue);
185 _retval.AppendLiteral(
"' and '");
186 _retval.Append(mRightValue);
187 _retval.AppendLiteral(
"'");
197 const nsAString& aColumnName,
212 nsAutoString stringValue;
213 stringValue.AppendInt(mValue);
214 _retval.Append(stringValue);
223 const nsAString& aColumnName,
240 PR_snprintf(out, 32,
"%lld", mValue);
241 _retval.Append(NS_ConvertUTF8toUTF16(out));
250 const nsAString& aColumnName,
251 PRUint32 aMatchType) :
262 _retval.AppendLiteral(
" is null");
265 _retval.AppendLiteral(
" is not null");
275 const nsAString& aColumnName,
276 PRUint32 aMatchType) :
288 _retval.AppendLiteral(
"?");
297 const nsAString& aLeftColumnName,
299 const nsAString& aRightTableName,
300 const nsAString& aRightColumnName) :
302 mRightTableName(aRightTableName),
303 mRightColumnName(aRightColumnName)
314 if (!mRightTableName.IsEmpty()) {
315 _retval.Append(mRightTableName);
316 _retval.AppendLiteral(
".");
318 _retval.Append(mRightColumnName);
365 const nsAString& aColumnName) :
371 sbSQLBuilderCriterionIn::AddString(
const nsAString&
aValue)
373 sbInItem* ii = mInItems.AppendElement();
374 NS_ENSURE_TRUE(ii, NS_ERROR_OUT_OF_MEMORY);
383 sbSQLBuilderCriterionIn::AddLong(PRInt32 aValue)
385 sbInItem* ii = mInItems.AppendElement();
386 NS_ENSURE_TRUE(ii, NS_ERROR_OUT_OF_MEMORY);
388 ii->type = eInteger32;
397 sbInItem* ii = mInItems.AppendElement();
398 NS_ENSURE_TRUE(ii, NS_ERROR_OUT_OF_MEMORY);
400 ii->type = eSubquery;
401 ii->subquery = aSubquery;
407 sbSQLBuilderCriterionIn::Clear()
419 _retval.AppendLiteral(
" in (");
421 PRUint32 len = mInItems.Length();
422 for (PRUint32
i = 0;
i < len;
i++) {
423 const sbInItem& ii = mInItems[
i];
431 nsAutoString escapedValue(ii.stringValue);
434 _retval.AppendLiteral(
"'");
435 _retval.Append(escapedValue);
436 _retval.AppendLiteral(
"'");
440 _retval.AppendInt(ii.int32Value);
446 rv = ii.subquery->ToString(sql);
447 NS_ENSURE_SUCCESS(rv, rv);
454 _retval.AppendLiteral(
", ");
458 _retval.AppendLiteral(
")");
const unsigned long MATCH_NOTLIKE
NS_IMPL_ISUPPORTS_INHERITED1(sbSQLBuilderCriterionIn, sbSQLBuilderCriterionBase, sbISQLBuilderCriterionIn) sbSQLBuilderCriterionIn
nsCOMPtr< sbISQLBuilderCriterion > mLeft
void AppendMatchTo(nsAString &aStr)
NS_IMPL_ISUPPORTS_INHERITED0(sbSQLBuilderCriterionString, sbSQLBuilderCriterionBase) sbSQLBuilderCriterionString
void AppendLogicalTo(const nsAString &aOperator, nsAString &aStr)
const unsigned long MATCH_LESSEQUAL
static nsresult ToString(const nsDiscriminatedUnion &data, nsACString &outString)
nsresult SB_EscapeSQL(nsAString &str)
Interface for "in" SQL critera.
Interface for building SELECT statements.
nsCOMPtr< sbISQLBuilderCriterion > mRight
const unsigned long MATCH_LESS
const unsigned long MATCH_MATCH
const unsigned long MATCH_LIKE
const unsigned long MATCH_GREATEREQUAL
NS_IMPL_THREADSAFE_ISUPPORTS1(sbSQLBuilderCriterionBase, sbISQLBuilderCriterion) sbSQLBuilderCriterionBase
Interface for SQL critera. This interface has no public methods as it is used only as a return type f...
const unsigned long MATCH_NOTEQUALS
const unsigned long MATCH_GREATER
_getSelectedPageStyle s i
void AppendTableColumnTo(nsAString &aStr)
const unsigned long MATCH_EQUALS