Mozilla Cross-Reference mozilla1.8
mozilla/ extensions/ sql/ base/ public/ mozISqlResult.idl
CVS Log
CVS Blame
CVS Graph
Diff file
Raw file
changes to
this file in
the last:
day
week
month
view using tree:

Inheritance diagram for mozISqlResult:

Inheritance graph

Collaboration diagram for mozISqlResult:

Collaboration graph

[ mozISqlResult Interface Reference | Graph Legend ]

1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is mozilla.org code.
15  *
16  * The Initial Developer of the Original Code is Jan Varga
17  * Portions created by the Initial Developer are Copyright (C) 2003
18  * the Initial Developer. All Rights Reserved.
19  *
20  * Contributor(s):
21  *   Neil Deakin <enndeakin@sympatico.ca>
22  *
23  * Alternatively, the contents of this file may be used under the terms of
24  * either the GNU General Public License Version 2 or later (the "GPL"), or
25  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26  * in which case the provisions of the GPL or the LGPL are applicable instead
27  * of those above. If you wish to allow use of your version of this file only
28  * under the terms of either the GPL or the LGPL, and not to allow others to
29  * use your version of this file under the terms of the MPL, indicate your
30  * decision by deleting the provisions above and replace them with the notice
31  * and other provisions required by the GPL or the LGPL. If you do not delete
32  * the provisions above, a recipient may use your version of this file under
33  * the terms of any one of the MPL, the GPL or the LGPL.
34  *
35  * ***** END LICENSE BLOCK ***** */
36 
37 #include "nsISupports.idl"
38 
39 interface mozISqlConnection;
40 interface mozISqlResultEnumerator;
41 interface mozISqlInputStream;
42 
43 /**
44  * The result of an SQL query. Use the enumerate method to retrieve each
45  * row.
46  *
47  * @status UNDER_DEVELOPMENT
48  */
49 
50 [scriptable, uuid(08c220b0-7140-456a-89e9-c94609a7392d)]
51 interface mozISqlResult : nsISupports
52 {
53   /**
54    * By default, this value is false.
55    */
56   attribute boolean displayNullAsText;
57 
58   /**
59    * The connection used to execute the query
60    */
61   readonly attribute mozISqlConnection connection;
62 
63   /**
64    * The SQL query
65    */
66   readonly attribute AString query;
67 
68   /**
69    * The table that was used in the query. If more than one table was used,
70    * only the first is returned. 
71    */
72   readonly attribute AString tableName;
73 
74   /**
75    * The number of rows in the result
76    */
77   readonly attribute long rowCount;
78 
79   /**
80    * The number of columns in the result
81    */
82   readonly attribute long columnCount;
83 
84   /**
85    * Retrieves the name of a column given its index. Indicies start at zero.
86    *
87    * @param aColumnIndex   the index of the column to return
88    * @return               the column name
89    */
90   AString getColumnName(in long aColumnIndex);
91 
92   /**
93    * Retrieves the index of a column given its name. If the column does not
94    * exist, -1 is returned.
95    *
96    * @param aColumnName    the column name to return
97    * @return               the column index
98    */
99   long getColumnIndex(in AString aColumnName);
100 
101   /**
102    * column type constants used by |getColumnType|.
103    */
104   const long TYPE_STRING        = 1;
105   const long TYPE_INT           = 2;
106   const long TYPE_FLOAT         = 3;
107   const long TYPE_DECIMAL       = 4;
108   const long TYPE_DATE          = 5;
109   const long TYPE_TIME          = 6;
110   const long TYPE_DATETIME      = 7;
111   const long TYPE_BOOL          = 8;
112 
113   /**
114    * Returns the type of the data in a given column.
115    *
116    * @param aColumnIndex   the index of the column to return the type of
117    * @return               the column type
118    */
119   long getColumnType(in long aColumnIndex);
120 
121   /**
122    * Returns the type of the data in a given column as a string. This is used
123    * as an alternative to using the constants and will return either
124    * string, int, float, decimal, date, time, datetime or bool.
125    *
126    * @param aColumnIndex   the index of the column to return the type of
127    * @return               the column type
128    */
129   AString getColumnTypeAsString(in long aColumnIndex);
130 
131   /**
132    * Returns the maximum number of bytes that are needed to hold a value in a
133    * particular column.
134    *
135    * @param aColumnIndex   the index of the column to return the size of
136    * @return               the column size
137    */
138   long getColumnDisplaySize(in long aColumnIndex);
139 
140   /**
141    * Returns an enumerator to enumerator over the returned rows.
142    *
143    * @return               the row enumerator
144    */
145   mozISqlResultEnumerator enumerate();
146 
147   /**
148    * Returns a stream which may be used to return the rows as XML.
149    *
150    * The XML format is:
151    * <?xml version="1.0"?>
152    * <document>
153    *   <body>
154    *     <row>
155    *       <cell>value11</cell>
156    *       <cell>value12</cell>
157    *       ...
158    *     </row>
159    *   </body>
160    * </document>
161    *
162    * @return               the input stream
163    */
164   mozISqlInputStream open();
165 
166   /**
167    * Re-executes the query.
168    */
169   void reload();
170 
171 };
172