Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | Friends
mozSqlResultSqlite Class Reference

#include <mozSqlResultSqlite.h>

Inheritance diagram for mozSqlResultSqlite:
Inheritance graph
[legend]
Collaboration diagram for mozSqlResultSqlite:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 mozSqlResultSqlite (mozISqlConnection *aConnection, const nsAString &aQuery)
void SetResult (char **aResult, PRInt32 nrow, PRInt32 ncolumn, PRBool aWritable)
virtual ~mozSqlResultSqlite ()
nsresult Init ()
void Init (in string aURI)
 Specify the URI for the data source: this is the prefix that will be used to register the data source in the data source registry.
nsresult Rebuild ()
NS_DECL_ISUPPORTS NS_IMETHOD GetDisplayNullAsText (PRBool *aDisplayNullAsText)
NS_IMETHOD SetDisplayNullAsText (PRBool aDisplayNullAsText)
NS_IMETHOD GetConnection (mozISqlConnection **aConnection)
NS_IMETHOD GetQuery (nsAString &aQuery)
NS_IMETHOD GetTableName (nsAString &aTableName)
NS_IMETHOD GetColumnCount (PRInt32 *aColumnCount)
NS_IMETHOD GetColumnName (PRInt32 aColumnIndex, nsAString &_retval)
NS_IMETHOD GetColumnIndex (const nsAString &aColumnName, PRInt32 *_retval)
NS_IMETHOD GetColumnType (PRInt32 aColumnIndex, PRInt32 *_retval)
NS_IMETHOD GetColumnTypeAsString (PRInt32 aColumnIndex, nsAString &_retval)
NS_IMETHOD GetColumnDisplaySize (PRInt32 aColumnIndex, PRInt32 *_retval)
NS_IMETHOD Enumerate (mozISqlResultEnumerator **_retval)
NS_IMETHOD Open (mozISqlInputStream **_retval)
NS_IMETHOD Reload (void)
NS_DECL_MOZISQLDATASOURCE
NS_DECL_NSIRDFDATASOURCE
NS_DECL_NSIRDFREMOTEDATASOURCE
NS_DECL_NSITREEVIEW NS_IMETHOD 
EnsureNative ()
AString getColumnName (in long aColumnIndex)
 Retrieves the name of a column given its index.
long getColumnIndex (in AString aColumnName)
 Retrieves the index of a column given its name.
long getColumnType (in long aColumnIndex)
 Returns the type of the data in a given column.
AString getColumnTypeAsString (in long aColumnIndex)
 Returns the type of the data in a given column as a string.
long getColumnDisplaySize (in long aColumnIndex)
 Returns the maximum number of bytes that are needed to hold a value in a particular column.
mozISqlResultEnumerator enumerate ()
 Returns an enumerator to enumerator over the returned rows.
mozISqlInputStream open ()
 Returns a stream which may be used to return the rows as XML.
void reload ()
 Re-executes the query.
nsIRDFResource getResourceAtIndex (in long aRowIndex)
 Retrieve the RDF resource associated with the specified row.
long getIndexOfResource (in nsIRDFResource aResource)
 Retrieve the index associated with specified RDF resource.
nsIRDFResource GetSource (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Find an RDF resource that points to a given node over the specified arc & truth value.
nsISimpleEnumerator GetSources (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Find all RDF resources that point to a given node over the specified arc & truth value.
nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue)
 Find a child of that is related to the source by the given arc arc and truth value.
nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue)
 Find all children of that are related to the source by the given arc arc and truth value.
void Assert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Add an assertion to the graph.
void Unassert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget)
 Remove an assertion from the graph.
void Change (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aOldTarget, in nsIRDFNode aNewTarget)
 Change an assertion from.
void Move (in nsIRDFResource aOldSource, in nsIRDFResource aNewSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget)
 'Move' an assertion from
boolean HasAssertion (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Query whether an assertion exists in this graph.
void AddObserver (in nsIRDFObserver aObserver)
 Add an observer to this data source.
void RemoveObserver (in nsIRDFObserver aObserver)
 Remove an observer from this data source.
nsISimpleEnumerator ArcLabelsIn (in nsIRDFNode aNode)
 Get a cursor to iterate over all the arcs that point into a node.
nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource)
 Get a cursor to iterate over all the arcs that originate in a resource.
nsISimpleEnumerator GetAllResources ()
 Retrieve all of the resources that the data source currently refers to.
boolean IsCommandEnabled (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments)
 Returns whether a given command is enabled for a set of sources.
void DoCommand (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments)
 Perform the specified command on set of sources.
nsISimpleEnumerator GetAllCmds (in nsIRDFResource aSource)
 Returns the set of all commands defined for a given source.
boolean hasArcIn (in nsIRDFNode aNode, in nsIRDFResource aArc)
 Returns true if the specified node is pointed to by the specified arc.
boolean hasArcOut (in nsIRDFResource aSource, in nsIRDFResource aArc)
 Returns true if the specified node has the specified outward arc.
void beginUpdateBatch ()
 Notify observers that the datasource is about to send several notifications at once.
void endUpdateBatch ()
 Notify observers that the datasource has completed issuing a notification group.
void Refresh (in boolean aBlocking)
 Refresh the remote datasource, re-loading its contents from the URI.
void Flush ()
 Request that a data source write it's contents out to permanent storage, if applicable.
void FlushTo (in string aURI)
void ensureNative ()
void getRowProperties (in long index, in nsISupportsArray properties)
 An atomized list of properties for a given row.
void getCellProperties (in long row, in nsITreeColumn col, in nsISupportsArray properties)
 An atomized list of properties for a given cell.
void getColumnProperties (in nsITreeColumn col, in nsISupportsArray properties)
 Called to get properties to paint a column background.
boolean isContainer (in long index)
 Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.
boolean isContainerOpen (in long index)
boolean isContainerEmpty (in long index)
boolean isSeparator (in long index)
 isSeparator is used to determine if the row at index is a separator.
boolean isSorted ()
 Specifies if there is currently a sort on any column.
boolean canDrop (in long index, in long orientation)
 Methods used by the drag feedback code to determine if a drag is allowable at the current location.
void drop (in long row, in long orientation)
 Called when the user drops something on this view.
long getParentIndex (in long rowIndex)
 Methods used by the tree to draw thread lines in the tree.
boolean hasNextSibling (in long rowIndex, in long afterIndex)
 hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.
long getLevel (in long index)
 The level is an integer value that represents the level of indentation.
AString getImageSrc (in long row, in nsITreeColumn col)
 The image path for a given cell.
long getProgressMode (in long row, in nsITreeColumn col)
AString getCellValue (in long row, in nsITreeColumn col)
 The value for a given cell.
AString getCellText (in long row, in nsITreeColumn col)
 The text for a given cell.
void setTree (in nsITreeBoxObject tree)
 Called during initialization to link the view to the front end box object.
void toggleOpenState (in long index)
 Called on the view when an item is opened or closed.
void cycleHeader (in nsITreeColumn col)
 Called on the view when a header is clicked.
void selectionChanged ()
 Should be called from a XUL onselect handler whenever the selection changes.
void cycleCell (in long row, in nsITreeColumn col)
 Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.
boolean isEditable (in long row, in nsITreeColumn col)
 isEditable is called to ask the view if the cell contents are editable.
void setCellValue (in long row, in nsITreeColumn col, in AString value)
 setCellValue is called when the value of the cell has been set by the user.
void setCellText (in long row, in nsITreeColumn col, in AString value)
 setCellText is called when the contents of the cell have been edited by the user.
void performAction (in wstring action)
 A command API that can be used to invoke commands on the selection.
void performActionOnRow (in wstring action, in long row)
 A command API that can be used to invoke commands on a specific row.
void performActionOnCell (in wstring action, in long row, in nsITreeColumn col)
 A command API that can be used to invoke commands on a specific cell.

Public Attributes

attribute boolean displayNullAsText
 By default, this value is false.
readonly attribute
mozISqlConnection 
connection
 The connection used to execute the query.
readonly attribute AString query
 The SQL query.
readonly attribute AString tableName
 The table that was used in the query.
readonly attribute long rowCount
 The number of rows in the result.
readonly attribute long rowCount
 The total number of rows in the tree (including the offscreen rows).
readonly attribute long columnCount
 The number of columns in the result.
const long TYPE_STRING = 1
 column type constants used by |getColumnType|.
const long TYPE_INT = 2
const long TYPE_FLOAT = 3
const long TYPE_DECIMAL = 4
const long TYPE_DATE = 5
const long TYPE_TIME = 6
const long TYPE_DATETIME = 7
const long TYPE_BOOL = 8
readonly attribute string URI
 The "URI" of the data source.
readonly attribute boolean loaded
 This value is true when the datasource has fully loaded itself.
attribute nsITreeSelection selection
 The selection for this view.
const short DROP_BEFORE = -1
const short DROP_ON = 0
const short DROP_AFTER = 1
const short PROGRESS_NORMAL = 1
 The progress mode for a given cell.
const short PROGRESS_UNDETERMINED = 2
const short PROGRESS_NONE = 3

Protected Member Functions

PRInt32 GetColType (PRInt32 aColumnIndex)
virtual nsresult BuildColumnInfo ()
virtual nsresult BuildRows ()
virtual void ClearNativeResult ()
virtual nsresult CanInsert (PRBool *_retval)
virtual nsresult CanUpdate (PRBool *_retval)
virtual nsresult CanDelete (PRBool *_retval)
void ClearColumnInfo ()
void ClearRows ()
nsresult EnsureTableName ()
virtual nsresult EnsurePrimaryKeys ()
void AppendValue (Cell *aCell, nsAutoString &aValues)
virtual nsresult AppendKeys (Row *aRow, nsAutoString &aKeys)
nsresult GetValues (Row *aRow, mozISqlResult **aResult, PRBool aUseID)
nsresult CopyValues (mozISqlResult *aResult, Row *aRow)
nsresult InsertRow (Row *aSrcRow, PRInt32 *_retval)
nsresult UpdateRow (PRInt32 aRowIndex, Row *aSrcRow, PRInt32 *_retval)
nsresult DeleteRow (PRInt32 aRowIndex, PRInt32 *_retval)
nsresult GetCondition (Row *aRow, nsAString &aCurrentCondition)

Protected Attributes

PRBool mDisplayNullAsText
nsCOMPtr< mozISqlConnectionmConnection
nsString mErrorMessage
nsString mQuery
nsString mTableName
nsFixedSizeAllocator mAllocator
nsAutoVoidArray mColumnInfo
nsVoidArray mRows
nsObjectHashtable mSources
nsCOMArray< nsIRDFObservermObservers
nsCOMPtr< nsITreeSelectionmSelection
nsCOMPtr< nsITreeBoxObjectmBoxObject
nsCOMPtr< mozISqlResultEnumeratormPrimaryKeys
PRInt32 mCanInsert
PRInt32 mCanUpdate
PRInt32 mCanDelete

Static Protected Attributes

static PRInt32 gRefCnt = 0
static nsIRDFServicegRDFService
static nsIDateTimeFormatgFormat
static nsIRDFResourcekSQL_ResultRoot
static nsIRDFResourcekNC_Child
static nsIRDFLiteralkNullLiteral
static nsIRDFLiteralkEmptyLiteral
static nsIRDFLiteralkTrueLiteral
static nsIRDFLiteralkFalseLiteral

Private Attributes

char ** mResult
PRInt32 mColumnCount
PRInt32 mRowCount
PRInt32 mWritable

Friends

class mozSqlResultEnumerator
class mozSqlResultStream

Detailed Description

Definition at line 44 of file mozSqlResultSqlite.h.


Constructor & Destructor Documentation

mozSqlResultSqlite::mozSqlResultSqlite ( mozISqlConnection aConnection,
const nsAString &  aQuery 
)

Definition at line 40 of file mozSqlResultSqlite.cpp.

  : mozSqlResult(aConnection, aQuery),
    mResult(nsnull),
    mColumnCount(0),
    mRowCount(0),
    mWritable(PR_FALSE)
{
}

Definition at line 60 of file mozSqlResultSqlite.cpp.

Here is the call graph for this function:


Member Function Documentation

Add an observer to this data source.

If the datasource supports observers, the datasource source should hold a strong reference to the observer.

Here is the caller graph for this function:

nsresult mozSqlResult::AppendKeys ( Row aRow,
nsAutoString aKeys 
) [protected, virtual, inherited]

Reimplemented in mozSqlResultMysql.

Definition at line 1100 of file mozSqlResult.cpp.

{
  mPrimaryKeys->BeforeFirst();

  PRBool hasNext = PR_FALSE;
  do {
    if (hasNext)
      aKeys.AppendLiteral(" AND ");

    mPrimaryKeys->Next(&hasNext);

    nsAutoString value;
    mPrimaryKeys->GetString(2, value);
    aKeys.Append(value);
    aKeys.Append(PRUnichar('='));

    PRInt32 index;
    GetColumnIndex(value, &index);
    if (index == -1) {
      mErrorMessage.AssignLiteral("MOZSQL: The result doesn't contain all primary key fields");
      return NS_ERROR_FAILURE;
    }

    Cell* cell = aRow->mCells[index];
    AppendValue(cell, aKeys);

  } while(hasNext);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void mozSqlResult::AppendValue ( Cell aCell,
nsAutoString aValues 
) [protected, inherited]

Definition at line 1060 of file mozSqlResult.cpp.

{
  if (aCell->IsNull())
    aValues.AppendLiteral("NULL");
  else if (aCell->IsDefault())
    aValues.AppendLiteral("DEFAULT");
  else {
    PRInt32 type = aCell->GetType();
    if (type == mozISqlResult::TYPE_STRING) {
      aValues.Append(PRUnichar('\''));
      aValues.Append(aCell->mString);
      aValues.Append(PRUnichar('\''));
    }
    else if (type == mozISqlResult::TYPE_INT)
      aValues.AppendInt(aCell->mInt);
    else if (type == mozISqlResult::TYPE_FLOAT ||
             type == mozISqlResult::TYPE_DECIMAL)
      aValues.AppendFloat(aCell->mFloat);
    else if (type == mozISqlResult::TYPE_DATE ||
             type == mozISqlResult::TYPE_TIME ||
             type == mozISqlResult::TYPE_DATETIME) {
      aValues.Append(PRUnichar('\''));
      nsAutoString value;
      gFormat->FormatPRTime(nsnull,
                            type != mozISqlResult::TYPE_TIME ? kDateFormatLong : kDateFormatNone,
                            type != mozISqlResult::TYPE_DATE ? kTimeFormatSeconds : kTimeFormatNone,
                            PRTime(aCell->mDate),
                            value);
      aValues.Append(value);
      aValues.Append(PRUnichar('\''));
    }
    else if (type == mozISqlResult::TYPE_BOOL) {
      aValues.Append(PRUnichar('\''));
      aValues.AppendInt(aCell->mBool);
      aValues.Append(PRUnichar('\''));
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Get a cursor to iterate over all the arcs that point into a node.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that labels points to a valid (but possible empty) nsISimpleEnumerator object.

Here is the caller graph for this function:

Get a cursor to iterate over all the arcs that originate in a resource.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that labels points to a valid (but possible empty) nsISimpleEnumerator object.

Here is the caller graph for this function:

void nsIRDFDataSource::Assert ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Add an assertion to the graph.

Here is the caller graph for this function:

Notify observers that the datasource is about to send several notifications at once.

This must be followed by calling endUpdateBatch(), otherwise viewers will get out of sync.

Implements mozSqlResult.

Definition at line 80 of file mozSqlResultSqlite.cpp.

{
  for (PRInt32 i = 0; i < mColumnCount; i++) {
    char* n = mResult[i];
    PRUnichar* name = UTF8ToNewUnicode(nsDependentCString(n));
    PRInt32 type = GetColType(i);
    PRInt32 size = -1;
    PRInt32 mod = -1;

    nsCAutoString uri(NS_LITERAL_CSTRING("http://www.mozilla.org/SQL-rdf#"));
    uri.Append(n);
    nsCOMPtr<nsIRDFResource> property;
    gRDFService->GetResource(uri, getter_AddRefs(property));

    ColumnInfo* columnInfo = ColumnInfo::Create(mAllocator, name, type, size,
                                                mod, PR_FALSE, property);
    mColumnInfo.AppendElement(columnInfo); 
  }

  return NS_OK;
}

Here is the call graph for this function:

nsresult mozSqlResultSqlite::BuildRows ( ) [protected, virtual]

Implements mozSqlResult.

Definition at line 103 of file mozSqlResultSqlite.cpp.

{
  for(PRInt32 i = 1; i <= mRowCount; i++) {
    nsCOMPtr<nsIRDFResource> resource;
    nsresult rv = gRDFService->GetAnonymousResource(getter_AddRefs(resource));
    if (NS_FAILED(rv)) return rv;

    Row* row = Row::Create(mAllocator, resource, mColumnInfo);

    for (PRInt32 j = 0; j < mColumnInfo.Count(); j++) {
      if (mResult[j+i*mColumnCount]) {
        char* value = mResult[j+i*mColumnCount];
        Cell* cell = row->mCells[j];
        cell->SetNull(PR_FALSE);
        cell->SetString(UTF8ToNewUnicode(nsDependentCString(value)));
      }
    }

    mRows.AppendElement(row);
    nsVoidKey key(resource);
    mSources.Put(&key, row);
  }

  return NS_OK;
}

Here is the call graph for this function:

nsresult mozSqlResultSqlite::CanDelete ( PRBool _retval) [protected, virtual]

Implements mozSqlResult.

Definition at line 155 of file mozSqlResultSqlite.cpp.

{
  *_retval = mWritable;

  return NS_OK;
}
boolean nsITreeView::canDrop ( in long  index,
in long  orientation 
) [inherited]

Methods used by the drag feedback code to determine if a drag is allowable at the current location.

To get the behavior where drops are only allowed on items, such as the mailNews folder pane, always return false when the orientation is not DROP_ON.

nsresult mozSqlResultSqlite::CanInsert ( PRBool _retval) [protected, virtual]

Implements mozSqlResult.

Definition at line 139 of file mozSqlResultSqlite.cpp.

{
  *_retval = mWritable;

  return NS_OK;
}
nsresult mozSqlResultSqlite::CanUpdate ( PRBool _retval) [protected, virtual]

Implements mozSqlResult.

Definition at line 147 of file mozSqlResultSqlite.cpp.

{
  *_retval = mWritable;

  return NS_OK;
}
void nsIRDFDataSource::Change ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aOldTarget,
in nsIRDFNode  aNewTarget 
) [inherited]

Change an assertion from.

[aSource]--[aProperty]-->[aOldTarget]

to

[aSource]--[aProperty]-->[aNewTarget]

Here is the caller graph for this function:

void mozSqlResult::ClearColumnInfo ( ) [protected, inherited]

Definition at line 973 of file mozSqlResult.cpp.

{
  for (PRInt32 i = 0; i < mColumnInfo.Count(); i++) {
    ColumnInfo* columnInfo = (ColumnInfo*)mColumnInfo[i];
    ColumnInfo::Destroy(mAllocator, columnInfo);
  }
  mColumnInfo.Clear();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void mozSqlResultSqlite::ClearNativeResult ( ) [protected, virtual]

Implements mozSqlResult.

Definition at line 130 of file mozSqlResultSqlite.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void mozSqlResult::ClearRows ( ) [protected, inherited]

Definition at line 983 of file mozSqlResult.cpp.

{
  for (PRInt32 i = 0; i < mRows.Count(); i++) {
    Row* row = (Row*)mRows[i];
    Row::Destroy(mAllocator, mColumnInfo.Count(), row);
  }
  mRows.Clear();
  mSources.Reset();
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mozSqlResult::CopyValues ( mozISqlResult aResult,
Row aRow 
) [protected, inherited]

Definition at line 1209 of file mozSqlResult.cpp.

{
  nsCOMPtr<mozISqlResultEnumerator> enumerator;
  nsresult rv = aResult->Enumerate(getter_AddRefs(enumerator));
  if (NS_FAILED(rv))
    return rv;

  rv = enumerator->First();
  if (NS_FAILED(rv))
    return rv;

  PRInt32 columnCount;
  aResult->GetColumnCount(&columnCount);
  for (PRInt32 i = 0; i < columnCount; i++) {
    Cell* cell = aRow->mCells[i];
    PRBool isNull;
    enumerator->IsNull(i, &isNull);
    if (isNull)
      cell->SetNull(PR_TRUE);
    else {
      cell->SetNull(PR_FALSE);
      PRInt32 type;
      aResult->GetColumnType(i, &type);
      if (type == mozISqlResult::TYPE_STRING) {
        nsAutoString value;
        enumerator->GetString(i, value);
        cell->SetString(ToNewUnicode(value));
      }
      else if (type == mozISqlResult::TYPE_INT)
        enumerator->GetInt(i, &cell->mInt);
      else if (type == mozISqlResult::TYPE_FLOAT)
        enumerator->GetFloat(i, &cell->mFloat);
      else if (type == mozISqlResult::TYPE_DECIMAL)
        enumerator->GetDecimal(i, &cell->mFloat);
      else if (type == mozISqlResult::TYPE_DATE)
        enumerator->GetDate(i, &cell->mDate);
      else if (type == mozISqlResult::TYPE_TIME)
        enumerator->GetDate(i, &cell->mDate);
      else if (type == mozISqlResult::TYPE_DATETIME)
        enumerator->GetDate(i, &cell->mDate);
      else if (type == mozISqlResult::TYPE_BOOL)
        enumerator->GetBool(i, &cell->mBool);
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsITreeView::cycleCell ( in long  row,
in nsITreeColumn  col 
) [inherited]

Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.

Called on the view when a header is clicked.

nsresult mozSqlResult::DeleteRow ( PRInt32  aRowIndex,
PRInt32 _retval 
) [protected, inherited]

Definition at line 1466 of file mozSqlResult.cpp.

{
  *_retval = -1;

  nsresult rv = EnsureTableName();
  if (NS_FAILED(rv))
    return rv;

  rv = EnsurePrimaryKeys();
  if (NS_FAILED(rv))
    return rv;

  Row* row = (Row*)mRows[aRowIndex];

  nsAutoString keys;
  rv = AppendKeys(row, keys);
  if (NS_FAILED(rv))
    return rv;

  PRInt32 affectedRows;
  rv = mConnection->ExecuteUpdate(NS_LITERAL_STRING("DELETE FROM ") +
    mTableName + NS_LITERAL_STRING(" WHERE ") + keys, &affectedRows);

  if (NS_FAILED(rv)) {
    mConnection->GetErrorMessage(mErrorMessage);
    return rv;
  }

  mRows.RemoveElementAt(aRowIndex);
  nsVoidKey key(row->mSource);
  mSources.Remove(&key);

  for (PRInt32 i = 0; i < mObservers.Count(); i++)
    mObservers[i]->OnUnassert(this, kSQL_ResultRoot, kNC_Child, row->mSource);

  if (mBoxObject)
    mBoxObject->RowCountChanged(aRowIndex, -1);

  Row::Destroy(mAllocator, mColumnInfo.Count(), row);

  *_retval = 1;
  return NS_OK;
}

Here is the call graph for this function:

void nsIRDFDataSource::DoCommand ( in nsISupportsArray  aSources,
in nsIRDFResource  aCommand,
in nsISupportsArray  aArguments 
) [inherited]

Perform the specified command on set of sources.

Here is the caller graph for this function:

void nsITreeView::drop ( in long  row,
in long  orientation 
) [inherited]

Called when the user drops something on this view.

The |orientation| param specifies before/on/after the given |row|.

Notify observers that the datasource has completed issuing a notification group.

NS_DECL_MOZISQLDATASOURCE NS_DECL_NSIRDFDATASOURCE NS_DECL_NSIRDFREMOTEDATASOURCE NS_DECL_NSITREEVIEW NS_IMETHOD mozSqlResult::EnsureNative ( ) [inline, inherited]

Definition at line 332 of file mozSqlResult.h.

{ return NS_OK; }
nsresult mozSqlResult::EnsurePrimaryKeys ( ) [protected, virtual, inherited]

Reimplemented in mozSqlResultMysql.

Definition at line 1020 of file mozSqlResult.cpp.

{
  if (mPrimaryKeys)
    return NS_OK;

  nsAutoString schema;
  nsAutoString table;
  nsAString::const_iterator start, s;
  nsAString::const_iterator end, e;
  mTableName.BeginReading(start);
  mTableName.EndReading(end);
  s = start;
  e = end;
  if (FindInReadable(NS_LITERAL_STRING("."), s, e)) {
    schema.Assign(Substring(start, s));
    table.Assign(Substring(e, end));
  }
  else {
    table.Assign(mTableName);
  }

  nsCOMPtr<mozISqlResult> result;
  nsresult rv = mConnection->GetPrimaryKeys(schema, table, getter_AddRefs(result));
  if (NS_FAILED(rv))
    return rv;

  nsCOMPtr<mozISqlResultEnumerator> primaryKeys;
  rv = result->Enumerate(getter_AddRefs(primaryKeys));
  if (NS_FAILED(rv))
    return rv;

  rv = primaryKeys->First();
  if (NS_FAILED(rv))
    return rv;

  mPrimaryKeys = primaryKeys;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mozSqlResult::EnsureTableName ( ) [protected, inherited]

Definition at line 994 of file mozSqlResult.cpp.

{
  if (!mTableName.IsEmpty())
    return NS_OK;

  nsAString::const_iterator start, end;
  mQuery.BeginReading(start);
  mQuery.EndReading(end);

  NS_NAMED_LITERAL_STRING(from, "from");
  nsAString::const_iterator iter = end;
  if (FindInReadable(from, start, iter, nsCaseInsensitiveStringComparator())) {
    while (iter != end && nsCRT::IsAsciiSpace(*iter))
      ++iter;
    start = iter;
    while (iter != end && !nsCRT::IsAsciiSpace(*iter))
      ++iter;
    mTableName.Assign(Substring(start, iter));
  }
  else
    return NS_ERROR_FAILURE;

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Returns an enumerator to enumerator over the returned rows.

Returns:
the row enumerator

Definition at line 325 of file mozSqlResult.cpp.

{
  mozISqlResultEnumerator* enumerator = new mozSqlResultEnumerator(this);
  if (! enumerator)
    return NS_ERROR_OUT_OF_MEMORY;
  NS_ADDREF(*_retval = enumerator);
  return NS_OK;
}

Here is the call graph for this function:

Request that a data source write it's contents out to permanent storage, if applicable.

Implemented in LocalStoreImpl.

Here is the caller graph for this function:

Returns the set of all commands defined for a given source.

Here is the caller graph for this function:

Retrieve all of the resources that the data source currently refers to.

Here is the caller graph for this function:

void nsITreeView::getCellProperties ( in long  row,
in nsITreeColumn  col,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given cell.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-cell-x to be matched on the ::moz-tree-cell pseudoelement.

AString nsITreeView::getCellText ( in long  row,
in nsITreeColumn  col 
) [inherited]

The text for a given cell.

If a column consists only of an image, then the empty string is returned.

AString nsITreeView::getCellValue ( in long  row,
in nsITreeColumn  col 
) [inherited]

The value for a given cell.

This method is only called for columns of type other than |text|.

PRInt32 mozSqlResultSqlite::GetColType ( PRInt32  aColumnIndex) [protected]

Definition at line 74 of file mozSqlResultSqlite.cpp.

Here is the caller graph for this function:

NS_IMETHODIMP mozSqlResult::GetColumnCount ( PRInt32 aColumnCount) [inherited]

Definition at line 206 of file mozSqlResult.cpp.

{
  *aColumnCount = mColumnInfo.Count();
  return NS_OK;
}
long mozISqlResult::getColumnDisplaySize ( in long  aColumnIndex) [inherited]

Returns the maximum number of bytes that are needed to hold a value in a particular column.

Parameters:
aColumnIndexthe index of the column to return the size of
Returns:
the column size
NS_IMETHODIMP mozSqlResult::GetColumnDisplaySize ( PRInt32  aColumnIndex,
PRInt32 _retval 
) [inherited]

Definition at line 284 of file mozSqlResult.cpp.

{
  if (aColumnIndex < 0 || aColumnIndex >= mColumnInfo.Count())
    return NS_ERROR_INVALID_ARG;

  ColumnInfo* columnInfo = ((ColumnInfo*)mColumnInfo[aColumnIndex]);
  PRInt32 mod = columnInfo->mMod - 4;

  switch (columnInfo->mType) {
    case mozISqlResult::TYPE_STRING:
      *_retval = mod;
      break;
    case mozISqlResult::TYPE_INT:
      *_retval = 11; // -2147483648 to +2147483647
      break;
    case mozISqlResult::TYPE_FLOAT:
      *_retval = 11;
      break;
    case mozISqlResult::TYPE_DECIMAL:
      *_retval = ((mod >> 16) & 0xffff) + 1 + (mod & 0xffff);
      break;
    case mozISqlResult::TYPE_DATE:
      *_retval = 14; // "01/01/4713 BC" - "31/12/32767 AD"
      break;
    case mozISqlResult::TYPE_TIME:
      *_retval = 8;  // 00:00:00-23:59:59
      break;
    case mozISqlResult::TYPE_DATETIME:
      *_retval = 22;
      break;
    case mozISqlResult::TYPE_BOOL:
      *_retval = 1;
      break;
    default:
      *_retval = columnInfo->mSize;
  }

  return NS_OK;
}
long mozISqlResult::getColumnIndex ( in AString  aColumnName) [inherited]

Retrieves the index of a column given its name.

If the column does not exist, -1 is returned.

Parameters:
aColumnNamethe column name to return
Returns:
the column index
NS_IMETHODIMP mozSqlResult::GetColumnIndex ( const nsAString &  aColumnName,
PRInt32 _retval 
) [inherited]

Definition at line 220 of file mozSqlResult.cpp.

{
  *_retval = -1;

  for (PRInt32 i = 0; i < mColumnInfo.Count(); i++) {
    PRUnichar* name = ((ColumnInfo*)mColumnInfo[i])->mName;
    if (aColumnName.Equals(name)) {
      *_retval = i;
      break;
    }
  }

  return NS_OK;
}

Here is the caller graph for this function:

AString mozISqlResult::getColumnName ( in long  aColumnIndex) [inherited]

Retrieves the name of a column given its index.

Indicies start at zero.

Parameters:
aColumnIndexthe index of the column to return
Returns:
the column name
NS_IMETHODIMP mozSqlResult::GetColumnName ( PRInt32  aColumnIndex,
nsAString &  _retval 
) [inherited]

Definition at line 213 of file mozSqlResult.cpp.

{
  _retval.Assign(((ColumnInfo*)mColumnInfo[aColumnIndex])->mName);
  return NS_OK;
}

Called to get properties to paint a column background.

For shading the sort column, etc.

long mozISqlResult::getColumnType ( in long  aColumnIndex) [inherited]

Returns the type of the data in a given column.

Parameters:
aColumnIndexthe index of the column to return the type of
Returns:
the column type
NS_IMETHODIMP mozSqlResult::GetColumnType ( PRInt32  aColumnIndex,
PRInt32 _retval 
) [inherited]

Definition at line 236 of file mozSqlResult.cpp.

{
  if (aColumnIndex < 0 || aColumnIndex >= mColumnInfo.Count())
    return NS_ERROR_INVALID_ARG;

  *_retval = ((ColumnInfo*)mColumnInfo[aColumnIndex])->mType;

  return NS_OK;
}
AString mozISqlResult::getColumnTypeAsString ( in long  aColumnIndex) [inherited]

Returns the type of the data in a given column as a string.

This is used as an alternative to using the constants and will return either string, int, float, decimal, date, time, datetime or bool.

Parameters:
aColumnIndexthe index of the column to return the type of
Returns:
the column type
NS_IMETHODIMP mozSqlResult::GetColumnTypeAsString ( PRInt32  aColumnIndex,
nsAString &  _retval 
) [inherited]

Definition at line 247 of file mozSqlResult.cpp.

{
  if (aColumnIndex < 0 || aColumnIndex >= mColumnInfo.Count())
    return NS_ERROR_INVALID_ARG;

  PRInt32 type = ((ColumnInfo*)mColumnInfo[aColumnIndex])->mType;
  switch (type) {
    case mozISqlResult::TYPE_STRING:
      _retval.AssignLiteral("string");
      break;
    case mozISqlResult::TYPE_INT:
      _retval.AssignLiteral("int");
      break;
    case mozISqlResult::TYPE_FLOAT:
      _retval.AssignLiteral("float");
      break;
    case mozISqlResult::TYPE_DECIMAL:
      _retval.AssignLiteral("decimal");
      break;
    case mozISqlResult::TYPE_DATE:
      _retval.AssignLiteral("date");
      break;
    case mozISqlResult::TYPE_TIME:
      _retval.AssignLiteral("time");
      break;
    case mozISqlResult::TYPE_DATETIME:
      _retval.AssignLiteral("datetime");
      break;
    case mozISqlResult::TYPE_BOOL:
      _retval.AssignLiteral("bool");
      break;
  }

  return NS_OK;
}
nsresult mozSqlResult::GetCondition ( Row aRow,
nsAString &  aCurrentCondition 
) [protected, inherited]

Definition at line 1511 of file mozSqlResult.cpp.

{
  nsresult rv = EnsureTableName();
  if (NS_FAILED(rv))
    return rv;

  rv = EnsurePrimaryKeys();
  if (NS_FAILED(rv))
    return rv;

  nsAutoString keys;
  rv = AppendKeys(aRow, keys);
  if (NS_FAILED(rv))
    return rv;

  aCurrentCondition = keys;

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 175 of file mozSqlResult.cpp.

{
  NS_ADDREF(*aConnection = mConnection);
  return NS_OK;
}

Here is the call graph for this function:

AString nsITreeView::getImageSrc ( in long  row,
in nsITreeColumn  col 
) [inherited]

The image path for a given cell.

For defining an icon for a cell. If the empty string is returned, the :moz-tree-image pseudoelement will be used.

Retrieve the index associated with specified RDF resource.

Parameters:
aResourceThe resource.
long nsITreeView::getLevel ( in long  index) [inherited]

The level is an integer value that represents the level of indentation.

It is multiplied by the width specified in the :moz-tree-indentation pseudoelement to compute the exact indendation.

long nsITreeView::getParentIndex ( in long  rowIndex) [inherited]

Methods used by the tree to draw thread lines in the tree.

getParentIndex is used to obtain the index of a parent row. If there is no parent row, getParentIndex returns -1.

long nsITreeView::getProgressMode ( in long  row,
in nsITreeColumn  col 
) [inherited]
NS_IMETHODIMP mozSqlResult::GetQuery ( nsAString &  aQuery) [inherited]

Definition at line 182 of file mozSqlResult.cpp.

{
  aQuery = mQuery;
  return NS_OK;
}

Retrieve the RDF resource associated with the specified row.

Parameters:
aRowIndexThe row index.
void nsITreeView::getRowProperties ( in long  index,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given row.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-row-x to be matched on the pseudoelement ::moz-tree-row.

nsIRDFResource nsIRDFDataSource::GetSource ( in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Find an RDF resource that points to a given node over the specified arc & truth value.

Returns:
NS_RDF_NO_VALUE if there is no source that leads to the target with the specified property.

Here is the caller graph for this function:

nsISimpleEnumerator nsIRDFDataSource::GetSources ( in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Find all RDF resources that point to a given node over the specified arc & truth value.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that nsISimpleEnumerator points to a valid (but possibly empty) cursor.

Here is the caller graph for this function:

NS_IMETHODIMP mozSqlResult::GetTableName ( nsAString &  aTableName) [inherited]

Definition at line 189 of file mozSqlResult.cpp.

{
  nsresult rv = EnsureTableName();
  if (NS_FAILED(rv))
    return rv;
  aTableName = mTableName;
  return NS_OK;
}

Here is the call graph for this function:

nsIRDFNode nsIRDFDataSource::GetTarget ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in boolean  aTruthValue 
) [inherited]

Find a child of that is related to the source by the given arc arc and truth value.

Returns:
NS_RDF_NO_VALUE if there is no target accessable from the source via the specified property.

Here is the caller graph for this function:

nsISimpleEnumerator nsIRDFDataSource::GetTargets ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in boolean  aTruthValue 
) [inherited]

Find all children of that are related to the source by the given arc arc and truth value.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that nsISimpleEnumerator points to a valid (but possibly empty) cursor.

Here is the caller graph for this function:

nsresult mozSqlResult::GetValues ( Row aRow,
mozISqlResult **  aResult,
PRBool  aUseID 
) [protected, inherited]

Definition at line 1132 of file mozSqlResult.cpp.

{
  nsAutoString query(mQuery);
  nsAString::const_iterator start;
  nsAString::const_iterator end;
  query.BeginReading(start);
  query.EndReading(end);

  NS_NAMED_LITERAL_STRING(where, "WHERE");
  nsAString::const_iterator s = start;
  nsAString::const_iterator e = end;
  if (FindInReadable(where, s, e, nsCaseInsensitiveStringComparator())) {
    nsAutoString keys(PRUnichar(' '));

    if (aUseID) {
      nsAutoString IDName;
      ((mozSqlConnection*)mConnection.get())->GetIDName(IDName);
      PRInt32 lastID;
      mConnection->GetLastID(&lastID);
      keys.Append(IDName);
      keys.Append(PRUnichar('='));
      keys.AppendInt(lastID);
    }
    else {
      nsresult rv = AppendKeys(aRow, keys);
      if (NS_FAILED(rv))
        return rv;
    }

    keys.AppendLiteral(" AND ");
    query.Insert(keys, Distance(start, e));
  }
  else {
    NS_NAMED_LITERAL_STRING(from, "FROM");
    s = start;
    e = end;
    if (FindInReadable(from, s, e, nsCaseInsensitiveStringComparator())) {
      while (e != end && nsCRT::IsAsciiSpace(*e))
        ++e;
      while (e != end && !nsCRT::IsAsciiSpace(*e))
        ++e;
      nsAutoString keys(NS_LITERAL_STRING(" WHERE "));

      if (aUseID) {
        nsAutoString IDName;
        ((mozSqlConnection*)mConnection.get())->GetIDName(IDName);
        PRInt32 lastID;
        mConnection->GetLastID(&lastID);
        keys.Append(IDName);
        keys.Append(PRUnichar('='));
        keys.AppendInt(lastID);
      }
      else {
        nsresult rv = AppendKeys(aRow, keys);
        if (NS_FAILED(rv))
          return rv;
      }

      query.Insert(keys, Distance(start, e));
    }
  }


  nsCOMPtr<mozISqlResult> result;
  nsresult rv = mConnection->ExecuteQuery(query, getter_AddRefs(result));

  if (NS_FAILED(rv)) {
    mConnection->GetErrorMessage(mErrorMessage);
    return rv;
  }

  NS_ADDREF(*aResult = result);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

boolean nsIRDFDataSource::hasArcIn ( in nsIRDFNode  aNode,
in nsIRDFResource  aArc 
) [inherited]

Returns true if the specified node is pointed to by the specified arc.

Equivalent to enumerating ArcLabelsIn and comparing for the specified arc.

Returns true if the specified node has the specified outward arc.

Equivalent to enumerating ArcLabelsOut and comparing for the specified arc.

boolean nsIRDFDataSource::HasAssertion ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Query whether an assertion exists in this graph.

Here is the caller graph for this function:

boolean nsITreeView::hasNextSibling ( in long  rowIndex,
in long  afterIndex 
) [inherited]

hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.

Code that is forced to march down the view looking at levels can optimize the march by starting at afterIndex+1.

void nsIRDFRemoteDataSource::Init ( in string  aURI) [inherited]

Specify the URI for the data source: this is the prefix that will be used to register the data source in the data source registry.

Parameters:
aURIthe URI to load

Definition at line 75 of file mozSqlResult.cpp.

{
  nsresult rv;

  if (gRefCnt++ == 0) {
    rv = CallGetService(kRDFServiceCID, &gRDFService);
    if (NS_FAILED(rv)) return rv;

    rv = CallCreateInstance(kDateTimeFormatCID, &gFormat);
    if (NS_FAILED(rv)) return rv;

    rv = gRDFService->GetResource(NS_LITERAL_CSTRING("SQL:ResultRoot"),
                                  &kSQL_ResultRoot);
    if (NS_FAILED(rv)) return rv;
    rv = gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
                                  &kNC_Child);
    if (NS_FAILED(rv)) return rv;

    rv = gRDFService->GetLiteral(NS_LITERAL_STRING("null").get(), &kNullLiteral);
    if (NS_FAILED(rv)) return rv;
    rv = gRDFService->GetLiteral(EmptyString().get(), &kEmptyLiteral);
    if (NS_FAILED(rv)) return rv;
    rv = gRDFService->GetLiteral(NS_LITERAL_STRING("true").get(), &kTrueLiteral);
    if (NS_FAILED(rv)) return rv;
    rv = gRDFService->GetLiteral(NS_LITERAL_STRING("false").get(), &kFalseLiteral);
    if (NS_FAILED(rv)) return rv;
  }

  static const size_t kBucketSizes[] = {
    sizeof(ColumnInfo),
    sizeof(Cell),
    sizeof(Row)
  };
  static const PRInt32 kNumBuckets = sizeof(kBucketSizes) / sizeof(size_t);
  static const PRInt32 kInitialSize = 16;

  mAllocator.Init("mozSqlResult", kBucketSizes, kNumBuckets, kInitialSize);

  return Rebuild();
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mozSqlResult::InsertRow ( Row aSrcRow,
PRInt32 _retval 
) [protected, inherited]

Definition at line 1258 of file mozSqlResult.cpp.

{
  *_retval = -1;

  nsresult rv = EnsureTableName();
  if (NS_FAILED(rv))
    return rv;

  rv = EnsurePrimaryKeys();
  if (NS_FAILED(rv))
    return rv;

  nsAutoString names;
  nsAutoString values;

  names.Append(PRUnichar('('));
  values.Append(PRUnichar('('));
  PRInt32 i;
  for (i = 0; i < mColumnInfo.Count(); i++) {
    if (i) {
      names.AppendLiteral(", ");
      values.AppendLiteral(", ");
    }
    names.Append(((ColumnInfo*)mColumnInfo[i])->mName);

    Cell* cell = aSrcRow->mCells[i];
    AppendValue(cell, values);
  }
  names.Append(PRUnichar(')'));
  values.Append(PRUnichar(')'));

  PRInt32 affectedRows;
  rv = mConnection->ExecuteUpdate(NS_LITERAL_STRING("INSERT INTO ") +
    mTableName + names + NS_LITERAL_STRING(" VALUES") + values, &affectedRows);

  if (NS_FAILED(rv)) {
    mConnection->GetErrorMessage(mErrorMessage);
    return rv;
  }

  nsAutoString IDName;
  ((mozSqlConnection*)mConnection.get())->GetIDName(IDName);

  // assume that if the IDName is empty that we don't need to re-get the last row
  if (!IDName.IsEmpty()){
    nsCOMPtr<mozISqlResult> result;
    rv = GetValues(aSrcRow, getter_AddRefs(result), PR_TRUE);
    if (NS_FAILED(rv))
      return rv;

    PRInt32 rowCount;
    result->GetRowCount(&rowCount);
    if (rowCount == 0) {
      *_retval = 0;
      return NS_OK;
    }

    rv = CopyValues(result, aSrcRow);
    if (NS_FAILED(rv))
      return rv;
  }

  nsCOMPtr<nsIRDFResource> resource;
  gRDFService->GetAnonymousResource(getter_AddRefs(resource));

  Row* row = Row::Create(mAllocator, resource, mColumnInfo, aSrcRow);
  mRows.AppendElement(row);
  nsVoidKey key(resource);
  mSources.Put(&key, row);

  for (i = 0; i < mObservers.Count(); i++)
    mObservers[i]->OnAssert(this, kSQL_ResultRoot, kNC_Child, resource);

  if (mBoxObject)
    mBoxObject->RowCountChanged(mRows.Count() - 1, 1);

  *_retval = 1;
  return NS_OK;
}

Here is the call graph for this function:

boolean nsIRDFDataSource::IsCommandEnabled ( in nsISupportsArray  aSources,
in nsIRDFResource  aCommand,
in nsISupportsArray  aArguments 
) [inherited]

Returns whether a given command is enabled for a set of sources.

Here is the caller graph for this function:

boolean nsITreeView::isContainer ( in long  index) [inherited]

Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.

Here is the caller graph for this function:

boolean nsITreeView::isContainerEmpty ( in long  index) [inherited]
boolean nsITreeView::isContainerOpen ( in long  index) [inherited]
boolean nsITreeView::isEditable ( in long  row,
in nsITreeColumn  col 
) [inherited]

isEditable is called to ask the view if the cell contents are editable.

A value of true will result in the tree popping up a text field when the user tries to inline edit the cell.

boolean nsITreeView::isSeparator ( in long  index) [inherited]

isSeparator is used to determine if the row at index is a separator.

A value of true will result in the tree drawing a horizontal separator. The tree uses the ::moz-tree-separator pseudoclass to draw the separator.

boolean nsITreeView::isSorted ( ) [inherited]

Specifies if there is currently a sort on any column.

Used mostly by dragdrop to affect drop feedback.

void nsIRDFDataSource::Move ( in nsIRDFResource  aOldSource,
in nsIRDFResource  aNewSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget 
) [inherited]

'Move' an assertion from

[aOldSource]--[aProperty]-->[aTarget]

to

[aNewSource]--[aProperty]-->[aTarget]

Here is the caller graph for this function:

Returns a stream which may be used to return the rows as XML.

The XML format is: <?xml version="1.0"?> <document> <body> <row> <cell>value11</cell> <cell>value12</cell> ... </row> </body> </document>

Returns:
the input stream

Definition at line 335 of file mozSqlResult.cpp.

{
  mozSqlResultStream* stream = new mozSqlResultStream(this);
  if (! stream)
    return NS_ERROR_OUT_OF_MEMORY;
  NS_ADDREF(*_retval = stream);
  return NS_OK;
}

Here is the call graph for this function:

void nsITreeView::performAction ( in wstring  action) [inherited]

A command API that can be used to invoke commands on the selection.

The tree will automatically invoke this method when certain keys are pressed. For example, when the DEL key is pressed, performAction will be called with the "delete" string.

void nsITreeView::performActionOnCell ( in wstring  action,
in long  row,
in nsITreeColumn  col 
) [inherited]

A command API that can be used to invoke commands on a specific cell.

void nsITreeView::performActionOnRow ( in wstring  action,
in long  row 
) [inherited]

A command API that can be used to invoke commands on a specific row.

Definition at line 117 of file mozSqlResult.cpp.

{
  ClearRows();
  ClearColumnInfo();

  nsresult rv = BuildColumnInfo();
  if (NS_FAILED(rv)) return rv;

  rv = BuildRows();
  if (NS_FAILED(rv)) return rv;

  ClearNativeResult();

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIRDFRemoteDataSource::Refresh ( in boolean  aBlocking) [inherited]

Refresh the remote datasource, re-loading its contents from the URI.

Parameters:
aBlockingIf true, the call will block until the datasource has completely reloaded.
void mozISqlResult::reload ( ) [inherited]

Re-executes the query.

Definition at line 345 of file mozSqlResult.cpp.

{
  mozISqlResult* result = this;
  nsresult rv = mConnection->ExecuteQuery(mQuery, &result);
  if (NS_FAILED(rv))
    return rv;
  NS_RELEASE(result);

  return NS_OK;
}

Remove an observer from this data source.

Here is the caller graph for this function:

Should be called from a XUL onselect handler whenever the selection changes.

void nsITreeView::setCellText ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellText is called when the contents of the cell have been edited by the user.

void nsITreeView::setCellValue ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellValue is called when the value of the cell has been set by the user.

This method is only called for columns of type other than |text|.

NS_IMETHODIMP mozSqlResult::SetDisplayNullAsText ( PRBool  aDisplayNullAsText) [inherited]

Definition at line 168 of file mozSqlResult.cpp.

{
  mDisplayNullAsText = aDisplayNullAsText;
  return NS_OK;
}
void mozSqlResultSqlite::SetResult ( char **  aResult,
PRInt32  nrow,
PRInt32  ncolumn,
PRBool  aWritable 
)

Definition at line 51 of file mozSqlResultSqlite.cpp.

{
  mResult = aResult;
  mColumnCount = aColumnCount;
  mRowCount = aRowCount;
  mWritable = aWritable;
}

Called during initialization to link the view to the front end box object.

void nsITreeView::toggleOpenState ( in long  index) [inherited]

Called on the view when an item is opened or closed.

void nsIRDFDataSource::Unassert ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget 
) [inherited]

Remove an assertion from the graph.

Here is the caller graph for this function:

nsresult mozSqlResult::UpdateRow ( PRInt32  aRowIndex,
Row aSrcRow,
PRInt32 _retval 
) [protected, inherited]

Definition at line 1339 of file mozSqlResult.cpp.

{
  *_retval = -1;

  nsresult rv = EnsureTableName();
  if (NS_FAILED(rv))
    return rv;

  rv = EnsurePrimaryKeys();
  if (NS_FAILED(rv))
    return rv;

  nsAutoString values;
  PRInt32 i;
  for (i = 0; i < mColumnInfo.Count(); i++) {
    if (i)
      values.AppendLiteral(", ");
    values.Append(((ColumnInfo*)mColumnInfo[i])->mName);
    values.Append(PRUnichar('='));

    Cell* cell = aSrcRow->mCells[i];
    AppendValue(cell, values);
  }

  Row* row = (Row*)mRows[aRowIndex];

  nsAutoString keys;
  rv = AppendKeys(row, keys);
  if (NS_FAILED(rv))
    return rv;

  PRInt32 affectedRows;
  rv = mConnection->ExecuteUpdate(NS_LITERAL_STRING("UPDATE ") + mTableName +
    NS_LITERAL_STRING(" SET ") + values + NS_LITERAL_STRING(" WHERE ") + keys,
    &affectedRows);

  if (NS_FAILED(rv)) {
    mConnection->GetErrorMessage(mErrorMessage);
    return rv;
  }

  nsCOMPtr<mozISqlResult> result;
  rv = GetValues(aSrcRow, getter_AddRefs(result), PR_FALSE);
  if (NS_FAILED(rv))
    return rv;

  PRInt32 rowCount;
  result->GetRowCount(&rowCount);
  if (rowCount == 0) {
    mRows.RemoveElementAt(aRowIndex);
    nsVoidKey key(row->mSource);
    mSources.Remove(&key);

    for (PRInt32 i = 0; i < mObservers.Count(); i++)
      mObservers[i]->OnUnassert(this, kSQL_ResultRoot, kNC_Child, row->mSource);

    if (mBoxObject)
      mBoxObject->RowCountChanged(aRowIndex, -1);

    Row::Destroy(mAllocator, mColumnInfo.Count(), row);

    *_retval = 0;
    return NS_OK;
  }

  rv = CopyValues(result, row);
  if (NS_FAILED(rv))
    return rv;

  for (i = 0; i < mColumnInfo.Count(); i++) {
    nsCOMPtr<nsIRDFNode> oldNode;
    nsCOMPtr<nsIRDFNode> newNode;

    Cell* cell = row->mCells[i];
    if (cell->IsNull())
      if (mDisplayNullAsText)
        newNode = kNullLiteral;
      else
        newNode = kEmptyLiteral;
    else {
      PRInt32 type = cell->GetType();
      if (type == mozISqlResult::TYPE_STRING) {
        nsCOMPtr<nsIRDFLiteral> literal;
        PRUnichar* value = cell->mString;
        gRDFService->GetLiteral(value, getter_AddRefs(literal));
        newNode = literal;
      }
      else if (type == mozISqlResult::TYPE_INT) {
        nsCOMPtr<nsIRDFInt> literal;
        PRInt32 value = cell->mInt;
        gRDFService->GetIntLiteral(value, getter_AddRefs(literal));
        newNode = literal;
      }
      else if (type == mozISqlResult::TYPE_FLOAT ||
               type == mozISqlResult::TYPE_DECIMAL) {
        nsCOMPtr<nsIRDFInt> literal;
        PRInt32 value = cell->mInt;
        gRDFService->GetIntLiteral(value, getter_AddRefs(literal));
        newNode = literal;
      }
      else if (type == mozISqlResult::TYPE_DATE ||
               type == mozISqlResult::TYPE_TIME ||
               type == mozISqlResult::TYPE_DATETIME) {
        nsCOMPtr<nsIRDFDate> literal;
        PRInt64 value = cell->mDate;
        gRDFService->GetDateLiteral(value, getter_AddRefs(literal));
        newNode = literal;
      }
      else if (type == mozISqlResult::TYPE_BOOL)
        newNode = cell->mBool ? kTrueLiteral : kFalseLiteral;
    }

    for (PRInt32 j = 0; j < mObservers.Count(); j++) {
      nsIRDFResource* source = row->mSource;
      nsIRDFResource* property = ((ColumnInfo*)mColumnInfo[i])->mProperty;
      mObservers[j]->OnChange(this, source, property, oldNode, newNode);
    }
  }

  if (mBoxObject)
    mBoxObject->InvalidateRow(aRowIndex);

  *_retval = 1;
  return NS_OK;
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class mozSqlResultEnumerator [friend, inherited]

Definition at line 334 of file mozSqlResult.h.

friend class mozSqlResultStream [friend, inherited]

Definition at line 335 of file mozSqlResult.h.


Member Data Documentation

The number of columns in the result.

Definition at line 82 of file mozISqlResult.idl.

The connection used to execute the query.

Definition at line 61 of file mozISqlResult.idl.

By default, this value is false.

Definition at line 56 of file mozISqlResult.idl.

const short nsITreeView::DROP_AFTER = 1 [inherited]

Definition at line 103 of file nsITreeView.idl.

const short nsITreeView::DROP_BEFORE = -1 [inherited]

Definition at line 101 of file nsITreeView.idl.

const short nsITreeView::DROP_ON = 0 [inherited]

Definition at line 102 of file nsITreeView.idl.

nsIDateTimeFormat * mozSqlResult::gFormat [static, protected, inherited]

Definition at line 364 of file mozSqlResult.h.

nsIRDFService * mozSqlResult::gRDFService [static, protected, inherited]

Definition at line 363 of file mozSqlResult.h.

PRInt32 mozSqlResult::gRefCnt = 0 [static, protected, inherited]

Definition at line 362 of file mozSqlResult.h.

nsIRDFLiteral * mozSqlResult::kEmptyLiteral [static, protected, inherited]

Definition at line 368 of file mozSqlResult.h.

nsIRDFLiteral * mozSqlResult::kFalseLiteral [static, protected, inherited]

Definition at line 370 of file mozSqlResult.h.

nsIRDFResource * mozSqlResult::kNC_Child [static, protected, inherited]

Definition at line 366 of file mozSqlResult.h.

nsIRDFLiteral * mozSqlResult::kNullLiteral [static, protected, inherited]

Definition at line 367 of file mozSqlResult.h.

nsIRDFResource * mozSqlResult::kSQL_ResultRoot [static, protected, inherited]

Definition at line 365 of file mozSqlResult.h.

nsIRDFLiteral * mozSqlResult::kTrueLiteral [static, protected, inherited]

Definition at line 369 of file mozSqlResult.h.

This value is true when the datasource has fully loaded itself.

Definition at line 50 of file nsIRDFRemoteDataSource.idl.

nsFixedSizeAllocator mozSqlResult::mAllocator [protected, inherited]

Definition at line 377 of file mozSqlResult.h.

Definition at line 383 of file mozSqlResult.h.

PRInt32 mozSqlResult::mCanDelete [protected, inherited]

Definition at line 387 of file mozSqlResult.h.

PRInt32 mozSqlResult::mCanInsert [protected, inherited]

Definition at line 385 of file mozSqlResult.h.

PRInt32 mozSqlResult::mCanUpdate [protected, inherited]

Definition at line 386 of file mozSqlResult.h.

Definition at line 70 of file mozSqlResultSqlite.h.

nsAutoVoidArray mozSqlResult::mColumnInfo [protected, inherited]

Definition at line 378 of file mozSqlResult.h.

Definition at line 373 of file mozSqlResult.h.

PRBool mozSqlResult::mDisplayNullAsText [protected, inherited]

Definition at line 372 of file mozSqlResult.h.

nsString mozSqlResult::mErrorMessage [protected, inherited]

Definition at line 374 of file mozSqlResult.h.

Definition at line 381 of file mozSqlResult.h.

Definition at line 384 of file mozSqlResult.h.

nsString mozSqlResult::mQuery [protected, inherited]

Definition at line 375 of file mozSqlResult.h.

char** mozSqlResultSqlite::mResult [private]

Definition at line 69 of file mozSqlResultSqlite.h.

Definition at line 71 of file mozSqlResultSqlite.h.

nsVoidArray mozSqlResult::mRows [protected, inherited]

Definition at line 379 of file mozSqlResult.h.

Definition at line 382 of file mozSqlResult.h.

nsObjectHashtable mozSqlResult::mSources [protected, inherited]

Definition at line 380 of file mozSqlResult.h.

nsString mozSqlResult::mTableName [protected, inherited]

Definition at line 376 of file mozSqlResult.h.

Definition at line 72 of file mozSqlResultSqlite.h.

const short nsITreeView::PROGRESS_NONE = 3 [inherited]

Definition at line 153 of file nsITreeView.idl.

const short nsITreeView::PROGRESS_NORMAL = 1 [inherited]

The progress mode for a given cell.

This method is only called for columns of type |progressmeter|.

Definition at line 151 of file nsITreeView.idl.

Definition at line 152 of file nsITreeView.idl.

readonly attribute AString mozISqlResult::query [inherited]

The SQL query.

Definition at line 66 of file mozISqlResult.idl.

readonly attribute long nsITreeView::rowCount [inherited]

The total number of rows in the tree (including the offscreen rows).

Definition at line 53 of file nsITreeView.idl.

readonly attribute long mozISqlResult::rowCount [inherited]

The number of rows in the result.

Definition at line 77 of file mozISqlResult.idl.

The selection for this view.

Definition at line 58 of file nsITreeView.idl.

readonly attribute AString mozISqlResult::tableName [inherited]

The table that was used in the query.

If more than one table was used, only the first is returned.

Definition at line 72 of file mozISqlResult.idl.

Definition at line 111 of file mozISqlResult.idl.

Definition at line 108 of file mozISqlResult.idl.

Definition at line 110 of file mozISqlResult.idl.

Definition at line 107 of file mozISqlResult.idl.

Definition at line 106 of file mozISqlResult.idl.

Definition at line 105 of file mozISqlResult.idl.

column type constants used by |getColumnType|.

Definition at line 104 of file mozISqlResult.idl.

Definition at line 109 of file mozISqlResult.idl.

readonly attribute string nsIRDFDataSource::URI [inherited]

The "URI" of the data source.

This used by the RDF service's |GetDataSource()| method to cache datasources.

Definition at line 56 of file nsIRDFDataSource.idl.


The documentation for this class was generated from the following files: