21.08.2013 Views

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

User (String)<br />

user name<br />

Password (String)<br />

user password (is not saved)<br />

IsPasswordRequired (Boolean)<br />

the password is needed and is interactively requested from user.<br />

IsReadOnly (Boolean)<br />

permits read-only access to the database<br />

NumberFormatsSupplier (Object)<br />

object containing the number formats available for the database (supports the<br />

com.sun.star.util.XNumberFormatsSupplier interface)<br />

TableFilter (Array)<br />

list of table names to be displayed<br />

TableTypeFilter (Array)<br />

list of table types to be displayed. Values available are TABLE, VIEW and SYSTEM TABLE<br />

SuppressVersionColumns (Boolean)<br />

suppresses the display of columns that are used for version administration<br />

Data Sources<br />

Note – The data sources from <strong>OpenOffice</strong>.<strong>org</strong> are not 1:1 comparable with the data sources in ODBC.<br />

Whereas an ODBC data source only covers information about the origin of the data, a data source in<br />

<strong>OpenOffice</strong>.<strong>org</strong> also includes a range of information about how the data is displayed within the database windows<br />

of <strong>OpenOffice</strong>.<strong>org</strong>.<br />

Queries<br />

Predefined queries can be assigned to a data source. <strong>OpenOffice</strong>.<strong>org</strong> notes the SQL commands of queries so that<br />

they are available at all times. Queries are used to simplify working with databases because they can be opened<br />

with a simple mouse click and also provide users without any knowledge of SQL with the option of issuing SQL<br />

commands.<br />

An object which supports the com.sun.star.sdb.QueryDefinition service is concealed behind a query. The queries<br />

are accessed by means of the QueryDefinitions method of the data source.<br />

The following example lists the names of data source queries can be established in a message box.<br />

Dim DatabaseContext As Object<br />

Dim DataSource As Object<br />

Dim QueryDefinitions As Object<br />

Dim QueryDefinition As Object<br />

Dim I As Integer<br />

DatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext")<br />

DataSource = DatabaseContext.getByName("Customers")<br />

QueryDefinitions = DataSource.getQueryDefinitions()<br />

For I = 0 To QueryDefinitions.Count() - 1<br />

QueryDefinition = QueryDefinitions(I)<br />

MsgBox QueryDefinition.Name<br />

Next I<br />

In addition to the Name property used in the example, the com.sun.star.sdb.QueryDefinition provides a whole<br />

range of other properties. These are:<br />

Name (String)<br />

query name<br />

Chapter 10 · Databases 145

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!