Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
mozISqlService Interface Reference

The SQL service is used to construct direct connections to SQL-based databases. More...

import "mozISqlService.idl";

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

List of all members.

Public Member Functions

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.

Public Attributes

readonly attribute AString errorMessage
 Holds the string message of the last error that occured when a connection was opened.

Detailed Description

The SQL service is used to construct direct connections to SQL-based databases.

The service maintains a set of aliases, one for each database to connect to. Methods are provided for adding, retrieving and removing aliases. Once an alias has been added, it is persistent, so it does not need to be added again. The aliases are stored in user preferences. Aliases are identfied using an RDF resource.

Once an alias has been added, a connection may be opened to a database using the RDF resource.

UNDER_DEVELOPMENT

Definition at line 58 of file mozISqlService.idl.


Member Function Documentation

nsIRDFResource mozISqlService::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.

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
void mozISqlService::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.

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

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.

Get the aliases with the given name.

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

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

Removes an alias that already exists.

Parameters:
aAliasthe alias to remove
void mozISqlService::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.

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

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

Definition at line 64 of file mozISqlService.idl.


The documentation for this interface was generated from the following file: