31 #include <nsStringGlue.h>
38 mLimitIsParameter(PR_FALSE),
40 mOffsetIsParameter(PR_FALSE)
51 sbSQLBuilderBase::GetLimit(PRInt32 *aLimit)
57 sbSQLBuilderBase::SetLimit(PRInt32 aLimit)
64 sbSQLBuilderBase::GetLimitIsParameter(PRBool *aLimitIsParameter)
70 sbSQLBuilderBase::SetLimitIsParameter(PRBool aLimitIsParameter)
77 sbSQLBuilderBase::GetOffset(PRInt32 *aOffset)
83 sbSQLBuilderBase::SetOffset(PRInt32 aOffset)
90 sbSQLBuilderBase::GetOffsetIsParameter(PRBool *aOffsetIsParameter)
96 sbSQLBuilderBase::SetOffsetIsParameter(PRBool aOffsetIsParameter)
103 sbSQLBuilderBase::AddJoin(PRUint32 aJoinType,
104 const nsAString& aJoinedTableName,
105 const nsAString& aJoinedTableAlias,
106 const nsAString& aJoinedColumnName,
107 const nsAString& aJoinToTableName,
108 const nsAString& aJoinToColumnName)
110 sbJoinInfo* ji =
mJoins.AppendElement();
111 NS_ENSURE_TRUE(ji, NS_ERROR_OUT_OF_MEMORY);
113 ji->type = aJoinType;
114 ji->joinedTableName = aJoinedTableName;
115 ji->joinedTableAlias = aJoinedTableAlias;
116 ji->joinedColumnName = aJoinedColumnName;
117 ji->joinToTableName = aJoinToTableName;
118 ji->joinToColumnName = aJoinToColumnName;
119 ji->criterion = nsnull;
120 ji->subquery = nsnull;
121 ji->requiresJoinFromIndexUsageFix = PR_FALSE;
122 ji->requiresJoinToIndexUsageFix = PR_FALSE;
128 sbSQLBuilderBase::AddJoinWithIndexHint(PRUint32 aJoinType,
129 const nsAString& aJoinedTableName,
130 const nsAString& aJoinedTableAlias,
131 const nsAString& aJoinedColumnName,
132 const nsAString& aJoinToTableName,
133 const nsAString& aJoinToColumnName,
134 PRBool aRequiresFromTableIndexHint,
135 PRBool aRequiresToTableIndexHint)
137 sbJoinInfo* ji =
mJoins.AppendElement();
138 NS_ENSURE_TRUE(ji, NS_ERROR_OUT_OF_MEMORY);
140 ji->type = aJoinType;
141 ji->joinedTableName = aJoinedTableName;
142 ji->joinedTableAlias = aJoinedTableAlias;
143 ji->joinedColumnName = aJoinedColumnName;
144 ji->joinToTableName = aJoinToTableName;
145 ji->joinToColumnName = aJoinToColumnName;
146 ji->criterion = nsnull;
147 ji->subquery = nsnull;
148 ji->requiresJoinFromIndexUsageFix = aRequiresFromTableIndexHint;
149 ji->requiresJoinToIndexUsageFix = aRequiresToTableIndexHint;
155 sbSQLBuilderBase::AddSubqueryJoin(PRUint32 aJoinType,
157 const nsAString& aJoinedTableAlias,
158 const nsAString& aJoinedColumnName,
159 const nsAString& aJoinToTableName,
160 const nsAString& aJoinToColumnName)
162 NS_ENSURE_ARG_POINTER(aJoinedSubquery);
164 sbJoinInfo* ji =
mJoins.AppendElement();
165 NS_ENSURE_TRUE(ji, NS_ERROR_OUT_OF_MEMORY);
167 ji->type = aJoinType;
168 ji->joinedTableName = EmptyString();
169 ji->joinedTableAlias = aJoinedTableAlias;
170 ji->joinedColumnName = aJoinedColumnName;
171 ji->joinToTableName = aJoinToTableName;
172 ji->joinToColumnName = aJoinToColumnName;
173 ji->criterion = nsnull;
174 ji->subquery = aJoinedSubquery;
175 ji->requiresJoinFromIndexUsageFix = PR_FALSE;
176 ji->requiresJoinToIndexUsageFix = PR_FALSE;
182 sbSQLBuilderBase::AddJoinWithCriterion(PRUint32 aJoinType,
183 const nsAString& aJoinedTableName,
184 const nsAString& aJoinedTableAlias,
187 sbJoinInfo* ji =
mJoins.AppendElement();
188 NS_ENSURE_TRUE(ji, NS_ERROR_OUT_OF_MEMORY);
190 ji->type = aJoinType;
191 ji->joinedTableName = aJoinedTableName;
192 ji->joinedTableAlias = aJoinedTableAlias;
193 ji->joinedColumnName = EmptyString();
194 ji->joinToTableName = EmptyString();
195 ji->joinToColumnName = EmptyString();
196 ji->criterion = aCriterion;
197 ji->subquery = nsnull;
198 ji->requiresJoinFromIndexUsageFix = PR_FALSE;
199 ji->requiresJoinToIndexUsageFix = PR_FALSE;
206 const nsAString& aAlias)
208 NS_ENSURE_ARG_POINTER(aSubquery);
214 NS_ENSURE_TRUE(sb !=
this, NS_ERROR_INVALID_ARG);
217 NS_ENSURE_TRUE(sq, NS_ERROR_OUT_OF_MEMORY);
219 sq->subquery = aSubquery;
226 sbSQLBuilderBase::Reset()
241 return NS_ERROR_NOT_IMPLEMENTED;
nsTArray< sbSubqueryInfo > mSubqueries
virtual ~sbSQLBuilderBase()
NS_IMPL_ISUPPORTS1(sbDeviceCapabilitiesUtils, sbIDeviceCapabilitiesUtils) sbDeviceCapabilitiesUtils
static nsresult ToString(const nsDiscriminatedUnion &data, nsACString &outString)
Interface for building SELECT statements.
Base interface for SQL building components.
Interface for SQL critera. This interface has no public methods as it is used only as a return type f...
nsTArray< sbJoinInfo > mJoins
PRBool mOffsetIsParameter