LibreOffice
LibreOffice 7.4 SDK API Reference
Public Member Functions | List of all members
CopyTableWizard Service Reference

describes a wizard which can be used to copy table like data from one database to another. More...

import"CopyTableWizard.idl";

Inheritance diagram for CopyTableWizard:
XCopyTableWizard XExecutableDialog XInterface

Public Member Functions

 create ([in] ::com::sun::star::beans::XPropertySet Source, [in] ::com::sun::star::beans::XPropertySet Destination) raises ( ::com::sun::star::lang::IllegalArgumentException , ::com::sun::star::sdbc::SQLException , ::com::sun::star::lang::WrappedTargetException )
 creates an executable wizard dialog, which is to guide the user through copying a table from one database to another. More...
 
 createWithInteractionHandler ([in] ::com::sun::star::beans::XPropertySet Source, [in] ::com::sun::star::beans::XPropertySet Destination, [in] ::com::sun::star::task::XInteractionHandler InteractionHandler) raises ( ::com::sun::star::lang::IllegalArgumentException , ::com::sun::star::sdbc::SQLException , ::com::sun::star::lang::WrappedTargetException )
 creates an executable wizard dialog, which is to guide the user through copying a table from one database to another. More...
 
- Public Member Functions inherited from XCopyTableWizard
void addCopyTableListener ([in] XCopyTableListener Listener)
 adds a listener which is to be notified of progress in the copy operation More...
 
void removeCopyTableListener ([in] XCopyTableListener Listener)
 removes a listener More...
 
- Public Member Functions inherited from XExecutableDialog
void setTitle ([in] string aTitle)
 Sets the title of the dialog. More...
 
short execute ()
 Executes (shows) the dialog. 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...
 

Additional Inherited Members

- Public Attributes inherited from XCopyTableWizard
short Operation { set raises(::com::sun::star::lang::IllegalArgumentException); }
 specifies the basic operation for the wizard to execute. More...
 
string DestinationTableName
 specifies the name of the table in the destination database. More...
 
::com::sun::star::beans::Optional< string > CreatePrimaryKey { set raises(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException); }
 specifies that a new primary key is to be created in the target database More...
 
boolean UseHeaderLineAsColumnNames
 specifies that the first row should be used to identify column names. More...
 

Detailed Description

describes a wizard which can be used to copy table like data from one database to another.

Interactions

There are various cases where the wizard needs to interact with the user (except of course the obvious case to display and operate the wizard dialog itself). For those cases, an interaction handler is needed, which is used for

  • fulfilling parameter requests. This might become necessary if the copy source describes a parametrized query.
  • user interaction in case copying a row fails. If no copy table listener is registered at the wizard, or none of the registered listener handles an error during copying a row, or a registered listeners explicitly tells the wizard to ask the user how to handle the error, then the interaction handler is used together with the error (an SQLException, usually) that happened.
  • displaying other errors which happen during copying, in particular errors in creating the target table or view.

When you do not specify an interaction handler by using the createWithInteractionHandler() constructor, the wizard will use the interaction handler associated with the copy target, i.e. the interaction handler specified when loading the document which the copy target refers to. If the copy target cannot be associated with a database document (e.g. because it is a mere ConnectionResource, or a connection not obtained from a data source), or if the copy target's database document cannot provide an interaction handler, a newly-created instance of an interaction handler is used.

There's one exception to the above, however: Upon creating the copy table wizard, the copy source and the copy target descriptors are used to create a Connection. For any interaction during this phase - including, for instance, necessary authentication -, the interaction handler of the respective data source is used, no matter what you specified in createWithInteractionHandler(). Only if there is no such interaction handler, the processing described above, to find another handler, is applied.

See also
com::sun::star::sdb::ParametersRequest
XCopyTableWizard::addCopyTableListener
CopyTableContinuation
com::sun::star::document::MediaDescriptor::InteractionHandler
com::sun::star::sdb::DatabaseDocument
com::sun::star::sdb::DataSource
com::sun::star::sdb::DataAccessDescriptor::ConnectionResource
com::sun::star::sdb::InteractionHandler
Since
OOo 2.4

Member Function Documentation

◆ create()

creates an executable wizard dialog, which is to guide the user through copying a table from one database to another.

At creation time, an attempt will be made to obtain the connections described by Source resp. Dest. Failing to do so will result in an exception.

If the connection has been newly created by the wizard (e.g. because the data access descriptor specified a DataSource instead of an ActiveConnection), then this connection will be disposed upon disposal of the wizard.

Parameters
Sourcethe com::sun::star::sdb::DataAccessDescriptor describing the data to copy.

The following members of the DataAccessDescriptor are supported, and evaluated in the given order:

  1. ActiveConnection
  2. DataSourceName
  3. DatabaseLocation
  4. ConnectionResource
  5. ConnectionInfo
  6. Command
  7. CommandType

The first 5 items are used to obtain the connection, the last two to determine which of the connection's objects is to be copied. Note that Command and CommandType are required.

Additionally to the obvious restrictions (such as that creating a view is not possible if the copy source and the copy destination denote different databases), the following restrictions apply to the settings, and possible combinations:

Violating any of the above restrictions will result in an error at creation time.

Parameters
Destinationthe com::sun::star::sdb::DataAccessDescriptor describing the target for the copy operation.

Only DataSourceName, DatabaseLocation, ActiveConnection are supported, effectively describing the target connection to copy the data to. They're evaluated in the order mentioned here, so if multiple of the are present, only the first one is evaluated.

Also, at the moment the connection which is implied by either of the settings above must support the com::sun::star::sdb::Connection service. In particular, it is not sufficient to pass an SDBC-level connection.

Note that creating a view (see CopyTableOperation::CreateAsView) is not supported if the target connection is an SDBC-level connection only.

Exceptions
com::sun::star::lang::IllegalArgumentExceptionif
  • either Source or Destination is NULL
  • either Source or Destination are not sufficient to describe a database connection.
  • Source is not sufficient to describe the to-be-copied data
  • either Source or Destination contain unsupported settings.
com::sun::star::sdbc::SQLExceptionif an error occurs during obtaining the source or destination connection. Those errors are passed unchanged to the creator of the wizard.
com::sun::star::lang::WrappedTargetExceptionif an error other than the ones mentioned above occurs while extracting the necessary information from any of the data access descriptors. For instance, this might be a com::sun::star::sdbc::SQLException thrown upon connecting to a data source described by the descriptor's DataSourceName member.
See also
com::sun::star::sdb::DataAccessDescriptor

◆ createWithInteractionHandler()

creates an executable wizard dialog, which is to guide the user through copying a table from one database to another.

The only difference to the create() constructor is that createWithInteractionHandler takes an additional argument, which can be used to intercept interactions (such as error messages) during the wizard run.

Parameters
Sourcethe com::sun::star::sdb::DataAccessDescriptor describing the source for the copy operation.
Destinationthe com::sun::star::sdb::DataAccessDescriptor describing the target for the copy operation.
InteractionHandlerspecifies an interaction handler to use when user input is required.

When specifying this parameter, you should use an implementation supporting the com::sun::star::sdb::InteractionHandler, since the general-purpose com::sun::star::task::InteractionHandler cannot handle all requests described above.

See also
com::sun::star::sdb::InteractionHandler

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