Tables and Columns
- Forms and Reports
- Document Links
- Tables and Columns
A com.sun.star.sdb.Table encapsulates tables in a OpenOffice.org API data source. The com.sun.star.sdb.Table service changes the appearance of a table and its columns in the GUI, and it contains read-only information about the table definition, such as the table name and type, the schema and catalog name, and access privileges.
It is also possible to alter the table definition at the com.sun.star.sdb.Table service. This is discussed in the section Database Design below.
The table related services in the database context are unable to access the data in a database table. Use the com.sun.star.sdb.RowSet service, or to establish a connection to a database and use its com.sun.star.sdb.XCommandPreparation interface to manipulate table data. For details, see the sections The RowSet Service and PreparedStatement From DataSource Queries.
The following illustration shows the relationship between the com.sun.star.sdb.Connection and the Table objects it provides, and the services included in com.sun.star.sdb.Table.
The com.sun.star.sdbcx.XTablesSupplier interface of a Connection supplies a com.sun.star.sdbcx.Container of com.sun.star.sdb.Table services through its method getTables()
. The container administers Table services by name, index or as enumeration.
Just like queries, tables include the display properties specified in com.sun.star.sdb.DataSettings:
Properties of com.sun.star.sdb.DataSettings | |
---|---|
Filter | string - An additional filter for the data object, WHERE clause syntax.
|
ApplyFilter | boolean - Indicates if the filter should be applied. The default is FALSE .
|
Order | string - Is an additional sort order definition.
|
FontDescriptor | struct com.sun.star.awt.FontDescriptor. Specifies the font attributes for displayed data.
|
RowHeight | long - Specifies the height of a data row.
|
TextColor | long - Specifies the text color for displayed text in 0xAARRGGBB notation
|
Basic table information is included in the properties included with com.sun.star.sdbcx.Table:
Properties of com.sun.star.sdbcx.Table | |
---|---|
Name | [readonly] string - Table name.
|
CatalogName | [readonly] string - Catalog name.
|
SchemaName | [readonly] string - Schema name.
|
Description | [readonly] string - Table Description, if supported by the driver.
|
Type | [readonly] string - Table type, possible values are TABLE , VIEW , SYSTEM TABLE or an empty string if the driver does not support different table types.
|
The service com.sun.star.sdb.Table is an extension of the service com.sun.star.sdbcx.Table. It introduces an additional property called Privileges
. The Privileges
property indicates the actions the current user may carry out on the table.
Properties of com.sun.star.sdb.Table | |
---|---|
Privileges | [readonly] long, constants group com.sun.star.sdbcx.Privilege. The property contains a bitwise AND combination of the following privileges:
|
The appearance of single columns in a table can be changed. The following illustration depicts the service com.sun.star.sdb.Column and its relationship with the com.sun.star.sdb.Table service.
For this purpose, com.sun.star.sdb.Table supports the interface com.sun.star.sdbcx.XColumnsSupplier. Its method getColumns()
returns a com.sun.star.sdbcx.Container with the additional column-related interface com.sun.star.sdbc.XColumnLocate that is useful to get the column number for a certain column in a table:
long findColumn( [in] string columnName)
The service com.sun.star.sdb.Column combines com.sun.star.sdbcx.Column and the com.sun.star.sdb.ColumnSettings to form a column service with the opportunity to alter the visual appearance of a column.
Properties of com.sun.star.sdb.ColumnSettings | |
---|---|
FormatKey | long - Contains the index of the number format that is used for the column. The proper value can be determined using the com.sun.star.util.XNumberFormatter interface. If the value is void, a default number format is used according to the data type of the column.
|
Align | long - Specifies the alignment of column text. Possible values are:
0: left If the value is void, a default alignment is used according to the data type of the column. |
Width | long - Specifies the width of the column displayed in a grid. The unit is 10th mm. If the value is void, a default width should be used according to the label of the column.
|
Position | long - The ordinal position of the column within a grid. If the value is void, the default position should be used according to their order of appearance in com.sun.star.sdbc.XResultSetMetaData.
|
Hidden | boolean - Determines if the column should be displayed.
|
ControlModel | com.sun.star.beans.XPropertySet. May contain a control model that defines the settings for layout. The default is NULL. |
HelpText | string - Describes an optional help text that can be used by UI components when representing this column.
|
ControlDefault | string - Contains the default value that should be displayed by a control when moving to a new row.
|
The Properties of com.sun.star.sdbcx.Column are readonly and can be used for information purposes:
Properties of com.sun.star.sdbcx.Column | |
---|---|
Name | [readonly] string - The name of the column.
|
Type | [readonly] long - The com.sun.star.sdbc.DataType of the column.
|
TypeName | [readonly] string - The type name used by the database. If the column type is a user-defined type, then a fully-qualified type name is returned. May be empty.
|
Precision | [readonly] long - The number of decimal digits or chars.
|
Scale | [readonly] long - Number of digits after the decimal point.
|
IsNullable | [readonly] long , constants group com.sun.star.sdbc.ColumnValue. Indicates if values may be NULL in the designated column. Possible values are:
NULLABLE: column allows NULL values. |
IsAutoIncrement | [readonly] boolean - Indicates if the column is automatically numbered.
|
IsCurrency | [readonly] boolean - Indicates if the column is a cash value.
|
IsRowVersion | [readonly] boolean - Indicates whether the column contains a type of time or date stamp used to track updates.
|
Description | [readonly] string - Keeps a description of the object.
|
DefaultValue | [readonly] string - Keeps a default value for a column, and is provided as a string.
|
Content on this page is licensed under the Public Documentation License (PDL). |