LibreOffice Module dbaccess (master) 1
|
#include <DbAdminImpl.hxx>
Public Types | |
typedef std::map< sal_Int32, OUString > | MapInt2String |
Public Member Functions | |
ODbDataSourceAdministrationHelper (const css::uno::Reference< css::uno::XComponentContext > &_xORB, weld::Window *pParent, weld::Window *pTopParent, IItemSetHelper *_pItemSetHelper) | |
bool | getCurrentSettings (css::uno::Sequence< css::beans::PropertyValue > &_rDriverParams) |
translate the current dialog SfxItems into driver relevant PropertyValues More... | |
void | successfullyConnected () |
to be called if the settings got from getCurrentSettings have been used for successfully connecting More... | |
void | clearPassword () |
clear the password in the current data source's item set More... | |
const css::uno::Reference< css::uno::XComponentContext > & | getORB () const |
std::pair< css::uno::Reference< css::sdbc::XConnection >, bool > | createConnection () |
creates a new connection. More... | |
css::uno::Reference< css::sdbc::XDriver > | getDriver () |
return the corresponding driver for the selected URL More... | |
css::uno::Reference< css::sdbc::XDriver > | getDriver (const OUString &_sURL) |
css::uno::Reference< css::beans::XPropertySet > const & | getCurrentDataSource () |
returns the data source the dialog is currently working with More... | |
void | setDataSourceOrName (const css::uno::Any &_rDataSourceOrName) |
OUString | getConnectionURL () const |
returns the connection URL More... | |
const MapInt2String & | getIndirectProperties () const |
void | translateProperties (const css::uno::Reference< css::beans::XPropertySet > &_rxSource, SfxItemSet &_rDest) |
translates properties of a UNO data source into SfxItems More... | |
void | translateProperties (const SfxItemSet &_rSource, const css::uno::Reference< css::beans::XPropertySet > &_rxDest) |
translate SfxItems into properties of a UNO data source More... | |
bool | saveChanges (const SfxItemSet &_rSource) |
Static Public Member Functions | |
static OUString | getDocumentUrl (SfxItemSet const &_rDest) |
static OUString | getDatasourceType (const SfxItemSet &_rSet) |
extracts the connection type from the given setThe connection type is determined by the value of the DSN item, analyzed by the TypeCollection item. More... | |
static void | convertUrl (SfxItemSet &_rDest) |
fill the necessary information from the url line More... | |
Private Member Functions | |
void | fillDatasourceInfo (const SfxItemSet &_rSource, css::uno::Sequence< css::beans::PropertyValue > &_rInfo) |
fill a data source info array with the settings from a given item set More... | |
void | implTranslateProperty (SfxItemSet &_rSet, sal_Int32 _nId, const css::uno::Any &_rValue) |
translate the given value into an SfxPoolItem, put this into the given set under the given id More... | |
OString | translatePropertyId (sal_Int32 _nId) |
Static Private Member Functions | |
static css::uno::Any | implTranslateProperty (const SfxPoolItem *_pItem) |
translate the given SfxPoolItem into an <type scope="com.sun.star.Any">uno</type> More... | |
static void | implTranslateProperty (const css::uno::Reference< css::beans::XPropertySet > &_rxSet, const OUString &_rName, const SfxPoolItem *_pItem) |
translate the given SfxPoolItem into an <type scope="com.sun.star.Any">uno</type>, set it (under the given name) on the given property set More... | |
static bool | hasAuthentication (const SfxItemSet &_rSet) |
check if the data source described by the given set needs authenticationThe return value depends on the data source type only. More... | |
Private Attributes | |
css::uno::Reference< css::uno::XComponentContext > | m_xContext |
css::uno::Reference< css::sdb::XDatabaseContext > | m_xDatabaseContext |
service factory More... | |
css::uno::Reference< css::beans::XPropertySet > | m_xDatasource |
database context we're working in More... | |
css::uno::Reference< css::frame::XModel > | m_xModel |
css::uno::Any | m_aDataSourceOrName |
MapInt2String | m_aDirectPropTranslator |
MapInt2String | m_aIndirectPropTranslator |
translating property id's into names (direct properties of a data source) More... | |
weld::Window * | m_pParent |
translating property id's into names (indirect properties of a data source) More... | |
IItemSetHelper * | m_pItemSetHelper |
Definition at line 49 of file DbAdminImpl.hxx.
typedef std::map<sal_Int32, OUString> dbaui::ODbDataSourceAdministrationHelper::MapInt2String |
Definition at line 52 of file DbAdminImpl.hxx.
dbaui::ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper | ( | const css::uno::Reference< css::uno::XComponentContext > & | _xORB, |
weld::Window * | pParent, | ||
weld::Window * | pTopParent, | ||
IItemSetHelper * | _pItemSetHelper | ||
) |
initialize the property translation map
Definition at line 130 of file DbAdminImpl.cxx.
References DSID_ADDITIONALOPTIONS, DSID_ALLOWLONGTABLENAMES, DSID_APPEND_TABLE_ALIAS, DSID_AS_BEFORE_CORRNAME, DSID_AUTOINCREMENTVALUE, DSID_AUTORETRIEVEENABLED, DSID_AUTORETRIEVEVALUE, DSID_BOOLEANCOMPARISON, DSID_CATALOG, DSID_CHARSET, DSID_CHECK_REQUIRED_FIELDS, DSID_CONN_LDAP_BASEDN, DSID_CONN_LDAP_ROWCOUNT, DSID_CONN_LDAP_USESSL, DSID_CONN_SOCKET, DSID_CONNECTURL, DSID_DECIMALDELIMITER, DSID_DOCUMENT_URL, DSID_DOSLINEENDS, DSID_ENABLEOUTERJOIN, DSID_ESCAPE_DATETIME, DSID_FIELDDELIMITER, DSID_IGNORECURRENCY, DSID_IGNOREDRIVER_PRIV, DSID_INDEXAPPENDIX, DSID_JDBCDRIVERCLASS, DSID_MAX_ROW_SCAN, DSID_NAME, DSID_NAMED_PIPE, DSID_PARAMETERNAMESUBST, DSID_PASSWORD, DSID_PASSWORDREQUIRED, DSID_PRIMARY_KEY_SUPPORT, DSID_READONLY, DSID_RESPECTRESULTSETTYPE, DSID_SCHEMA, DSID_SHOWDELETEDROWS, DSID_SQL92CHECK, DSID_SUPPRESSVERSIONCL, DSID_TABLEFILTER, DSID_TEXTDELIMITER, DSID_TEXTFILEEXTENSION, DSID_TEXTFILEHEADER, DSID_THOUSANDSDELIMITER, DSID_USECATALOG, DSID_USER, Exception, INFO_ADDITIONALOPTIONS, INFO_ALLOWLONGTABLENAMES, INFO_APPEND_TABLE_ALIAS, INFO_AS_BEFORE_CORRELATION_NAME, INFO_AUTORETRIEVEENABLED, INFO_AUTORETRIEVEVALUE, INFO_CHARSET, INFO_CONN_LDAP_BASEDN, INFO_CONN_LDAP_ROWCOUNT, INFO_DECIMALDELIMITER, INFO_ESCAPE_DATETIME, INFO_FIELDDELIMITER, INFO_FORMS_CHECK_REQUIRED_FIELDS, INFO_IGNOREDRIVER_PRIV, INFO_JDBCDRIVERCLASS, INFO_PARAMETERNAMESUBST, INFO_SHOWDELETEDROWS, INFO_TEXTDELIMITER, INFO_TEXTFILEEXTENSION, INFO_TEXTFILEHEADER, INFO_THOUSANDSDELIMITER, INFO_USECATALOG, m_aDirectPropTranslator, m_aIndirectPropTranslator, m_xContext, m_xDatabaseContext, PROPERTY_AUTOINCREMENTCREATION(), PROPERTY_BOOLEANCOMPARISONMODE(), PROPERTY_ENABLEOUTERJOIN(), PROPERTY_ENABLESQL92CHECK(), PROPERTY_ISPASSWORDREQUIRED(), PROPERTY_ISREADONLY(), PROPERTY_NAME(), PROPERTY_PASSWORD(), PROPERTY_SUPPRESSVERSIONCL(), PROPERTY_TABLEFILTER(), PROPERTY_URL(), PROPERTY_USECATALOGINSELECT(), PROPERTY_USER(), PROPERTY_USESCHEMAINSELECT(), ShowServiceNotAvailableError(), and u.
void dbaui::ODbDataSourceAdministrationHelper::clearPassword | ( | ) |
clear the password in the current data source's item set
Definition at line 329 of file DbAdminImpl.cxx.
References SfxItemSet::ClearItem(), DSID_PASSWORD, dbaui::IItemSetHelper::getWriteOutputSet(), and m_pItemSetHelper.
|
static |
fill the necessary information from the url line
Definition at line 1004 of file DbAdminImpl.cxx.
References dbaccess::ODsnTypeCollection::determineType(), DSID_CONN_HOSTNAME, DSID_CONN_LDAP_PORTNUMBER, DSID_CONNECTURL, DSID_DATABASENAME, DSID_MYSQL_PORTNUMBER, DSID_ORACLE_PORTNUMBER, DSID_POSTGRES_PORTNUMBER, DSID_TYPECOLLECTION, dbaccess::DST_LDAP, dbaccess::DST_MYSQL_JDBC, dbaccess::DST_MYSQL_NATIVE, dbaccess::DST_ORACLE_JDBC, dbaccess::DST_POSTGRES, eType, dbaccess::ODsnTypeCollection::extractHostNamePort(), getDatasourceType(), SfxItemSet::GetItem(), dbaccess::ODsnTypeCollection::getPrefix(), CntUnencodedStringItem::GetValue(), and SfxItemSet::Put().
std::pair< Reference< XConnection >, bool > dbaui::ODbDataSourceAdministrationHelper::createConnection | ( | ) |
creates a new connection.
The caller is responsible to dispose it !!!!
Definition at line 335 of file DbAdminImpl.cxx.
References getConnectionURL(), getCurrentSettings(), getDriver(), getORB(), weld::Window::GetXWindow(), m_pParent, showError(), and successfullyConnected().
|
private |
fill a data source info array with the settings from a given item set
Definition at line 710 of file DbAdminImpl.cxx.
References Any, aProperties, DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID, eType, getDatasourceType(), SfxItemSet::GetItem(), getORB(), i, implTranslateProperty(), INFO_CHARSET, m_aIndirectPropTranslator, and nCount.
Referenced by getCurrentSettings().
OUString dbaui::ODbDataSourceAdministrationHelper::getConnectionURL | ( | ) | const |
returns the connection URL
Definition at line 447 of file DbAdminImpl.cxx.
References dbaccess::ODsnTypeCollection::cutPrefix(), dbaccess::ODsnTypeCollection::determineType(), DSID_CONN_HOSTNAME, DSID_CONN_LDAP_PORTNUMBER, DSID_CONNECTURL, DSID_DATABASENAME, DSID_MYSQL_PORTNUMBER, DSID_ORACLE_PORTNUMBER, DSID_POSTGRES_PORTNUMBER, DSID_TYPECOLLECTION, dbaccess::DST_CALC, dbaccess::DST_DBASE, dbaccess::DST_FLAT, dbaccess::DST_JDBC, dbaccess::DST_LDAP, dbaccess::DST_MSACCESS, dbaccess::DST_MSACCESS_2007, dbaccess::DST_MYSQL_JDBC, dbaccess::DST_MYSQL_NATIVE, dbaccess::DST_ORACLE_JDBC, dbaccess::DST_POSTGRES, dbaccess::DST_WRITER, eType, getDatasourceType(), SfxItemSet::GetItem(), dbaui::IItemSetHelper::getOutputSet(), dbaccess::ODsnTypeCollection::getPrefix(), CntUnencodedStringItem::GetValue(), m_pItemSetHelper, and comphelper::string::stripEnd().
Referenced by createConnection(), and getDriver().
Reference< XPropertySet > const & dbaui::ODbDataSourceAdministrationHelper::getCurrentDataSource | ( | ) |
returns the data source the dialog is currently working with
Definition at line 398 of file DbAdminImpl.cxx.
References Exception, dbaui::getDataSourceOrModel(), m_aDataSourceOrName, m_xDatabaseContext, m_xDatasource, and m_xModel.
Referenced by saveChanges(), and successfullyConnected().
bool dbaui::ODbDataSourceAdministrationHelper::getCurrentSettings | ( | css::uno::Sequence< css::beans::PropertyValue > & | _rDriverParams | ) |
translate the current dialog SfxItems into driver relevant PropertyValues
Definition at line 201 of file DbAdminImpl.cxx.
References Any, comphelper::containerToSequence(), DBA_RES, DBG_UNHANDLED_EXCEPTION, DSID_NAME, DSID_PASSWORD, DSID_PASSWORDREQUIRED, DSID_USER, Exception, fillDatasourceInfo(), dbaui::getDataSourceOrModel(), SfxItemSet::GetItem(), comphelper::NamedValueCollection::getOrDefault(), dbaui::IItemSetHelper::getOutputSet(), dbaui::getStrippedDatabaseName(), CntUnencodedStringItem::GetValue(), SfxBoolItem::GetValue(), dbaui::IItemSetHelper::getWriteOutputSet(), weld::Window::GetXWindow(), hasAuthentication(), m_pItemSetHelper, m_pParent, m_xContext, m_xDatasource, pName, SfxItemSet::Put(), sName, and xModel.
Referenced by createConnection().
|
static |
extracts the connection type from the given setThe connection type is determined by the value of the DSN item, analyzed by the TypeCollection item.
Definition at line 432 of file DbAdminImpl.cxx.
References DSID_CONNECTURL, DSID_TYPECOLLECTION, dbaui::DbuTypeCollectionItem::getCollection(), SfxItemSet::GetItem(), dbaccess::ODsnTypeCollection::getType(), and CntUnencodedStringItem::GetValue().
Referenced by dbaui::AdvancedSettingsDialog::AdvancedSettingsDialog(), convertUrl(), dbaui::ODriversSettings::CreateSpecialSettingsPage(), dbaui::ODbTypeWizDialogSetup::enterState(), fillDatasourceInfo(), getConnectionURL(), dbaui::AdvancedSettingsDialog::getDatasourceType(), dbaui::ODbAdminDialog::getDatasourceType(), dbaui::ODbTypeWizDialog::getDatasourceType(), dbaui::ODbTypeWizDialogSetup::getDatasourceType(), dbaui::OUserAdminDlg::getDatasourceType(), hasAuthentication(), and dbaui::ODbTypeWizDialog::ODbTypeWizDialog().
|
static |
Definition at line 997 of file DbAdminImpl.cxx.
References DSID_DOCUMENT_URL, SfxItemSet::GetItem(), and CntUnencodedStringItem::GetValue().
Referenced by dbaui::ODbTypeWizDialogSetup::SaveDatabaseDocument().
Reference< XDriver > dbaui::ODbDataSourceAdministrationHelper::getDriver | ( | ) |
return the corresponding driver for the selected URL
Definition at line 363 of file DbAdminImpl.cxx.
References getConnectionURL(), and getDriver().
Referenced by createConnection(), and getDriver().
Reference< XDriver > dbaui::ODbDataSourceAdministrationHelper::getDriver | ( | const OUString & | _sURL | ) |
Definition at line 368 of file DbAdminImpl.cxx.
References Any, DBA_RES, Exception, cppu::getCaughtException(), and getORB().
|
inline |
Definition at line 120 of file DbAdminImpl.hxx.
References m_aIndirectPropTranslator.
|
inline |
Definition at line 87 of file DbAdminImpl.hxx.
References m_xContext.
Referenced by createConnection(), fillDatasourceInfo(), and getDriver().
|
staticprivate |
check if the data source described by the given set needs authenticationThe return value depends on the data source type only.
Definition at line 442 of file DbAdminImpl.cxx.
References dbaui::AuthNone, dbaui::DataSourceMetaData::getAuthentication(), and getDatasourceType().
Referenced by getCurrentSettings(), and successfullyConnected().
|
staticprivate |
translate the given SfxPoolItem into an <type scope="com.sun.star.Any">uno</type>, set it (under the given name) on the given property set
|
staticprivate |
translate the given SfxPoolItem into an <type scope="com.sun.star.Any">uno</type>
Definition at line 831 of file DbAdminImpl.cxx.
References Any, dbaui::OStringListItem::getList(), dbaui::OptionalBoolItem::GetValue(), CntInt32Item::GetValue(), CntUnencodedStringItem::GetValue(), SfxBoolItem::GetValue(), and dbaui::OptionalBoolItem::HasValue().
|
private |
translate the given value into an SfxPoolItem, put this into the given set under the given id
Referenced by fillDatasourceInfo().
bool dbaui::ODbDataSourceAdministrationHelper::saveChanges | ( | const SfxItemSet & | _rSource | ) |
Definition at line 1064 of file DbAdminImpl.cxx.
References getCurrentDataSource(), and translateProperties().
void dbaui::ODbDataSourceAdministrationHelper::setDataSourceOrName | ( | const css::uno::Any & | _rDataSourceOrName | ) |
Definition at line 1076 of file DbAdminImpl.cxx.
References m_aDataSourceOrName.
void dbaui::ODbDataSourceAdministrationHelper::successfullyConnected | ( | ) |
to be called if the settings got from getCurrentSettings have been used for successfully connecting
Definition at line 310 of file DbAdminImpl.cxx.
References Any, DSID_PASSWORD, getCurrentDataSource(), SfxItemSet::GetItem(), dbaui::IItemSetHelper::getOutputSet(), CntUnencodedStringItem::GetValue(), hasAuthentication(), m_aDirectPropTranslator, and m_pItemSetHelper.
Referenced by createConnection().
void dbaui::ODbDataSourceAdministrationHelper::translateProperties | ( | const css::uno::Reference< css::beans::XPropertySet > & | _rxSource, |
SfxItemSet & | _rDest | ||
) |
translates properties of a UNO data source into SfxItems
_rxSource | The data source |
_rDest | The item set to fill. |
Referenced by saveChanges().
void dbaui::ODbDataSourceAdministrationHelper::translateProperties | ( | const SfxItemSet & | _rSource, |
const css::uno::Reference< css::beans::XPropertySet > & | _rxDest | ||
) |
translate SfxItems into properties of a UNO data source
_rSource | The item set to read from. |
_rxDest | The data source to fill. |
|
private |
Definition at line 880 of file DbAdminImpl.cxx.
References m_aDirectPropTranslator, m_aIndirectPropTranslator, and OUStringToOString().
|
private |
Definition at line 62 of file DbAdminImpl.hxx.
Referenced by getCurrentDataSource(), and setDataSourceOrName().
|
private |
Definition at line 64 of file DbAdminImpl.hxx.
Referenced by ODbDataSourceAdministrationHelper(), successfullyConnected(), and translatePropertyId().
|
private |
translating property id's into names (direct properties of a data source)
Definition at line 65 of file DbAdminImpl.hxx.
Referenced by fillDatasourceInfo(), getIndirectProperties(), ODbDataSourceAdministrationHelper(), and translatePropertyId().
|
private |
Definition at line 67 of file DbAdminImpl.hxx.
Referenced by clearPassword(), getConnectionURL(), getCurrentSettings(), and successfullyConnected().
|
private |
translating property id's into names (indirect properties of a data source)
Definition at line 66 of file DbAdminImpl.hxx.
Referenced by createConnection(), and getCurrentSettings().
|
private |
Definition at line 56 of file DbAdminImpl.hxx.
Referenced by getCurrentSettings(), getORB(), and ODbDataSourceAdministrationHelper().
|
private |
service factory
Definition at line 58 of file DbAdminImpl.hxx.
Referenced by getCurrentDataSource(), and ODbDataSourceAdministrationHelper().
|
private |
database context we're working in
Definition at line 59 of file DbAdminImpl.hxx.
Referenced by getCurrentDataSource(), and getCurrentSettings().
|
private |
Definition at line 60 of file DbAdminImpl.hxx.
Referenced by getCurrentDataSource().