sbSQLBuilderCriterion.h
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
27 #ifndef __SBSQLBUILDERCRITERION_H__
28 #define __SBSQLBUILDERCRITERION_H__
29 
30 #include <sbISQLBuilder.h>
31 
32 #include <nsAutoPtr.h>
33 #include <nsStringGlue.h>
34 #include <nsTArray.h>
35 #include <nsCOMArray.h>
36 #include <nsCOMPtr.h>
37 
39 {
40 public:
42 
43  sbSQLBuilderCriterionBase(const nsAString& aTableName,
44  const nsAString& aColumnName,
45  PRUint32 aMatchType,
47  sbISQLBuilderCriterion* aRight);
48 
50 protected:
51  void AppendMatchTo(nsAString& aStr);
52  void AppendTableColumnTo(nsAString& aStr);
53  void AppendLogicalTo(const nsAString& aOperator, nsAString& aStr);
54 
55  nsString mTableName;
56  nsString mColumnName;
57  PRUint32 mMatchType;
58 
59  nsCOMPtr<sbISQLBuilderCriterion> mLeft;
60  nsCOMPtr<sbISQLBuilderCriterion> mRight;
61 
62 };
63 
65 {
66 public:
67  NS_DECL_ISUPPORTS_INHERITED
68  NS_DECL_SBISQLBUILDERCRITERION
69 
70  sbSQLBuilderCriterionString(const nsAString& aTableName,
71  const nsAString& aColumnName,
72  PRUint32 aMatchType,
73  const nsAString& aValue);
74 
76 private:
77  nsString mValue;
78 };
79 
81 {
82 public:
83  NS_DECL_ISUPPORTS_INHERITED
84  NS_DECL_SBISQLBUILDERCRITERION
85 
86  sbSQLBuilderCriterionBetweenString(const nsAString& aTableName,
87  const nsAString& aColumnName,
88  const nsAString& aLeftValue,
89  const nsAString& aRightValue,
90  PRBool aNegate);
91 
93 private:
94  nsString mLeftValue;
95  nsString mRightValue;
96  PRBool mNegate;
97 };
98 
100 {
101 public:
102  NS_DECL_ISUPPORTS_INHERITED
103  NS_DECL_SBISQLBUILDERCRITERION
104 
105  sbSQLBuilderCriterionLong(const nsAString& aTableName,
106  const nsAString& aColumnName,
107  PRUint32 aMatchType,
108  PRInt32 aValue);
109 
111 private:
112  PRInt32 mValue;
113 };
114 
116 {
117 public:
118  NS_DECL_ISUPPORTS_INHERITED
119  NS_DECL_SBISQLBUILDERCRITERION
120 
121  sbSQLBuilderCriterionLongLong(const nsAString& aTableName,
122  const nsAString& aColumnName,
123  PRUint32 aMatchType,
124  PRInt64 aValue);
125 
127 private:
128  PRInt64 mValue;
129 };
130 
132 {
133 public:
134  NS_DECL_ISUPPORTS_INHERITED
135  NS_DECL_SBISQLBUILDERCRITERION
136 
137  sbSQLBuilderCriterionNull(const nsAString& aTableName,
138  const nsAString& aColumnName,
139  PRUint32 aMatchType);
141 };
142 
144 {
145 public:
146  NS_DECL_ISUPPORTS_INHERITED
147  NS_DECL_SBISQLBUILDERCRITERION
148 
149  sbSQLBuilderCriterionParameter(const nsAString& aTableName,
150  const nsAString& aColumnName,
151  PRUint32 aMatchType);
153 };
154 
156 {
157 public:
158  NS_DECL_ISUPPORTS_INHERITED
159  NS_DECL_SBISQLBUILDERCRITERION
160 
161  sbSQLBuilderCriterionTable(const nsAString& aLeftTableName,
162  const nsAString& aLeftColumnName,
163  PRUint32 aMatchType,
164  const nsAString& aRightTableName,
165  const nsAString& aRightColumnName);
167 private:
168  nsString mRightTableName;
169  nsString mRightColumnName;
170 };
171 
173 {
174 public:
175  NS_DECL_ISUPPORTS_INHERITED
176  NS_DECL_SBISQLBUILDERCRITERION
177 
179  sbISQLBuilderCriterion* aRight);
181 };
182 
184 {
185 public:
186  NS_DECL_ISUPPORTS_INHERITED
187  NS_DECL_SBISQLBUILDERCRITERION
188 
190  sbISQLBuilderCriterion* aRight);
192 };
193 
196 {
197 public:
198  NS_DECL_ISUPPORTS_INHERITED
199  NS_DECL_SBISQLBUILDERCRITERION
200  NS_DECL_SBISQLBUILDERCRITERIONIN
201 
202  sbSQLBuilderCriterionIn(const nsAString& aTableName,
203  const nsAString& aColumnName);
205 private:
206  enum ParameterType {
207  eIsNull,
208  eString,
209  eInteger32,
210  eSubquery
211  };
212 
213  struct sbInItem
214  {
215  ParameterType type;
216  nsString stringValue;
217  PRInt32 int32Value;
218  nsCOMPtr<sbISQLSelectBuilder> subquery;
219  };
220 
221  nsTArray<sbInItem> mInItems;
222 };
223 
224 #endif /* __SBSQLBUILDERCRITERION_H__ */
225 
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION sbSQLBuilderCriterionLong(const nsAString &aTableName, const nsAString &aColumnName, PRUint32 aMatchType, PRInt32 aValue)
onPageChanged aValue
Definition: FeedWriter.js:1395
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION sbSQLBuilderCriterionParameter(const nsAString &aTableName, const nsAString &aColumnName, PRUint32 aMatchType)
nsCOMPtr< sbISQLBuilderCriterion > mLeft
void AppendMatchTo(nsAString &aStr)
ParameterType
Definition: DatabaseQuery.h:75
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION sbSQLBuilderCriterionTable(const nsAString &aLeftTableName, const nsAString &aLeftColumnName, PRUint32 aMatchType, const nsAString &aRightTableName, const nsAString &aRightColumnName)
void AppendLogicalTo(const nsAString &aOperator, nsAString &aStr)
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION sbSQLBuilderCriterionOr(sbISQLBuilderCriterion *aLeft, sbISQLBuilderCriterion *aRight)
restoreDimensions aLeft
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION sbSQLBuilderCriterionLongLong(const nsAString &aTableName, const nsAString &aColumnName, PRUint32 aMatchType, PRInt64 aValue)
Interface for "in" SQL critera.
nsCOMPtr< sbISQLBuilderCriterion > mRight
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION sbSQLBuilderCriterionString(const nsAString &aTableName, const nsAString &aColumnName, PRUint32 aMatchType, const nsAString &aValue)
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION sbSQLBuilderCriterionNull(const nsAString &aTableName, const nsAString &aColumnName, PRUint32 aMatchType)
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION NS_DECL_SBISQLBUILDERCRITERIONIN sbSQLBuilderCriterionIn(const nsAString &aTableName, const nsAString &aColumnName)
Interface for SQL critera. This interface has no public methods as it is used only as a return type f...
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION sbSQLBuilderCriterionBetweenString(const nsAString &aTableName, const nsAString &aColumnName, const nsAString &aLeftValue, const nsAString &aRightValue, PRBool aNegate)
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBISQLBUILDERCRITERION sbSQLBuilderCriterionAnd(sbISQLBuilderCriterion *aLeft, sbISQLBuilderCriterion *aRight)
void AppendTableColumnTo(nsAString &aStr)
NS_DECL_ISUPPORTS sbSQLBuilderCriterionBase(const nsAString &aTableName, const nsAString &aColumnName, PRUint32 aMatchType, sbISQLBuilderCriterion *aLeft, sbISQLBuilderCriterion *aRight)