2003-01-18 22:14:51 +03:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-02-09 00:51:06 +03:00
|
|
|
* The Initial Developer of the Original Code is Jan Varga
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2003
|
2003-01-18 22:14:51 +03:00
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2003-09-27 18:42:26 +04:00
|
|
|
* Neil Deakin <enndeakin@sympatico.ca>
|
2003-01-18 22:14:51 +03:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface nsIVariant;
|
|
|
|
|
|
|
|
/**
|
2003-09-27 18:42:26 +04:00
|
|
|
* This interface is used to get the results from an SQL query.
|
|
|
|
* The enumerator uses a row pointer which can be adjusted with
|
|
|
|
* the next and previous methods. Other methods operate only on
|
|
|
|
* the row selected by the pointer.
|
|
|
|
*
|
|
|
|
* The row pointer starts just before the first row, so you should
|
|
|
|
* always call the next method once before attempting to read row
|
|
|
|
* data.
|
|
|
|
*
|
2003-01-18 22:14:51 +03:00
|
|
|
* @status UNDER_DEVELOPMENT
|
|
|
|
*/
|
|
|
|
|
|
|
|
[scriptable, uuid(dcc0d29e-2b44-460e-b39f-89121ff8b963)]
|
|
|
|
interface mozISqlResultEnumerator : nsISupports
|
|
|
|
{
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* The most recent error message.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
readonly attribute AString errorMessage;
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Moves the row pointer to the next row in the results.
|
|
|
|
* Returns true if there is a next row and false if there are
|
|
|
|
* no more rows.
|
|
|
|
*
|
|
|
|
* @return false if there are no more rows
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
boolean next();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Moves the row pointer to the previous row in the results.
|
|
|
|
* Returns true if there is a previous row.
|
|
|
|
*
|
|
|
|
* @return false if there are no previous rows
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
boolean previous();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Moves the row pointer to just before the first row.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void beforeFirst();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Moves the row pointer to the first row.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void first();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Moves the row pointer to the last row.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void last();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Moves the row pointer by a number relative to the current row.
|
|
|
|
* An error occurs if this causes the row pointer to extend past
|
|
|
|
* the last row. This method may also be used to move the row pointer
|
|
|
|
* back by using a negative value.
|
|
|
|
*
|
|
|
|
* @param aRowIndex aRowIndex the number of rows to move by
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void relative(in long aRows);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Moves the row pointer to a specific row. An error occurs if the index
|
|
|
|
* is after the last row.
|
|
|
|
*
|
|
|
|
* @param aRowIndex the index of the row to move to
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void absolute(in long aRowIndex);
|
|
|
|
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns true if the value at the specified column in the current row
|
|
|
|
* is null.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to retrieve
|
|
|
|
* @return true if the value is null
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
boolean isNull(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns the value at the specified column in the current row as a variant.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to retrieve
|
|
|
|
* @return the value as a variant
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
nsIVariant getVariant(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns the value at the specified column in the current row as a string.
|
|
|
|
* An error occurs if the value is not a string type.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to retrieve
|
|
|
|
* @return the string value
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
AString getString(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns the value at the specified column in the current row as an
|
|
|
|
* integer. An error occurs if the value is not a integer type.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to retrieve
|
|
|
|
* @return the integer value
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
long getInt(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns the value at the specified column in the current row as a
|
|
|
|
* float. An error occurs if the value is not a float type.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to retrieve
|
|
|
|
* @return the float value
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
float getFloat(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns the value at the specified column in the current row as a
|
|
|
|
* decimal. An error occurs if the value is not a decimal type.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to retrieve
|
|
|
|
* @return the decimal value
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
float getDecimal(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns the value at the specified column in the current row as a date.
|
|
|
|
* An error occurs if the value is not a date type.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to retrieve
|
|
|
|
* @return the date value
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
long long getDate(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns the value at the specified column in the current row as a
|
|
|
|
* boolean. An error occurs if the value is not a boolean type.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to retrieve
|
|
|
|
* @return the boolean value
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
boolean getBool(in long aColumnIndex);
|
|
|
|
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to null.
|
|
|
|
* Changes are not committed until either the insertRow or updateRow method
|
|
|
|
* is called.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setNull(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to the
|
|
|
|
* default value for that column. Changes are not committed until either the
|
|
|
|
* insertRow or updateRow method is called.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setDefault(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to its original
|
|
|
|
* value. The row may be changed with the various setX methods and then
|
|
|
|
* commited with updateRow.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void copy(in long aColumnIndex);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to a variant.
|
|
|
|
* Changes are not committed until either the insertRow or updateRow method
|
|
|
|
* is called.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
* @param aValue the value to assign
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setVariant(in long aColumnIndex, in nsIVariant aValue);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to a string.
|
|
|
|
* Changes are not committed until either the insertRow or updateRow method
|
|
|
|
* is called.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
* @param aValue the value to assign
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setString(in long aColumnIndex, in AString aValue);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to an integer.
|
|
|
|
* Changes are not committed until either the insertRow or updateRow method
|
|
|
|
* is called.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
* @param aValue the value to assign
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setInt(in long aColumnIndex, in long aValue);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to a float.
|
|
|
|
* Changes are not committed until either the insertRow or updateRow method
|
|
|
|
* is called.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
* @param aValue the value to assign
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setFloat(in long aColumnIndex, in float aValue);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to a decimal.
|
|
|
|
* Changes are not committed until either the insertRow or updateRow method
|
|
|
|
* is called.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
* @param aValue the value to assign
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setDecimal(in long aColumnIndex, in float aValue);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to a date.
|
|
|
|
* Changes are not committed until either the insertRow or updateRow method
|
|
|
|
* is called.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
* @param aValue the value to assign
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setDate(in long aColumnIndex, in long long aValue);
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value at the specified column in the current row to a boolean.
|
|
|
|
* Changes are not committed until either the insertRow or updateRow method
|
|
|
|
* is called.
|
|
|
|
*
|
|
|
|
* @param aColumnIndex the column to modify
|
|
|
|
* @param aValue the value to assign
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setBool(in long aColumnIndex, in boolean aValue);
|
|
|
|
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value of the cells in all columns in the current row to null.
|
|
|
|
* This is equivalent to calling setNullValue for every column.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setNullValues();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the value of the cells in all columns in the current row to the
|
|
|
|
* default values for the columns. This is equivalent to calling
|
|
|
|
* setDefaultValue for every column.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void setDefaultValues();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Sets the values of all of the cells in the current row to their original
|
|
|
|
* values. The row may be changed with the various set methods and then
|
|
|
|
* commited with updateRow. This method is equivalent to calling the copy
|
|
|
|
* method for each column.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
void copyValues();
|
|
|
|
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns true if inserts are allowed.
|
|
|
|
*
|
|
|
|
* @return true if inserts are allowed
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
boolean canInsert();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns true if updates are allowed.
|
|
|
|
*
|
|
|
|
* @return true if updates are allowed
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
boolean canUpdate();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Returns true if deletes are allowed.
|
|
|
|
*
|
|
|
|
* @return true if deletes are allowed
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
boolean canDelete();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Inserts a row using the data assigned using the various setX methods.
|
|
|
|
* The row was inserted successfully if 0 or 1 is returned, however if 0
|
|
|
|
* is returned, the row does not satisfy the where condition of the result
|
|
|
|
* (that is, it doesn't belong in the result enumerator) and does not need
|
|
|
|
* to be displayed.
|
|
|
|
*
|
|
|
|
* @return 1 if the row was inserted, 0 if the row was
|
|
|
|
* inserted but does not fit the condition, or -1
|
|
|
|
* if an error occured.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
long insertRow();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Updates the current row using the data assigned using the various setX
|
|
|
|
* methods. The row was inserted successfully if 0 or 1 is returned, however
|
|
|
|
* if 0 is returned, the row does not satisfy the where condition of the
|
|
|
|
* result and does not need to be displayed.
|
|
|
|
*
|
|
|
|
* @return 1 if the row was updated, 0 if the row was updated
|
|
|
|
* but does not fit the condition, or -1 if an error
|
|
|
|
* occured.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
long updateRow();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Deletes the current row.
|
|
|
|
*
|
|
|
|
* @return 1 if the row was deleted or -1 if an error occured.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
long deleteRow();
|
|
|
|
|
2003-09-27 18:42:26 +04:00
|
|
|
/**
|
|
|
|
* Holds the SQL condition clause.
|
|
|
|
*/
|
2003-01-18 22:14:51 +03:00
|
|
|
readonly attribute AString currentCondition;
|
|
|
|
|
|
|
|
};
|