mozIStorageValueArray

  • Revision slug: mozIStorageValueArray
  • Revision title: mozIStorageValueArray
  • Revision id: 137612
  • Created:
  • Creator: Arehman4
  • Is current revision? No
  • Comment

Revision Content

{{template.Fx_minversion_header(2)}}

Summary

mozIStorageValueArray wraps an array of SQL values, such as a single database row.

You can get the type of a value from mozIStorageValueArray.getTypeOfIndex, which returns the type of the specified column.

{{template.InterfaceStatus("mozIStorageValueArray", "storage/public/mozIStorageValueArray.idl", "unfrozen", "Mozilla 1.8", "yes")}}

Inherits from: nsISupports

Example:


{{template.Note("Be careful! SQLite is not a typed database. Any type can be put into any cell, regardless of the type declared for the column. If you request a different type, SQLite will do its best to convert them, and will do some default value if it is impossible. Therefore, it is impossible to get type errors, but you may get weird data out.")}}

Method overview

long getTypeOfIndex(in unsigned long aIndex);
long getInt32(in unsigned long aIndex);
long long getInt64(in unsigned long aIndex);
double getDouble(in unsigned long aIndex);
AUTF8String getUTF8String(in unsigned long aIndex);
AString getString(in unsigned long aIndex);
void getBlob(in unsigned long aIndex, out unsigned long aDataSize, {{mediawiki.external('array,size_is(aDataSize)')}} out octet aData);
boolean getIsNull(in unsigned long aIndex);

Attributes

Attribute Type Description
numEntries unsigned long Number of entries in the array (each corresponding to a column in the database row).

Constants

Constant Value Description
VALUE_TYPE_NULL 0 Returns NULL value for given column.
VALUE_TYPE_INTEGER 1 Returns INTEGER value for given column.
VALUE_TYPE_FLOAT 2 Returns FLOAT value for given column.
VALUE_TYPE_TEXT 3 Returns TEXT value for given column.
VALUE_TYPE_BLOB 4 Returns BLOB value for given column.

Methods

getTypeOfIndex

getTypeOfIndex is a function method that returns the type of the value at the given column index; one of (VALUE_TYPE_NULL, VALUE_TYPE_INTEGER, VALUE_TYPE_FLOAT, VALUE_TYPE_TEXT, VALUE_TYPE_BLOB).

  long getTypeOfIndex(in unsigned long aIndex);
Parameters
<tt>aIndex</tt>
The Column's index.
Return value

Returns one of the following values depending on the aIndex parameter value : (VALUE_TYPE_NULL, VALUE_TYPE_INTEGER, VALUE_TYPE_FLOAT, VALUE_TYPE_TEXT, VALUE_TYPE_BLOB).

getInt32

getInt32 is a function method that returns an Int32 value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, getTypeOfIndex should be used first to identify the column type, and then the appropriate get method should be called.

If you ask for a string value for a NULL column, you will get an empty string with IsVoid set to distinguish it from an explicitly set empty string.

  long getInt32(in unsigned long aIndex);
Parameters
<tt>aIndex</tt>
The Column's index.
Return value

Returns an Int32 value for the given entry (column) index.

getInt64

getInt64 is a function method that returns an Int64 value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, getTypeOfIndex should be used first to identify the column type, and then the appropriate get method should be called.

If you ask for a string value for a NULL column, you will get an empty string with IsVoid set to distinguish it from an explicitly set empty string.

  long long getInt64(in unsigned long aIndex);
Parameters
<tt>aIndex</tt>
The Column's index.
Return value

Returns an Int64 value for the given entry (column) index.

getDouble

getDouble is a function method that returns an Double value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, getTypeOfIndex should be used first to identify the column type, and then the appropriate get method should be called.

If you ask for a string value for a NULL column, you will get an empty string with IsVoid set to distinguish it from an explicitly set empty string.

  double getDouble(in unsigned long aIndex);
Parameters
<tt>aIndex</tt>
The Column's index.
Return value

Returns an Double value for the given entry (column) index.

getUTF8String

getUTF8String is a function method that returns an AUTF8String value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, getTypeOfIndex should be used first to identify the column type, and then the appropriate get method should be called.

If you ask for a string value for a NULL column, you will get an empty string with IsVoid set to distinguish it from an explicitly set empty string.

  AUTF8String getUTF8String(in unsigned long aIndex);
Parameters
<tt>aIndex</tt>
The Column's index.
Return value

Returns an AUTF8String value for the given entry (column) index.

getString

getString is a function method that returns an String value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, getTypeOfIndex should be used first to identify the column type, and then the appropriate get method should be called.

If you ask for a string value for a NULL column, you will get an empty string with IsVoid set to distinguish it from an explicitly set empty string.

  AString getString(in unsigned long aIndex);
Parameters
<tt>aIndex</tt>
The Column's index.
Return value

Returns a String value for the given entry (column) index.

getBlob

getBlob is a function method that sets data at the provided aIndex parameter value to be NULL if dataSize = 0.

  void getBlob(in unsigned long aIndex, out unsigned long aDataSize, [array,size_is(aDataSize)] out octet aData);
Parameters
<tt>aIndex</tt>
The Column's index.
<tt>aDataSize</tt>
The size of the provided Data.
<tt>aData</tt>
The Data to be set.

getIsNull

getIsNull is a function method checks if given column index is NULL or not.

boolean getIsNull(in unsigned long aIndex);
Parameters
<tt>aIndex</tt>
The Column's index.
Return value

Returns true or false depending on whether or not the aIndex parameter value is NULL or not.

Revision Source

<p>
{{template.Fx_minversion_header(2)}}
</p>
<h2 name="Summary"> Summary </h2>
<p><code>mozIStorageValueArray</code> wraps an array of SQL values, such as a single database row.
</p><p>You can get the type of a value from <code>mozIStorageValueArray.getTypeOfIndex</code>, which returns the type of the specified column. 
</p><p>{{template.InterfaceStatus("mozIStorageValueArray", "storage/public/mozIStorageValueArray.idl", "unfrozen", "Mozilla 1.8", "yes")}}
</p><p>Inherits from: <a href="en/NsISupports">nsISupports</a>
</p><p>Example:
</p>
<pre></pre>
<p>{{template.Note("Be careful! SQLite is not a typed database. Any type can be put into any cell, regardless of the type declared for the column. If you request a different type, SQLite will do its best to convert them, and will do some default value if it is impossible. Therefore, it is impossible to get type errors, but you may get weird data out.")}}
</p>
<h2 name="Method_overview">Method overview</h2>
<table class="standard-table">

<tbody><tr>
<td> <code>long <a href="#getTypeOfIndex.28.29">getTypeOfIndex</a>(in unsigned long aIndex);</code>
</td></tr>
<tr>
<td> <code>long <a href="#getInt32.28.29">getInt32</a>(in unsigned long aIndex);</code>
</td></tr>
<tr>
<td> <code>long long <a href="#getInt64.28.29">getInt64</a>(in unsigned long aIndex);</code>
</td></tr>
<tr>
<td> <code>double <a href="#getDouble.28.29">getDouble</a>(in unsigned long aIndex);</code>
</td></tr>
<tr>
<td> <code>AUTF8String <a href="#getUTF8String.28.29">getUTF8String</a>(in unsigned long aIndex);</code>
</td></tr>
<tr>
<td> <code>AString <a href="#getString.28.29">getString</a>(in unsigned long aIndex);</code>
</td></tr>
<tr>
<td> <code>void <a href="#getBlob.28.29">getBlob</a>(in unsigned long aIndex, out unsigned long aDataSize, {{mediawiki.external('array,size_is(aDataSize)')}} out octet aData);</code>
</td></tr>
<tr>
<td> <code>boolean <a href="#getIsNull.28.29">getIsNull</a>(in unsigned long aIndex);</code>
</td></tr>
</tbody></table>
<h2 name="Attributes">Attributes</h2>
<table class="standard-table">

<tbody><tr>
<td class="header">Attribute
</td><td class="header">Type
</td><td class="header">Description
</td></tr>

<tr>
<td><code>numEntries</code>
</td><td><code>unsigned long</code>
</td><td> Number of entries in the array (each corresponding to a column in the database row).
</td></tr>
</tbody></table>
<h2 name="Constants">Constants</h2>
<table class="standard-table">

<tbody><tr>
<td class="header">Constant
</td><td class="header">Value
</td><td class="header">Description
</td></tr>

<tr>
<td><code>VALUE_TYPE_NULL</code>
</td><td> 0
</td><td>Returns <code>NULL</code> value for given column.
</td></tr>
<tr>
<td><code>VALUE_TYPE_INTEGER</code>
</td><td> 1
</td><td>Returns <code>INTEGER</code> value for given column.
</td></tr>
<tr>
<td><code>VALUE_TYPE_FLOAT</code>
</td><td> 2
</td><td>Returns <code>FLOAT</code> value for given column.
</td></tr>
<tr>
<td><code>VALUE_TYPE_TEXT</code>
</td><td> 3
</td><td>Returns <code>TEXT</code> value for given column.
</td></tr>
<tr>
<td><code>VALUE_TYPE_BLOB</code>
</td><td> 4
</td><td>Returns <code>BLOB</code> value for given column.
</td></tr>
</tbody></table>
<h2 name="Methods">Methods</h2>
<h3 name="getTypeOfIndex"> getTypeOfIndex </h3>
<p><code>getTypeOfIndex</code> is a function method that returns the type of the value at the given column index; one of <code>(VALUE_TYPE_NULL, VALUE_TYPE_INTEGER, VALUE_TYPE_FLOAT, VALUE_TYPE_TEXT, VALUE_TYPE_BLOB)</code>.
</p>
<pre>  long getTypeOfIndex(in unsigned long aIndex);
</pre>
<h6 name="Parameters">Parameters</h6>
<dl><dt><tt>aIndex</tt>
</dt><dd>The Column's index.
</dd></dl>
<h6 name="Return_value">Return value</h6>
<p>Returns one of the following values depending on the <code>aIndex</code> parameter value : <code>(VALUE_TYPE_NULL, VALUE_TYPE_INTEGER, VALUE_TYPE_FLOAT, VALUE_TYPE_TEXT, VALUE_TYPE_BLOB)</code>.
</p>
<h3 name="getInt32"> getInt32 </h3>
<p><code>getInt32</code> is a function method that returns an <code>Int32</code> value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, <code>getTypeOfIndex</code> should be used first to identify the column type, and then the appropriate get method should be called.
</p><p>If you ask for a string value for a <code>NULL</code> column, you will get an empty string with <code>IsVoid</code> set to distinguish it from an explicitly set empty string.
</p>
<pre>  long getInt32(in unsigned long aIndex);
</pre>
<h6 name="Parameters_2">Parameters</h6>
<dl><dt><tt>aIndex</tt>
</dt><dd>The Column's index.
</dd></dl>
<h6 name="Return_value_2">Return value</h6>
<p>Returns an <code>Int32</code> value for the given entry (column) index.
</p>
<h3 name="getInt64"> getInt64 </h3>
<p><code>getInt64</code> is a function method that returns an <code>Int64</code> value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, <code>getTypeOfIndex</code> should be used first to identify the column type, and then the appropriate get method should be called.
</p><p>If you ask for a string value for a <code>NULL</code> column, you will get an empty string with <code>IsVoid</code> set to distinguish it from an explicitly set empty string.
</p>
<pre>  long long getInt64(in unsigned long aIndex);
</pre>
<h6 name="Parameters_3">Parameters</h6>
<dl><dt><tt>aIndex</tt>
</dt><dd>The Column's index.
</dd></dl>
<h6 name="Return_value_3">Return value</h6>
<p>Returns an <code>Int64</code> value for the given entry (column) index.
</p>
<h3 name="getDouble"> getDouble </h3>
<p><code>getDouble</code> is a function method that returns an <code>Double</code> value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, <code>getTypeOfIndex</code> should be used first to identify the column type, and then the appropriate get method should be called.
</p><p>If you ask for a string value for a <code>NULL</code> column, you will get an empty string with <code>IsVoid</code> set to distinguish it from an explicitly set empty string.
</p>
<pre>  double getDouble(in unsigned long aIndex);
</pre>
<h6 name="Parameters_4">Parameters</h6>
<dl><dt><tt>aIndex</tt>
</dt><dd>The Column's index.
</dd></dl>
<h6 name="Return_value_4">Return value</h6>
<p>Returns an <code>Double</code> value for the given entry (column) index.
</p>
<h3 name="getUTF8String"> getUTF8String </h3>
<p><code>getUTF8String</code> is a function method that returns an <code>AUTF8String</code> value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, <code>getTypeOfIndex</code> should be used first to identify the column type, and then the appropriate get method should be called.
</p><p>If you ask for a string value for a <code>NULL</code> column, you will get an empty string with <code>IsVoid</code> set to distinguish it from an explicitly set empty string.
</p>
<pre>  AUTF8String getUTF8String(in unsigned long aIndex);
</pre>
<h6 name="Parameters_5">Parameters</h6>
<dl><dt><tt>aIndex</tt>
</dt><dd>The Column's index.
</dd></dl>
<h6 name="Return_value_5">Return value</h6>
<p>Returns an <code><a href="en/AUTF8String">AUTF8String</a></code> value for the given entry (column) index.
</p>
<h3 name="getString"> getString </h3>
<p><code>getString</code> is a function method that returns an <code>String</code> value for the given entry (column) index. Due to SQLite's type conversion rules, any of these are valid for any column regardless of the column's data type. However, if the specific type matters, <code>getTypeOfIndex</code> should be used first to identify the column type, and then the appropriate get method should be called.
</p><p>If you ask for a string value for a <code>NULL</code> column, you will get an empty string with <code>IsVoid</code> set to distinguish it from an explicitly set empty string.
</p>
<pre>  AString getString(in unsigned long aIndex);
</pre>
<h6 name="Parameters_6">Parameters</h6>
<dl><dt><tt>aIndex</tt>
</dt><dd>The Column's index.
</dd></dl>
<h6 name="Return_value_6">Return value</h6>
<p>Returns a <code>String</code> value for the given entry (column) index.
</p>
<h3 name="getBlob"> getBlob </h3>
<p><code>getBlob</code> is a function method that sets data at the provided <code>aIndex</code> parameter value to be <code>NULL</code> if <code>dataSize = 0</code>.
</p>
<pre>  void getBlob(in unsigned long aIndex, out unsigned long aDataSize, [array,size_is(aDataSize)] out octet aData);
</pre>
<h6 name="Parameters_7">Parameters</h6>
<dl><dt><tt>aIndex</tt>
</dt><dd>The Column's index.
</dd></dl>
<dl><dt><tt>aDataSize</tt>
</dt><dd>The size of the provided Data.
</dd></dl>
<dl><dt><tt>aData</tt>
</dt><dd>The Data to be set.
</dd></dl>
<h3 name="getIsNull"> getIsNull </h3>
<p><code>getIsNull</code> is a function method checks if given column index is <code>NULL</code> or not.
</p>
<pre>boolean getIsNull(in unsigned long aIndex);
</pre>
<h6 name="Parameters_8">Parameters</h6>
<dl><dt><tt>aIndex</tt>
</dt><dd>The Column's index.
</dd></dl>
<h6 name="Return_value_7">Return value</h6>
<p>Returns <code>true</code> or <code>false</code> depending on whether or not the <code>aIndex</code> parameter value is <code>NULL</code> or not.
</p>
Revert to this revision