LibreOffice: XSingleSelectQueryAnalyzer Interface Reference

LibreOffice LibreOffice 7.3 SDK API Reference

Loading...
Searching...
No Matches
Public Member Functions | List of all members
XSingleSelectQueryAnalyzer Interface Reference

simplifies the analyzing of single select statements. More...

Inheritance diagram for XSingleSelectQueryAnalyzer:

## Public Member Functions
string | getQuery ()
| returns the query. More...
void | setQuery ([in] string command) raises (com::sun::star::sdbc::SQLException)
| sets a new query for the composer, which may be expanded by filters, group by, having and sort criteria. More...
string | getFilter ()
| returns the used filter. More...
sequence< sequence< com::sun::star::beans::PropertyValue > > | getStructuredFilter ()
| returns the currently used filter. More...
string | getGroup ()
| returns the currently used GROUP BY. More...
com::sun::star::container::XIndexAccess | getGroupColumns ()
| returns the currently used group. More...
string | getHavingClause ()
| returns the used HAVING filter. More...
sequence< sequence< com::sun::star::beans::PropertyValue > > | getStructuredHavingClause ()
| returns the currently used HAVING filter. More...
string | getOrder ()
| returns the currently used sort order. More...
com::sun::star::container::XIndexAccess | getOrderColumns ()
| returns the currently used sort order. More...
string | getQueryWithSubstitution () raises (com::sun::star::sdbc::SQLException)
| returns the query previously set at the analyzer, with all application-level features being substituted by their database-level counterparts. More...
void | setCommand ([in] string Command, [in] long CommandType) raises (com::sun::star::sdbc::SQLException)
| sets a new query for the composer, which may be expanded by filters, group by, having and sort criteria. More...
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...

## Detailed Description

simplifies the analyzing of single select statements.

The interface can be used for analyzing single SELECT statements without knowing the structure of the used query.

## Member Function Documentation

## ◆ getFilter()

string getFilter | ( |  | ) |

returns the used filter.

The filter criteria returned is part of the where condition of the select command, but it does not contain the where token.

Returns
  the filter

## ◆ getGroup()

string getGroup | ( |  | ) |

returns the currently used GROUP BY.

The group criteria returned is part of the GROUP BY clause of the select command, but it does not contain the GROUP BY keyword .

Returns
  the group

## ◆ getGroupColumns()

com::sun::star::container::XIndexAccess getGroupColumns | ( |  | ) |

returns the currently used group.

The columns returned from the GROUP BY clause.

Returns
  a collection of com::sun::star::sdb::GroupColumn which form the GROUP BY.

## ◆ getHavingClause()

string getHavingClause | ( |  | ) |

returns the used HAVING filter.

The HAVING filter criteria returned is part of the HAVING condition of the select command, but it does not contain the HAVING token.

Returns
  the filter

## ◆ getOrder()

string getOrder | ( |  | ) |

returns the currently used sort order.

The order criteria returned is part of the ORDER BY clause of the select command, but it does not contain the ORDER BY keyword .

Returns
  the order

## ◆ getOrderColumns()

com::sun::star::container::XIndexAccess getOrderColumns | ( |  | ) |

returns the currently used sort order.

The order criteria returned is part of the ORDER BY clause of the select command, but it does not contain the ORDER BY keyword .

Returns
  a collection of com::sun::star::sdb::OrderColumn which form the ORDER BY.

## ◆ getQuery()

string getQuery | ( |  | ) |

returns the query.

Returns
  the query

## ◆ getQueryWithSubstitution()

string getQueryWithSubstitution | ( |  | ) |
raises | ( | com::sun::star::sdbc::SQLException
| ) |  |

returns the query previously set at the analyzer, with all application-level features being substituted by their database-level counterparts.

The XSingleSelectQueryAnalyzer is an application-level component, which in some respect understands SQL features usually not present at the database level. As a prominent example, you might pass a `SELECT` statement to the analyzer which is based on another query.

While all other methods will handle those additional features transparently - e.g. the query in the `FROM` part of a `SELECT` statement will be handled as if it really is a table -, `getQueryWithSubstitution` gives you the SQL statement where all those features have been stripped, and replaced with appropriate standard SQL.

For example, consider a database document which contains a client-side query named `All Orders`. This query is not known to the underlying database, so an SQL statement like `SELECT * from "All Orders"` would be rejected by the database. However, instantiating a SingleSelectQueryAnalyzer at the Connection object, and passing it the above query, you can then use `getQueryWithSubstitution` to retrieve a statement where `"All Orders"` has been replaced with the `SELECT` statement which actually constitutes the `"All Orders"` query.

Exceptions

  com::sun::star::sdbc::SQLException | if the query represented cannot be completely substituted. A usual case for this is a recursion in the sub queries: Consider a query named `foo`, which is defined as `SELECT * FROM "bar"`. Now assume that `bar` is a query defined as `SELECT * FROM "foo"`. Passing either of those statements to an analyzer, and calling getQueryWithSubstitution(), would result in an exception being thrown, since it's impossible to substitute the sub queries with their constituting statements.

See also
  Connection
  XQueriesSupplier
  DatabaseDocument

Since
  OOo 2.0.4

## ◆ getStructuredFilter()

sequence< sequence< com::sun::star::beans::PropertyValue > > getStructuredFilter | ( |  | ) |

returns the currently used filter.

The filter criteria is split into levels. Each level represents the OR criteria. Within each level, the filters are provided as an AND criteria with the name of the column and the filter condition. The filter condition is of type string. The operator used, is defined by com::sun::star::sdb::SQLFilterOperator.

Returns
  the structured filter

## ◆ getStructuredHavingClause()

sequence< sequence< com::sun::star::beans::PropertyValue > > getStructuredHavingClause | ( |  | ) |

returns the currently used HAVING filter.

The HAVING filter criteria is split into levels. Each level represents the OR criteria. Within each level, the filters are provided as an AND criteria with the name of the column and the filter condition. The filter condition is of type string. The operator used, is defined by com::sun::star::sdb::SQLFilterOperator.

Returns
  the structured HAVING filter

## ◆ setCommand()

void setCommand | ( | [in] string | Command,
|  | [in] long | CommandType
| ) |  |
raises | ( | com::sun::star::sdbc::SQLException
| ) |  |

sets a new query for the composer, which may be expanded by filters, group by, having and sort criteria.

Parameters

  Command | is the command which should be executed, the type of command depends on the CommandType.

In case of a `CommandType` of com::sun::star::sdb::CommandType::COMMAND, means in case the `Command` specifies an SQL statement, the inherited com::sun::star::sdbc::RowSet::EscapeProcessing becomes relevant:
It then can be to used to specify whether the SQL statement should be analyzed on the client side before sending it to the database server.
The default value for com::sun::star::sdbc::RowSet::EscapeProcessing is `TRUE`. By switching it to `FALSE`, you can pass backend-specific SQL statements, which are not standard SQL, to your database.

See also
  com::sun::star::sdb::CommandType
  com::sun::star::sdbc::RowSet::EscapeProcessing

Parameters

  CommandType | is the type of the command.

See also
  com::sun::star::sdb::CommandType

Exceptions

  com::sun::star::sdbc::SQLException | if a database access error occurs or the statement isn't a single select statement or the statement isn't valid or the statement can not be parsed.

## ◆ setQuery()

void setQuery | ( | [in] string | command | ) |
raises | ( | com::sun::star::sdbc::SQLException
| ) |  |

sets a new query for the composer, which may be expanded by filters, group by, having and sort criteria.

Parameters

  command | the single select statement to set

Exceptions

  com::sun::star::sdbc::SQLException | if a database access error occurs or the statement isn't a single select statement or the statement isn't valid or the statement can not be parsed.

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

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