Difference between revisions of "Documentation/DevGuide/Database/XDatabaseMetaData Interface"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (1 revision(s))
m (Table Align Left was disturbing display)
(3 intermediate revisions by one other user not shown)
Line 5: Line 5:
 
|NextPage=Documentation/DevGuide/Database/Driver Statements
 
|NextPage=Documentation/DevGuide/Database/Driver Statements
 
}}
 
}}
{{DISPLAYTITLE:XDatabaseMetaData Interface}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Database/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:XDatabaseMetaData Interface}}
 
<!--<idltopic>com.sun.star.sdbc.XDatabaseMetaData</idltopic>-->
 
<!--<idltopic>com.sun.star.sdbc.XDatabaseMetaData</idltopic>-->
 
The <idl>com.sun.star.sdbc.XDatabaseMetaData</idl> interface is the largest interface existing in the SDBC API. This interface knows everything about the used database. It provides information, such as the available tables with their columns, keys and indexes, and information about identifiers that should be used. This chapter explains some of the methods that are frequently used and how they are used to achieve a robust Driver.
 
The <idl>com.sun.star.sdbc.XDatabaseMetaData</idl> interface is the largest interface existing in the SDBC API. This interface knows everything about the used database. It provides information, such as the available tables with their columns, keys and indexes, and information about identifiers that should be used. This chapter explains some of the methods that are frequently used and how they are used to achieve a robust Driver.
  
{|border="1" cellpadding=4 style="border-collapse:collapse;" align="left"
+
{|border="1" cellpadding=4 style="border-collapse:collapse;"
 
|-bgcolor=#EDEDED
 
|-bgcolor=#EDEDED
 
!colspan="2"|Important Methods of <idl>com.sun.star.sdbc.XDatabaseMetaData</idl>  
 
!colspan="2"|Important Methods of <idl>com.sun.star.sdbc.XDatabaseMetaData</idl>  
Line 45: Line 46:
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Database Access]]
+
 
 +
[[Category:Documentation/Developer's Guide/Database Access]]

Revision as of 16:01, 24 May 2015



The com.sun.star.sdbc.XDatabaseMetaData interface is the largest interface existing in the SDBC API. This interface knows everything about the used database. It provides information, such as the available tables with their columns, keys and indexes, and information about identifiers that should be used. This chapter explains some of the methods that are frequently used and how they are used to achieve a robust Driver.

Important Methods of com.sun.star.sdbc.XDatabaseMetaData
isReadOnly() Returns the state of the database. When true, the database is not editable later in OpenOffice.org API.
usesLocalFiles() Returns true when the catalog name of the database should not appear in the DatasourceBrowser of OpenOffice.org API, otherwise false is returned.
supportsMixedCaseQuotedIdentifiers() When this method returns true,the quoted identifiers are case sensitive. For example, in a driver that supports mixed case quoted identifiers, SELECT * FROM "MyTable" retrieves data from a table with the case-sensitive name MyTable.
getTables() Returns a ResultSet object that returns a single row for each table that fits the search criteria, such as the catalog name, schema pattern, table name pattern and sequence of table types. The correct column count and names of the columns are found at com.sun.star.sdbc.XDatabaseMetaData:getTables(). If this method does not return any rows, this driver does not work with OpenOffice.org API.

Any other getXXX() method can be implemented step by step. For the the first step they return an empty ResultSet object that contains no rows. It is not allowed to return NULL here.

The skeleton driver defines empty ResultSets for these get methods.

 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( 
     const Any& catalog, const ::rtl::OUString& schemaPattern, 
     const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) 
     throw(SQLException, RuntimeException)
 {
     // this returns an empty resultset where the column-names are already set
     // in special the metadata of the resultset already returns the right columns
     ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
     Reference< XResultSet > xResultSet = pResultSet;
     pResultSet->setTablesMap();
     return xResultSet;
 }
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages