Back to index

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

#include <mozSqlService.h>

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

List of all members.

Public Member Functions

 mozSqlService ()
virtual ~mozSqlService ()
nsresult Init ()
nsIRDFResource addAlias (in AString aName, in AString aType, in AString aHostname, in long aPort, in AString aDatabase, in long aPriority)
 Add an alias for a database connection.
void fetchAlias (in nsIRDFResource aAlias, out AString aName, out AString aType, out AString aHostname, out long aPort, out AString aDatabase, out long aPriority)
 Retrieves alias information.
void updateAlias (in nsIRDFResource aAlias, in AString aName, in AString aType, in AString aHostname, in long aPort, in AString aDatabase, in long aPriority)
 Update the information of an alias that has already been added.
void removeAlias (in nsIRDFResource aAlias)
 Removes an alias that already exists.
nsIRDFResource getAlias (in AString aName)
 Get the alias resource with the given name.
nsISimpleEnumerator getAliases (in AString aName)
 Get the aliases with the given name.
mozISqlConnection getConnection (in nsIRDFResource aAlias)
 Retrieves an SQL connection to a database given its alias.
mozISqlConnection getNewConnection (in nsIRDFResource aAlias)
 Opens and returns a new connection to a database.
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 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.
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)

Public Attributes

readonly attribute AString errorMessage
 Holds the string message of the last error that occured when a connection was opened.
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.

Protected Member Functions

nsresult EnsureAliasesContainer ()

Private Attributes

nsString mErrorMessage
nsCOMPtr< nsIRDFDataSourcemInner
nsCOMPtr< nsIRDFContainermAliasesContainer
nsSupportsHashtable * mConnectionCache

Static Private Attributes

static nsIRDFServicegRDFService
static nsIRDFContainerUtilsgRDFContainerUtils
static nsIRDFResourcekSQL_AliasesRoot
static nsIRDFResourcekSQL_Name
static nsIRDFResourcekSQL_Type
static nsIRDFResourcekSQL_Hostname
static nsIRDFResourcekSQL_Port
static nsIRDFResourcekSQL_Database
static nsIRDFResourcekSQL_Priority

Detailed Description

Definition at line 52 of file mozSqlService.h.


Constructor & Destructor Documentation

Definition at line 69 of file mozSqlService.cpp.


Member Function Documentation

nsIRDFResource mozISqlService::addAlias ( in AString  aName,
in AString  aType,
in AString  aHostname,
in long  aPort,
in AString  aDatabase,
in long  aPriority 
) [inherited]

Add an alias for a database connection.

An alias must be added before a connection can be made.

Different types of databases may be connected to using the |aType| argument. For instance 'pgsql' or 'mysql'. When a connection is made, a component of the form '.org/sql/connection;1?type=<type>' will be looked up using the component manager. This allows additional database implementations to be provided separately of mozSQL.

Parameters:
aNamehuman-readable name of the alias
aTypedatabase type (such as pgsql)
aHostnamehostname for the database
aPortport for the database
aDatabasedatabase name
aPrioritypriority
Returns:
an RDF resource representing the alias

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:

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.

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 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:

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

Definition at line 670 of file mozSqlService.cpp.

{
  if (! mAliasesContainer) {
    PRBool isContainer;
    nsresult rv = gRDFContainerUtils->IsContainer(mInner, kSQL_AliasesRoot, &isContainer);
    if (NS_FAILED(rv)) return rv;

    if (!isContainer) {
      rv = gRDFContainerUtils->MakeSeq(mInner, kSQL_AliasesRoot, getter_AddRefs(mAliasesContainer));
      if (NS_FAILED(rv)) return rv;
    }
    else {
      mAliasesContainer = do_CreateInstance(NS_RDF_CONTRACTID "/container;1", &rv);
      if (NS_FAILED(rv)) return rv;
      rv = mAliasesContainer->Init(mInner, kSQL_AliasesRoot);
      if (NS_FAILED(rv)) return rv;
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

void mozISqlService::fetchAlias ( in nsIRDFResource  aAlias,
out AString  aName,
out AString  aType,
out AString  aHostname,
out long  aPort,
out AString  aDatabase,
out long  aPriority 
) [inherited]

Retrieves alias information.

The out parameters are filled in with the corresponding information.

Parameters:
aAliasthe alias to retrieve
aNamehuman-readable name of the alias
aTypedatabase type
aHostnamehostname of the database
aPortport of the database
aDatabasedatabase name
aPrioritypriority

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:

nsIRDFResource mozISqlService::getAlias ( in AString  aName) [inherited]

Get the alias resource with the given name.

Parameters:
aNamethe name of the alias to retrieve
Returns:
the RDF resource for the alias, or null if it doesn't exist.
nsISimpleEnumerator mozISqlService::getAliases ( in AString  aName) [inherited]

Get the aliases with the given name.

Parameters:
aNamethe name of the aliases to retrieve
Returns:
an enumerator for the aliases

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:

Retrieves an SQL connection to a database given its alias.

If a connection is already open, that connection is returned. Otherwise, a new connection is opened and returned.

Parameters:
aAliasthe alias to use to open a connection
Returns:
a connection

Opens and returns a new connection to a database.

The user will be prompted for a username and password.

Parameters:
aAliasthe alias to use to open a connection
Returns:
a newly opened connection
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:

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:

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:

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 105 of file mozSqlService.cpp.

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:

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:

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.

Removes an alias that already exists.

Parameters:
aAliasthe alias to remove

Remove an observer from this data source.

Here is the caller graph for this function:

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:

void mozISqlService::updateAlias ( in nsIRDFResource  aAlias,
in AString  aName,
in AString  aType,
in AString  aHostname,
in long  aPort,
in AString  aDatabase,
in long  aPriority 
) [inherited]

Update the information of an alias that has already been added.

The new information replaces the old information.

Parameters:
aAliasthe alias to update
aNamehuman-readable name of the alias
aTypedatabase type (such as pgsql)
aHostnamehostname for the database
aPortport for the database
aDatabasedatabase name
aPrioritypriority

Member Data Documentation

readonly attribute AString mozISqlService::errorMessage [inherited]

Holds the string message of the last error that occured when a connection was opened.

Definition at line 64 of file mozISqlService.idl.

Definition at line 71 of file mozSqlService.h.

Definition at line 70 of file mozSqlService.h.

Definition at line 73 of file mozSqlService.h.

Definition at line 78 of file mozSqlService.h.

Definition at line 76 of file mozSqlService.h.

Definition at line 74 of file mozSqlService.h.

Definition at line 77 of file mozSqlService.h.

Definition at line 79 of file mozSqlService.h.

Definition at line 75 of file mozSqlService.h.

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

Definition at line 50 of file nsIRDFRemoteDataSource.idl.

Definition at line 83 of file mozSqlService.h.

nsSupportsHashtable* mozSqlService::mConnectionCache [private]

Definition at line 84 of file mozSqlService.h.

Definition at line 81 of file mozSqlService.h.

Definition at line 82 of file mozSqlService.h.

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: