27 #ifndef __SBLOCALDATABASEQUERY_H__
28 #define __SBLOCALDATABASEQUERY_H__
30 #include <nsClassHashtable.h>
32 #include <nsStringGlue.h>
41 typedef nsTArray<PRUint32> sbUint32Array;
46 const nsAString& aBaseConstraintColumn,
47 PRUint32 aBaseConstraintValue,
48 const nsAString& aBaseForeignKeyColumn,
49 nsTArray<sbLocalDatabaseGUIDArray::FilterSpec>* aFilters,
50 nsTArray<sbLocalDatabaseGUIDArray::SortSpec>* aSorts,
52 PRBool aDistinctWithSortableValues,
65 struct sbAddJoinInfo {
70 NS_ASSERTION(aBuilder,
"aBuilder is null");
74 nsCOMPtr<sbISQLSelectBuilder> builder;
75 nsCOMPtr<sbISQLBuilderCriterion> criterion;
79 nsresult AddCountColumns();
80 nsresult AddGuidColumns(PRBool aIsNull);
81 nsresult AddBaseTable();
82 nsresult AddFilters();
84 nsresult AddPrimarySort();
85 nsresult AddNonNullPrimarySortConstraint();
86 nsresult AddJoinToGetNulls();
87 nsresult AddDistinctConstraint();
88 nsresult AddDistinctGroupBy();
89 nsresult AddResortColumns();
90 nsresult AddMultiSorts();
92 PRInt32 GetPropertyId(
const nsAString& aProperty);
94 static void MaxExpr(
const nsAString& aAlias,
95 const nsAString& aColumn,
99 nsString mBaseConstraintColumn;
100 PRUint32 mBaseConstraintValue;
101 nsString mBaseForeignKeyColumn;
102 nsTArray<sbLocalDatabaseGUIDArray::FilterSpec>* mFilters;
103 nsTArray<sbLocalDatabaseGUIDArray::SortSpec>* mSorts;
104 PRPackedBool mIsDistinct;
105 PRPackedBool mDistinctWithSortableValues;
107 nsCOMPtr<sbISQLSelectBuilder> mBuilder;
108 PRBool mIsFullLibrary;
109 nsCOMPtr<sbILocalDatabasePropertyCache> mPropertyCache;
nsresult GetNullResortQuery(nsAString &aQuery)
nsresult GetFullGuidRangeQuery(nsAString &aQuery)
[USER CODE SHOULD NOT REFERENCE THIS CLASS]
nsresult GetResortQuery(nsAString &aQuery)
nsresult GetFullCountQuery(nsAString &aQuery)
nsresult GetNonNullCountQuery(nsAString &aQuery)
nsresult GetNullGuidRangeQuery(nsAString &aQuery)
sbLocalDatabaseQuery(const nsAString &aBaseTable, const nsAString &aBaseConstraintColumn, PRUint32 aBaseConstraintValue, const nsAString &aBaseForeignKeyColumn, nsTArray< sbLocalDatabaseGUIDArray::FilterSpec > *aFilters, nsTArray< sbLocalDatabaseGUIDArray::SortSpec > *aSorts, PRBool aIsDistinct, PRBool aDistinctWithSortableValues, sbILocalDatabasePropertyCache *aPropertyCache)
Interface for building SELECT statements.
Base interface for SQL building components.
ExtensionSchemeMatcher prototype match
An object responsible for executing SQL queries on the database.
PRBool GetIsFullLibrary()
nsresult GetPrefixSearchQuery(nsAString &aQuery)