LibreOffice: DataSource Service Reference

LibreOffice LibreOffice 7.5 SDK API Reference

Loading...
Searching...
No Matches
Public Types | Exported Interfaces | Public Attributes | List of all members
DataSource Service Referencepublished

is a factory to establish database connections. More...

Inheritance diagram for DataSource:

## Public Types
typedef sequence< com::sun::star::beans::PropertyValue > | Info
| is a list of arbitrary string tag/value pairs as connection arguments
typedef sequence< string > | TableFilter
| defines a list of tables, on which the DataSource should have it's focus.
typedef sequence< string > | TableTypeFilter
| defines a list of table types, on which the DataSource should have it's focus.

## Exported Interfaces
interface | com::sun::star::beans::XPropertySet
interface | XCompletedConnection
| useful for establishing connections with the completion of connection parameters provided during user interaction.
interface | com::sun::star::sdbc::XIsolatedConnection
| useful for establishing isolated connections which are not shared among others as it is the case when using XCompletedConnection or com::sun::star::sdbc::XDataSource.
interface | com::sun::star::util::XFlushable
| is provided to flush a DataSource within to a Database Context.
interface | XQueryDefinitionsSupplier
| provides the access to DataSource related queries.
interface | com::sun::star::sdbc::XDataSource
interface | XBookmarksSupplier
| provides access to bookmarks to documents associated with the data source

## Public Attributes
string | Name
| is the name of the data source.
string | URL
| indicates a database url of the form `jdbc:subprotocol:subname` or `sdbc:subprotocol:subname`
com::sun::star::beans::XPropertySet | Settings
| is a convenience wrapper around the Info property.
string | User
| determines a users login name.
string | Password
| determines a users password.
boolean | IsPasswordRequired
| indicates that a password is always necessary.
boolean | SuppressVersionColumns
| indicates that components displaying data obtained from this data source should suppress columns used for versioning.
boolean | IsReadOnly
| determines whether modifications on the data source are allowed or not.
com::sun::star::util::XNumberFormatsSupplier | NumberFormatsSupplier
| provides an object for formatting numbers.

## Additional Inherited Members
Public Member Functions inherited from XPropertySet
com::sun::star::beans::XPropertySetInfo | getPropertySetInfo ()
void | setPropertyValue ([in] string aPropertyName, [in] any aValue) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException )
| sets the value of the property with the specified name.
any | getPropertyValue ([in] string PropertyName) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
void | addPropertyChangeListener ([in] string aPropertyName, [in] com::sun::star::beans::XPropertyChangeListener xListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
| adds an XPropertyChangeListener to the specified property.
void | removePropertyChangeListener ([in] string aPropertyName, [in] com::sun::star::beans::XPropertyChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
| removes an XPropertyChangeListener from the listener list.
void | addVetoableChangeListener ([in] string PropertyName, [in] com::sun::star::beans::XVetoableChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
| adds an XVetoableChangeListener to the specified property with the name PropertyName.
void | removeVetoableChangeListener ([in] string PropertyName, [in] com::sun::star::beans::XVetoableChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
| removes an XVetoableChangeListener from the listener list.
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object.
void | acquire ()
| increases the reference counter by one.
void | release ()
| decreases the reference counter by one.
Public Member Functions inherited from XCompletedConnection
com::sun::star::sdbc::XConnection | connectWithCompletion ([in]com::sun::star::task::XInteractionHandler handler) raises (com::sun::star::sdbc::SQLException)
| attempts to establish a database connection.
Public Member Functions inherited from XIsolatedConnection
XConnection | getIsolatedConnectionWithCompletion ([in]com::sun::star::task::XInteractionHandler handler) raises (SQLException)
| attempts to establish a database connection.
XConnection | getIsolatedConnection ([in]string user, [in]string password) raises (SQLException)
| attempts to establish a database connection.
Public Member Functions inherited from XFlushable
void | flush ()
| flushes the data of the object to the connected data source.
void | addFlushListener ([in] com::sun::star::util::XFlushListener l)
| adds the specified listener to receive event "flushed."
void | removeFlushListener ([in] com::sun::star::util::XFlushListener l)
| removes the specified listener.
Public Member Functions inherited from XQueryDefinitionsSupplier
com::sun::star::container::XNameAccess | getQueryDefinitions ()
| returns the container of commands.
Public Member Functions inherited from XDataSource
XConnection | getConnection ([in]string user, [in]string password) raises (SQLException)
| attempts to establish a database connection.
void | setLoginTimeout ([in]long seconds) raises (SQLException)
| sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
long | getLoginTimeout () raises (SQLException)
| gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
Protected Member Functions inherited from XBookmarksSupplier
com::sun::star::container::XNameAccess | getBookmarks ()

## Detailed Description

is a factory to establish database connections.

It should be registered at a com::sun::star::uno::NamingService.

See also
  com::sun::star::sdb::DatabaseContext

Developers Guide
  Database Access - The DataSource Service

## Member Typedef Documentation

## ◆ Info

sequence<com::sun::star::beans::PropertyValue> Info
| property

is a list of arbitrary string tag/value pairs as connection arguments

The DataSource itself does not attempt to interpret any of those values.

Instead, the values in this property have two use cases:

- Upon creating a connection, for every value in this sequence it's checked whether the com::sun::star::sdbc::XDriver which is to provide the connection supports a setting with the respective name, using its com::sun::star::sdbc::XDriver::getPropertyInfo() method.br/> If so, the settings is passed to the driver's com::sun::star::sdbc::XDriver::connect() method. If not, the setting is ignored.
- External components may use the settings to carry arbitrary information with the data source. Usually, this is used to control the behavior of components working with the data source.

## ◆ TableFilter

sequence<string> TableFilter
| property

defines a list of tables, on which the DataSource should have it's focus.

If empty, all tables are rejected.

## ◆ TableTypeFilter

sequence<string> TableTypeFilter
| property

defines a list of table types, on which the DataSource should have it's focus.

If empty, all table types are rejected.

## Exported Interfaces

## ◆ com::sun::star::beans::XPropertySet

interface com::sun::star::beans::XPropertySet

## ◆ com::sun::star::sdbc::XDataSource

interface com::sun::star::sdbc::XDataSource

## ◆ com::sun::star::sdbc::XIsolatedConnection

interface com::sun::star::sdbc::XIsolatedConnection

useful for establishing isolated connections which are not shared among others as it is the case when using XCompletedConnection or com::sun::star::sdbc::XDataSource.

See also
  XCompletedConnection
  com::sun::star::sdbc::XDataSource

Since
  OOo 1.1.2

## ◆ com::sun::star::util::XFlushable

interface com::sun::star::util::XFlushable

is provided to flush a DataSource within to a Database Context.

## ◆ XBookmarksSupplier

interface XBookmarksSupplier
| optional

provides access to bookmarks to documents associated with the data source

The object returned by the com::sun::star::sdb::XBookmarksSupplier::getBookmarks() supports the com::sun::star::sdb::DefinitionContainer service.

## ◆ XCompletedConnection

interface XCompletedConnection

useful for establishing connections with the completion of connection parameters provided during user interaction.

## ◆ XQueryDefinitionsSupplier

interface XQueryDefinitionsSupplier

provides the access to DataSource related queries.

The object returned by the com::sun::star::sdb::XQueryDefinitionsSupplier::getQueryDefinitions() supports the com::sun::star::sdb::DefinitionContainer service.

## Member Data Documentation

## ◆ IsPasswordRequired

boolean IsPasswordRequired
| property

indicates that a password is always necessary.

## ◆ IsReadOnly

boolean IsReadOnly
| propertyreadonly

determines whether modifications on the data source are allowed or not.

## ◆ Name

string Name
| propertyreadonly

is the name of the data source.

If the data source is registered at the database context, then the `Name` property denotes the registration name. Otherwise, the name property contains the URL of the file which the database document associated with the data source is based on.

If the same data source is registered under different names, the value of the `Name` property is not defined.

## ◆ NumberFormatsSupplier

com::sun::star::util::XNumberFormatsSupplier NumberFormatsSupplier
| propertyreadonly

provides an object for formatting numbers.

## ◆ Password

string Password
| property

determines a users password.

The password is not persistent.

## ◆ Settings

com::sun::star::beans::XPropertySet Settings
| optionalpropertyreadonly

is a convenience wrapper around the Info property.

Since fiddling around with a sequence of property values is somewhat uncomfortable in all known UNO language bindings (especially for tasks like simply changing the value of an existing value), the Settings property wraps the Info property for easier single-value access.

You should use the Settings property if you need to access a few properties only, and the Info property if you need access to all existent settings at once.

The object represented by this property supports the com::sun::star::beans::PropertyBag service. That is, you can at runtime add arbitrary new properties to the bag.

Additionally, the property bag supports default values of properties, and thus the com::sun::star::beans::XPropertyState interface. If you add an own property to the bag using com::sun::star::beans::XPropertyContainer::addProperty(), you need to specify an initial value, which is also used as default value (exceptions see below).

Effectively, the property bag represented by `Settings` contains two classes of properties: Pre-defined ones and user-defined ones.

Pre-defined properties are properties which are potentially used by the data source, the application UI for the data source, or a particular backend driver employed by the data source. There's a large set of such properties, no all of them are effectively used for a concrete data source, nonetheless, they're all present in the `Settings`.
Such properties are not removable from the bag, that is, their com::sun::star::beans::PropertyAttribute::REMOVABLE attribute is not set.
Usually, you'll find that all of this properties have the com::sun::star::beans::PropertyState::PropertyState_DEFAULT_VALUE state.

User-defined properties are the ones which are added at runtime by any instance. They might or might not be removable, this depends on whether or not the code adding them specifies the com::sun::star::beans::PropertyAttribute::REMOVABLE attribute. Also, they might or might not have a default value, determined by the com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT attribute at the time they're added to the bag.

When a data source is made persistent, then properties which are not removable (which are assumed to be the pre-defined properties) are ignored when they are in `DEFAULT` state. All other properties are always made persistent, except when an explicit com::sun::star::beans::PropertyAttribute::TRANSIENT attribute prohibits this.

Similar, when you obtain the Info property of a `DataSource`, the `Settings` bag is asked for all its property values, and the ones which are removable and in state default are stripped, and not returned in the `Info` sequence.

## ◆ SuppressVersionColumns

boolean SuppressVersionColumns
| property

indicates that components displaying data obtained from this data source should suppress columns used for versioning.

## ◆ URL

string URL
| property

indicates a database url of the form
`jdbc:subprotocol:subname` or `sdbc:subprotocol:subname`

## ◆ User

string User
| property

determines a users login name.

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

- com/sun/star/sdb/DataSource.idl