summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
commit595834be2b412b1bac89ec77e9094b469e03fabf (patch)
treebe16f2beccb1f234e38b4a6a0f724e8e8be2995e /dbaccess/source
parent23008295d477858ad815392b81f91d185adee1a8 (diff)
parent27ba5712df7e35706b422e9a86369f45c7cf159b (diff)
merge commit to DEV300_m57
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/core/api/BookmarkSet.cxx6
-rw-r--r--dbaccess/source/core/api/CacheSet.cxx105
-rw-r--r--dbaccess/source/core/api/CacheSet.hxx9
-rw-r--r--dbaccess/source/core/api/KeySet.cxx260
-rw-r--r--dbaccess/source/core/api/KeySet.hxx4
-rw-r--r--dbaccess/source/core/api/RowSet.cxx17
-rw-r--r--dbaccess/source/core/api/RowSet.hxx1
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx6
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx242
-rw-r--r--dbaccess/source/core/api/RowSetCache.hxx4
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx131
-rw-r--r--dbaccess/source/core/api/resultset.cxx2422
-rw-r--r--dbaccess/source/core/api/statement.cxx51
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx3
-rw-r--r--dbaccess/source/core/dataaccess/connection.cxx6
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx5
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx3
-rw-r--r--dbaccess/source/core/inc/SingleSelectQueryComposer.hxx4
-rw-r--r--dbaccess/source/core/inc/core_resource.hrc3
-rw-r--r--dbaccess/source/core/inc/statement.hxx16
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx767
-rw-r--r--dbaccess/source/core/resource/strings.src200
-rw-r--r--dbaccess/source/ext/macromigration/makefile.mk1
-rw-r--r--dbaccess/source/filter/xml/makefile.mk2
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx28
-rw-r--r--dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx3
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx174
-rw-r--r--dbaccess/source/inc/dbustrings.hrc1
-rw-r--r--dbaccess/source/inc/dsntypes.hxx90
-rw-r--r--dbaccess/source/sdbtools/resource/sdbt_strings.src2
-rw-r--r--dbaccess/source/shared/dbustrings.cxx1
-rw-r--r--dbaccess/source/ui/app/AppController.cxx54
-rw-r--r--dbaccess/source/ui/app/AppControllerDnD.cxx72
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx86
-rw-r--r--dbaccess/source/ui/browser/dbexchange.cxx18
-rw-r--r--dbaccess/source/ui/browser/dsEntriesNoExp.cxx4
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx38
-rw-r--r--dbaccess/source/ui/browser/sbagrid.src4
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx121
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx3
-rw-r--r--dbaccess/source/ui/control/RelationControl.cxx11
-rw-r--r--dbaccess/source/ui/control/curledit.cxx13
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx41
-rw-r--r--dbaccess/source/ui/control/toolboxcontroller.cxx3
-rw-r--r--dbaccess/source/ui/dlg/AdabasStatDlg.cxx208
-rw-r--r--dbaccess/source/ui/dlg/AdabasStatDlg.hrc36
-rw-r--r--dbaccess/source/ui/dlg/AdabasStatDlg.src64
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx67
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.hxx4
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx32
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.hxx2
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPageSetup.cxx26
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx63
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx1
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx85
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.hxx12
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.cxx101
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.hxx2
-rw-r--r--dbaccess/source/ui/dlg/UserAdminDlg.cxx2
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx4
-rw-r--r--dbaccess/source/ui/dlg/adminpages.hxx2
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx8
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.cxx8
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.hxx1
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx14
-rw-r--r--dbaccess/source/ui/dlg/dbwiz.cxx38
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx391
-rw-r--r--dbaccess/source/ui/dlg/detailpages.cxx18
-rw-r--r--dbaccess/source/ui/dlg/detailpages.hxx2
-rw-r--r--dbaccess/source/ui/dlg/dsselect.cxx6
-rw-r--r--dbaccess/source/ui/dlg/dsselect.hxx2
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx175
-rw-r--r--dbaccess/source/ui/dlg/generalpage.hxx18
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx3
-rw-r--r--dbaccess/source/ui/dlg/makefile.mk4
-rw-r--r--dbaccess/source/ui/dlg/odbcconfig.cxx4
-rw-r--r--dbaccess/source/ui/dlg/queryfilter.cxx13
-rw-r--r--dbaccess/source/ui/dlg/sqlmessage.cxx9
-rw-r--r--dbaccess/source/ui/inc/AdabasStatDlg.hxx99
-rw-r--r--dbaccess/source/ui/inc/IItemSetHelper.hxx2
-rw-r--r--dbaccess/source/ui/inc/IUpdateHelper.hxx7
-rw-r--r--dbaccess/source/ui/inc/TableController.hxx2
-rw-r--r--dbaccess/source/ui/inc/TableFieldDescription.hxx5
-rw-r--r--dbaccess/source/ui/inc/TokenWriter.hxx2
-rw-r--r--dbaccess/source/ui/inc/UserAdminDlg.hxx2
-rw-r--r--dbaccess/source/ui/inc/WCPage.hxx10
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx3
-rw-r--r--dbaccess/source/ui/inc/advancedsettingsdlg.hxx4
-rw-r--r--dbaccess/source/ui/inc/brwctrlr.hxx13
-rw-r--r--dbaccess/source/ui/inc/curledit.hxx7
-rw-r--r--dbaccess/source/ui/inc/dbadmin.hxx2
-rw-r--r--dbaccess/source/ui/inc/dbexchange.hxx5
-rw-r--r--dbaccess/source/ui/inc/dbu_misc.hrc5
-rw-r--r--dbaccess/source/ui/inc/dbu_resource.hrc2
-rw-r--r--dbaccess/source/ui/inc/dbwiz.hxx6
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx12
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx7
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hxx7
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx1
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx48
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx3
-rw-r--r--dbaccess/source/ui/misc/RtfReader.cxx7
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx148
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx3
-rw-r--r--dbaccess/source/ui/misc/UpdateHelperImpl.hxx27
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx13
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx3
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx13
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx11
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx3
-rw-r--r--dbaccess/source/ui/misc/WizardPages.hrc1
-rw-r--r--dbaccess/source/ui/misc/WizardPages.src23
-rw-r--r--dbaccess/source/ui/misc/dbumiscres.src6
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx235
-rw-r--r--dbaccess/source/ui/misc/indexcollection.cxx12
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx3
-rw-r--r--dbaccess/source/ui/misc/uiservices.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx5
-rw-r--r--dbaccess/source/ui/querydesign/JoinController.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/JoinExchange.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx41
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx236
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx36
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx64
-rw-r--r--dbaccess/source/ui/querydesign/TableConnection.cxx12
-rw-r--r--dbaccess/source/ui/querydesign/TableConnectionData.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowAccess.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/query.src48
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx7
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnection.cxx3
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx12
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx5
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx3
-rw-r--r--dbaccess/source/ui/relationdesign/relation.src2
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx12
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx23
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx25
-rw-r--r--dbaccess/source/ui/tabledesign/TableRowExchange.cxx3
-rw-r--r--dbaccess/source/ui/tabledesign/TableUndo.cxx9
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx34
-rw-r--r--dbaccess/source/ui/uno/makefile.mk8
-rw-r--r--dbaccess/source/ui/uno/unoadmin.cxx3
143 files changed, 3846 insertions, 3994 deletions
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx
index b96c1eaf7..74b925f47 100644
--- a/dbaccess/source/core/api/BookmarkSet.cxx
+++ b/dbaccess/source/core/api/BookmarkSet.cxx
@@ -129,7 +129,8 @@ void SAL_CALL OBookmarkSet::insertRow( const ORowSetRow& _rInsertRow,const conne
{
xUpd->moveToInsertRow();
sal_Int32 i = 1;
- for(connectivity::ORowVector< ORowSetValue > ::Vector::iterator aIter = _rInsertRow->get().begin()+1;aIter != _rInsertRow->get().end();++aIter,++i)
+ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
+ for(connectivity::ORowVector< ORowSetValue > ::Vector::iterator aIter = _rInsertRow->get().begin()+1;aIter != aEnd;++aIter,++i)
{
aIter->setSigned(m_aSignedFlags[i-1]);
updateColumn(i,xUpdRow,*aIter);
@@ -151,7 +152,8 @@ void SAL_CALL OBookmarkSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowS
sal_Int32 i = 1;
connectivity::ORowVector< ORowSetValue > ::Vector::const_iterator aOrgIter = _rOrginalRow->get().begin()+1;
- for(connectivity::ORowVector< ORowSetValue > ::Vector::iterator aIter = _rInsertRow->get().begin()+1;aIter != _rInsertRow->get().end();++aIter,++i,++aOrgIter)
+ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
+ for(connectivity::ORowVector< ORowSetValue > ::Vector::iterator aIter = _rInsertRow->get().begin()+1;aIter != aEnd;++aIter,++i,++aOrgIter)
{
aIter->setSigned(aOrgIter->isSigned());
updateColumn(i,xUpdRow,*aIter);
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index 1c5e07a7c..796cf39f4 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -88,6 +88,7 @@
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
+#include <rtl/ustrbuf.hxx>
#include <rtl/logfile.hxx>
using namespace comphelper;
@@ -205,36 +206,37 @@ void OCacheSet::fillTableName(const Reference<XPropertySet>& _xTable) throw(SQL
void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::insertRow" );
- ::rtl::OUString aSql(::rtl::OUString::createFromAscii("INSERT INTO "));
+ ::rtl::OUStringBuffer aSql(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT INTO ")));
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" ( ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" ( "));
// set values and column names
- ::rtl::OUString aValues = ::rtl::OUString::createFromAscii(" VALUES ( ");
- static ::rtl::OUString aPara = ::rtl::OUString::createFromAscii("?,");
+ ::rtl::OUStringBuffer aValues = ::rtl::OUString::createFromAscii(" VALUES ( ");
+ static ::rtl::OUString aPara(RTL_CONSTASCII_USTRINGPARAM("?,"));
::rtl::OUString aQuote = getIdentifierQuoteString();
- static ::rtl::OUString aComma = ::rtl::OUString::createFromAscii(",");
+ static ::rtl::OUString aComma(RTL_CONSTASCII_USTRINGPARAM(","));
sal_Int32 i = 1;
ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1;
- for(; aIter != _rInsertRow->get().end();++aIter)
+ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
+ for(; aIter != aEnd;++aIter)
{
- aSql += ::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++));
- aSql += aComma;
- aValues += aPara;
+ aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)));
+ aSql.append(aComma);
+ aValues.append(aPara);
}
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")"));
- aValues = aValues.replaceAt(aValues.getLength()-1,1,::rtl::OUString::createFromAscii(")"));
+ aSql.setCharAt(aSql.getLength()-1,')');
+ aValues.setCharAt(aValues.getLength()-1,')');
- aSql += aValues;
+ aSql.append(aValues.makeStringAndClear());
// now create end execute the prepared statement
{
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
i = 1;
- for(aIter = _rInsertRow->get().begin()+1; aIter != _rInsertRow->get().end();++aIter,++i)
+ for(aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter,++i)
{
if(aIter->isNull())
xParameter->setNull(i,aIter->getTypeKind());
@@ -265,8 +267,8 @@ void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connecti
// -------------------------------------------------------------------------
void OCacheSet::fillParameters( const ORowSetRow& _rRow
,const connectivity::OSQLTable& _xTable
- ,::rtl::OUString& _sCondition
- ,::rtl::OUString& _sParameter
+ ,::rtl::OUStringBuffer& _sCondition
+ ,::rtl::OUStringBuffer& _sParameter
,::std::list< sal_Int32>& _rOrgValues)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillParameters" );
@@ -330,6 +332,9 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow
sal_Int32 nCheckCount = 1; // index for the orginal values
sal_Int32 i = 1;
+
+ ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL"));
+ ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rRow->get().begin()+1;
ORowVector< ORowSetValue >::Vector::const_iterator aEnd = _rRow->get().end()+1;
for(; aIter != aEnd;++aIter,++nCheckCount,++i)
@@ -337,34 +342,35 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow
aColumnName = m_xSetMetaData->getColumnName(i);
if(xKeyColumns.is() && xKeyColumns->hasByName(aColumnName))
{
- _sCondition += ::dbtools::quoteName( aQuote,aColumnName);
+ _sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
if(aIter->isNull())
- _sCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ _sCondition.append(sIsNull);
else
- _sCondition += ::rtl::OUString::createFromAscii(" = ?");
- _sCondition += aAnd;
+ _sCondition.append(sParam);
+ _sCondition.append(aAnd);
_rOrgValues.push_back(nCheckCount);
- }
+ } // if(xKeyColumns.is() && xKeyColumns->hasByName(aColumnName))
+ ::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end();
for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin();
- aIndexIter != aAllIndexColumns.end();++aIndexIter)
+ aIndexIter != aIndexEnd;++aIndexIter)
{
if((*aIndexIter)->hasByName(aColumnName))
{
- _sCondition += ::dbtools::quoteName( aQuote,aColumnName);
+ _sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
if(aIter->isNull())
- _sCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ _sCondition.append(sIsNull);
else
- _sCondition += ::rtl::OUString::createFromAscii(" = ?");
- _sCondition += aAnd;
+ _sCondition.append(sParam);
+ _sCondition.append(aAnd);
_rOrgValues.push_back(nCheckCount);
break;
}
}
if(aIter->isModified())
{
- _sParameter += ::dbtools::quoteName( aQuote,aColumnName);
- _sParameter += aPara;
+ _sParameter.append(::dbtools::quoteName( aQuote,aColumnName));
+ _sParameter.append(aPara);
}
}
}
@@ -375,39 +381,41 @@ void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetR
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("UPDATE ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" SET ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("UPDATE ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" SET "));
// list all cloumns that should be set
- ::rtl::OUString aCondition;
+ ::rtl::OUStringBuffer aCondition;
::std::list< sal_Int32> aOrgValues;
fillParameters(_rInsertRow,_xTable,aCondition,aSql,aOrgValues);
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(" "));
+ aSql.setCharAt(aSql.getLength()-1,' ');
if ( aCondition.getLength() )
{
- aCondition = aCondition.replaceAt(aCondition.getLength()-5,5,::rtl::OUString::createFromAscii(" "));
+ aCondition.setLength(aCondition.getLength()-5);
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
- aSql += aCondition;
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
+ aSql.append(aCondition.makeStringAndClear());
}
else
::dbtools::throwSQLException(
DBACORE_RESSTRING( RID_STR_NO_UPDATE_MISSING_CONDITION ), SQL_GENERAL_ERROR, *this );
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
sal_Int32 i = 1;
- for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != _rInsertRow->get().end();++aIter)
+ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
+ for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter)
{
if(aIter->isModified())
{
setParameter(i,xParameter,*aIter,m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
++i;
}
- }
- for(::std::list< sal_Int32>::const_iterator aOrgValue = aOrgValues.begin(); aOrgValue != aOrgValues.end();++aOrgValue,++i)
+ } // for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter)
+ ::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
+ for(::std::list< sal_Int32>::const_iterator aOrgValue = aOrgValues.begin(); aOrgValue != aOrgValueEnd;++aOrgValue,++i)
{
setParameter(i,xParameter,(_rOrginalRow->get())[*aOrgValue],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
}
@@ -421,9 +429,9 @@ void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connecti
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
// list all cloumns that should be set
::rtl::OUString aQuote = getIdentifierQuoteString();
@@ -480,17 +488,18 @@ void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connecti
}
}
- ::rtl::OUString aColumnName;
+ ::rtl::OUStringBuffer aColumnName;
::std::list< sal_Int32> aOrgValues;
fillParameters(_rDeleteRow,_xTable,aSql,aColumnName,aOrgValues);
- aSql = aSql.replaceAt(aSql.getLength()-5,5,::rtl::OUString::createFromAscii(" "));
+ aSql.setLength(aSql.getLength()-5);
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
sal_Int32 i = 1;
- for(::std::list< sal_Int32>::const_iterator j = aOrgValues.begin(); j != aOrgValues.end();++j,++i)
+ ::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
+ for(::std::list< sal_Int32>::const_iterator j = aOrgValues.begin(); j != aOrgValueEnd;++j,++i)
{
setParameter(i,xParameter,(_rDeleteRow->get())[*j],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
}
diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx
index a009fa6e3..8d765e6db 100644
--- a/dbaccess/source/core/api/CacheSet.hxx
+++ b/dbaccess/source/core/api/CacheSet.hxx
@@ -65,7 +65,10 @@
#endif
#include <list>
-
+namespace rtl
+{
+ class OUStringBuffer;
+}
namespace com{ namespace sun { namespace star{namespace sdbc{ class XParameters; } } } }
namespace dbaccess
@@ -98,8 +101,8 @@ namespace dbaccess
);
void fillParameters( const ORowSetRow& _rRow
,const connectivity::OSQLTable& _xTable
- ,::rtl::OUString& _sCondition
- ,::rtl::OUString& _sParameter
+ ,::rtl::OUStringBuffer& _sCondition
+ ,::rtl::OUStringBuffer& _sParameter
,::std::list< sal_Int32>& _rOrgValues);
void fillTableName(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 785cba4df..56c87c7b5 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -157,8 +157,10 @@ DBG_NAME(OKeySet)
OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
const Reference< XIndexAccess>& _xTableKeys,
const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name
- const Reference< XSingleSelectQueryAnalyzer >& _xComposer)
- :m_pKeyColumnNames(NULL)
+ const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
+ const ORowSetValueVector& _aParameterValueForCache)
+ :m_aParameterValueForCache(_aParameterValueForCache)
+ ,m_pKeyColumnNames(NULL)
,m_pColumnNames(NULL)
,m_pForeignColumnNames(NULL)
,m_xTable(_xTable)
@@ -213,7 +215,8 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
::dbaccess::getColumnPositions(xSup->getColumns(),xSourceColumns,m_sUpdateTableName,(*m_pColumnNames));
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
- for(;aPosIter != (*m_pKeyColumnNames).end();++aPosIter)
+ SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter)
{
if(xSourceColumns->hasByName(aPosIter->first))
{
@@ -234,7 +237,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData();
::rtl::OUString aQuote = getIdentifierQuoteString();
- ::rtl::OUString aFilter;
+ ::rtl::OUStringBuffer aFilter;
::rtl::OUString sCatalog,sSchema,sTable;
Reference<XPropertySet> xTableProp(m_xTable,UNO_QUERY);
@@ -252,16 +255,16 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM("."));
static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
// create the where clause
- SelectColumnsMetaData::const_iterator aIter;
- for(aIter = (*m_pKeyColumnNames).begin();aIter != (*m_pKeyColumnNames).end();)
+ aPosEnd = (*m_pKeyColumnNames).end();
+ for(aPosIter = (*m_pKeyColumnNames).begin();aPosIter != aPosEnd;)
{
- aFilter += sComposedName;
- aFilter += s_sDot;
- aFilter += ::dbtools::quoteName( aQuote,aIter->first);
- aFilter += s_sParam;
- ++aIter;
- if(aIter != (*m_pKeyColumnNames).end())
- aFilter += aAnd;
+ aFilter.append(sComposedName);
+ aFilter.append(s_sDot);
+ aFilter.append(::dbtools::quoteName( aQuote,aPosIter->first));
+ aFilter.append(s_sParam);
+ ++aPosIter;
+ if(aPosIter != aPosEnd)
+ aFilter.append(aAnd);
}
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
@@ -293,18 +296,23 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
// look for columns not in the source columns to use them as filter as well
if ( !xSourceColumns->hasByName(*pSelectColumnName) )
{
- aFilter += s_sDot;
- aFilter += ::dbtools::quoteName( aQuote,*pSelectColumnName);
- aFilter += s_sParam;
+ aFilter.append(s_sDot);
+ aFilter.append(::dbtools::quoteName( aQuote,*pSelectColumnName));
+ aFilter.append(s_sParam);
if ( (pSelectColumnName+1) != pSelectColumnEnd )
- aFilter += aAnd;
+ aFilter.append(aAnd);
}
}
break;
}
}
+ } // if ( aSeq.getLength() > 1 ) // special handling for join
+ const ::rtl::OUString sOldFilter = xAnalyzer->getFilter();
+ if ( sOldFilter.getLength() )
+ {
+ aFilter = sOldFilter + aAnd + aFilter.makeStringAndClear();
}
- xAnalyzer->setFilter(aFilter);
+ xAnalyzer->setFilter(aFilter.makeStringAndClear());
m_xStatement = m_xConnection->prepareStatement(xAnalyzer->getQueryWithSubstitution());
::comphelper::disposeComponent(xAnalyzer);
}
@@ -368,12 +376,12 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
// list all cloumns that should be set
- ::rtl::OUString aQuote = getIdentifierQuoteString();
+ const ::rtl::OUString aQuote = getIdentifierQuoteString();
static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
static ::rtl::OUString aOr = ::rtl::OUString::createFromAscii(" OR ");
static ::rtl::OUString aEqual = ::rtl::OUString::createFromAscii(" = ?");
@@ -383,16 +391,18 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
// first the keys
Reference<XNameAccess> xKeyColumns = getKeyColumns();
- ::rtl::OUString aCondition = ::rtl::OUString::createFromAscii("( ");
+ ::rtl::OUStringBuffer aCondition = ::rtl::OUString::createFromAscii("( ");
SelectColumnsMetaData::const_iterator aIter = (*m_pKeyColumnNames).begin();
- for(;aIter != (*m_pKeyColumnNames).end();++aIter)
+ SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ for(;aIter != aPosEnd;++aIter)
{
- aCondition += ::dbtools::quoteName( aQuote,aIter->first);
- aCondition += aEqual;
- aCondition += aAnd;
+ aCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ aCondition.append(aEqual);
+ aCondition.append(aAnd);
}
- aCondition = aCondition.replaceAt(aCondition.getLength()-5,5,::rtl::OUString::createFromAscii(" )"));
+ aCondition.setLength(aCondition.getLength()-5);
+ const ::rtl::OUString sCon( aCondition.makeStringAndClear() );
const Any* pBegin = rows.getConstArray();
const Any* pEnd = pBegin + rows.getLength();
@@ -400,14 +410,14 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
Sequence< Any > aKeys;
for(;pBegin != pEnd;++pBegin)
{
- aSql += aCondition;
- aSql += aOr;
+ aSql.append(sCon);
+ aSql.append(aOr);
}
- aSql = aSql.replaceAt(aSql.getLength()-3,3,::rtl::OUString::createFromAscii(" "));
+ aSql.setLength(aSql.getLength()-3);
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
pBegin = rows.getConstArray();
@@ -418,8 +428,9 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
if(m_aKeyIter != m_aKeyMap.end())
{
connectivity::ORowVector< ORowSetValue >::Vector::iterator aKeyIter = m_aKeyIter->second.first->get().begin();
+ connectivity::ORowVector< ORowSetValue >::Vector::iterator aKeyEnd = m_aKeyIter->second.first->get().end();
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
- for(sal_uInt16 j = 0;aKeyIter != m_aKeyIter->second.first->get().end();++aKeyIter,++j,++aPosIter)
+ for(sal_uInt16 j = 0;aKeyIter != aKeyEnd;++aKeyIter,++j,++aPosIter)
{
setParameter(i++,xParameter,*aKeyIter,aPosIter->second.nType,aPosIter->second.nScale);
}
@@ -453,13 +464,15 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("UPDATE ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" SET ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("UPDATE ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" SET "));
// list all cloumns that should be set
static ::rtl::OUString aPara = ::rtl::OUString::createFromAscii(" = ?,");
::rtl::OUString aQuote = getIdentifierQuoteString();
static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
+ ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL"));
+ ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
// use keys and indexes for excat postioning
// first the keys
@@ -476,91 +489,90 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
lcl_fillIndexColumns(xIndexes,aAllIndexColumns);
::rtl::OUString aColumnName;
- ::rtl::OUString aCondition,sKeyCondition,sIndexCondition,sSetValues;
+ ::rtl::OUStringBuffer sKeyCondition,sIndexCondition;
::std::vector<sal_Int32> aIndexColumnPositions;
+ const sal_Int32 nOldLength = aSql.getLength();
sal_Int32 i = 1;
// here we build the condition part for the update statement
SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
- for(;aIter != m_pColumnNames->end();++aIter,++i)
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
+ for(;aIter != aEnd;++aIter,++i)
{
if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first))
{
- sKeyCondition += ::dbtools::quoteName( aQuote,aIter->first);
+ sKeyCondition.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rOrginalRow->get())[aIter->second.nPosition].isNull())
- sKeyCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ sKeyCondition.append(sIsNull);
else
- sKeyCondition += ::rtl::OUString::createFromAscii(" = ?");
- sKeyCondition += aAnd;
+ sKeyCondition.append(sParam);
+ sKeyCondition.append(aAnd);
}
else
{
+ ::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end();
for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin();
- aIndexIter != aAllIndexColumns.end();++aIndexIter)
+ aIndexIter != aIndexEnd;++aIndexIter)
{
if((*aIndexIter)->hasByName(aIter->first))
{
- sIndexCondition += ::dbtools::quoteName( aQuote,aIter->first);
+ sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rOrginalRow->get())[aIter->second.nPosition].isNull())
- sIndexCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ sIndexCondition.append(sIsNull);
else
{
- sIndexCondition += ::rtl::OUString::createFromAscii(" = ?");
+ sIndexCondition.append(sParam);
aIndexColumnPositions.push_back(aIter->second.nPosition);
}
- sIndexCondition += aAnd;
+ sIndexCondition.append(aAnd);
break;
}
}
}
if((_rInsertRow->get())[aIter->second.nPosition].isModified())
{
- sSetValues += ::dbtools::quoteName( aQuote,aIter->first);
- sSetValues += aPara;
+ aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ aSql.append(aPara);
}
}
- if(sSetValues.getLength())
+ if( aSql.getLength() != nOldLength )
{
- sSetValues = sSetValues.replaceAt(sSetValues.getLength()-1,1,::rtl::OUString::createFromAscii(" "));
- aSql += sSetValues;
+ aSql.setLength(aSql.getLength()-1);
}
else
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), SQL_GENERAL_ERROR, m_xConnection );
if(sKeyCondition.getLength() || sIndexCondition.getLength())
{
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
if(sKeyCondition.getLength() && sIndexCondition.getLength())
{
- aCondition = sKeyCondition;
- aCondition += sIndexCondition;
+ aSql.append(sKeyCondition.makeStringAndClear());
+ aSql.append(sIndexCondition.makeStringAndClear());
}
else if(sKeyCondition.getLength())
{
- aCondition = sKeyCondition;
+ aSql.append(sKeyCondition.makeStringAndClear());
}
else if(sIndexCondition.getLength())
{
- aCondition = sIndexCondition;
+ aSql.append(sIndexCondition.makeStringAndClear());
}
-
- aCondition = aCondition.replaceAt(aCondition.getLength()-5,5,::rtl::OUString::createFromAscii(" "));
-
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
- aSql += aCondition;
+ aSql.setLength(aSql.getLength()-5); // remove the last AND
}
else
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ), SQL_GENERAL_ERROR, m_xConnection );
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
i = 1;
// first the set values
aIter = m_pColumnNames->begin();
sal_uInt16 j = 0;
- for(;aIter != m_pColumnNames->end();++aIter,++j)
+ for(;aIter != aEnd;++aIter,++j)
{
sal_Int32 nPos = aIter->second.nPosition;
if((_rInsertRow->get())[nPos].isModified())
@@ -571,16 +583,18 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
}
// and then the values of the where condition
aIter = (*m_pKeyColumnNames).begin();
+ aEnd = (*m_pKeyColumnNames).end();
j = 0;
- for(;aIter != (*m_pKeyColumnNames).end();++aIter,++i,++j)
+ for(;aIter != aEnd;++aIter,++i,++j)
{
setParameter(i,xParameter,(_rOrginalRow->get())[aIter->second.nPosition],aIter->second.nType,aIter->second.nScale);
}
// now we have to set the index values
::std::vector<sal_Int32>::iterator aIdxColIter = aIndexColumnPositions.begin();
+ ::std::vector<sal_Int32>::iterator aIdxColEnd = aIndexColumnPositions.end();
j = 0;
- for(;aIdxColIter != aIndexColumnPositions.end();++aIdxColIter,++i,++j)
+ for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j)
{
setParameter(i,xParameter,(_rOrginalRow->get())[*aIdxColIter],(_rOrginalRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
}
@@ -600,46 +614,46 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::insertRow" );
- ::rtl::OUString aSql(::rtl::OUString::createFromAscii("INSERT INTO "));
+ ::rtl::OUStringBuffer aSql(::rtl::OUString::createFromAscii("INSERT INTO "));
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" ( ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" ( "));
// set values and column names
- ::rtl::OUString aValues(RTL_CONSTASCII_USTRINGPARAM(" VALUES ( "));
+ ::rtl::OUStringBuffer aValues(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" VALUES ( ")));
static ::rtl::OUString aPara(RTL_CONSTASCII_USTRINGPARAM("?,"));
::rtl::OUString aQuote = getIdentifierQuoteString();
static ::rtl::OUString aComma(RTL_CONSTASCII_USTRINGPARAM(","));
SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
sal_Int32 j = 1;
sal_Bool bModified = sal_False;
- for(;aIter != m_pColumnNames->end();++aIter,++j)
+ for(;aIter != aEnd;++aIter,++j)
{
if((_rInsertRow->get())[aIter->second.nPosition].isModified())
{
- aSql += ::dbtools::quoteName( aQuote,aIter->first);
- aSql += aComma;
- aValues += aPara;
+ aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ aSql.append(aComma);
+ aValues.append(aPara);
bModified = sal_True;
}
}
if ( !bModified )
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), SQL_GENERAL_ERROR, m_xConnection );
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")"));
- aValues = aValues.replaceAt(aValues.getLength()-1,1,::rtl::OUString::createFromAscii(")"));
-
- aSql += aValues;
+ aSql.setCharAt(aSql.getLength()-1,')');
+ aValues.setCharAt(aValues.getLength()-1,')');
+ aSql.append(aValues.makeStringAndClear());
// now create,fill and execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
- SelectColumnsMetaData::const_iterator aPosIter = m_pColumnNames->begin();
- for(sal_Int32 i = 1;aPosIter != m_pColumnNames->end();++aPosIter)
+ aIter = m_pColumnNames->begin();
+ for(sal_Int32 i = 1;aIter != aEnd;++aIter)
{
- sal_Int32 nPos = aPosIter->second.nPosition;
+ const sal_Int32 nPos = aIter->second.nPosition;
if((_rInsertRow->get())[nPos].isModified())
{
if((_rInsertRow->get())[nPos].isNull())
@@ -647,7 +661,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
else
{
(_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]);
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aPosIter->second.nType,aPosIter->second.nScale);
+ setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
}
}
}
@@ -657,11 +671,11 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
if ( m_bInserted )
{
// first insert the default values into the insertrow
- SelectColumnsMetaData::const_iterator defaultIter = m_pColumnNames->begin();
- for(;defaultIter != m_pColumnNames->end();++defaultIter)
+ aIter = m_pColumnNames->begin();
+ for(;aIter != aEnd;++aIter)
{
- if ( !(_rInsertRow->get())[defaultIter->second.nPosition].isModified() )
- (_rInsertRow->get())[defaultIter->second.nPosition] = defaultIter->second.sDefaultValue;
+ if ( !(_rInsertRow->get())[aIter->second.nPosition].isModified() )
+ (_rInsertRow->get())[aIter->second.nPosition] = aIter->second.sDefaultValue;
}
try
{
@@ -701,17 +715,21 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
if ( !bAutoValuesFetched && m_bInserted )
{
// first check if all key column values were set
- ::rtl::OUString sQuote = getIdentifierQuoteString();
+ const ::rtl::OUString sMax(RTL_CONSTASCII_USTRINGPARAM(" MAX("));
+ const ::rtl::OUString sMaxEnd(RTL_CONSTASCII_USTRINGPARAM("),"));
+ const ::rtl::OUString sQuote = getIdentifierQuoteString();
::rtl::OUString sMaxStmt;
+ aEnd = m_pKeyColumnNames->end();
::std::vector< ::rtl::OUString >::iterator aAutoIter = m_aAutoColumns.begin();
- for (;aAutoIter != m_aAutoColumns.end(); ++aAutoIter)
+ ::std::vector< ::rtl::OUString >::iterator aAutoEnd = m_aAutoColumns.end();
+ for (;aAutoIter != aAutoEnd; ++aAutoIter)
{
// we will only fetch values which are keycolumns
- if ( m_pKeyColumnNames->find(*aAutoIter) != m_pKeyColumnNames->end() )
+ if ( m_pKeyColumnNames->find(*aAutoIter) != aEnd )
{
- sMaxStmt += ::rtl::OUString::createFromAscii(" MAX(");
+ sMaxStmt += sMax;
sMaxStmt += ::dbtools::quoteName( sQuote,*aAutoIter);
- sMaxStmt += ::rtl::OUString::createFromAscii("),");
+ sMaxStmt += sMaxEnd;
}
}
@@ -731,12 +749,11 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
if(xRow.is() && xRes->next())
{
aAutoIter = m_aAutoColumns.begin();
- ::std::vector< ::rtl::OUString >::iterator aAutoEnd = m_aAutoColumns.end();
for (sal_Int32 i=1;aAutoIter != aAutoEnd; ++aAutoIter,++i)
{
// we will only fetch values which are keycolumns
SelectColumnsMetaData::iterator aFind = m_pKeyColumnNames->find(*aAutoIter);
- if(aFind != m_pKeyColumnNames->end())
+ if ( aFind != aEnd )
(_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,aFind->second.bNullable,xRow);
}
}
@@ -780,9 +797,9 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
// list all cloumns that should be set
::rtl::OUString aQuote = getIdentifierQuoteString();
@@ -800,64 +817,69 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
::std::vector< Reference<XNameAccess> > aAllIndexColumns;
lcl_fillIndexColumns(xIndexes,aAllIndexColumns);
- ::rtl::OUString aColumnName,sIndexCondition;
+ ::rtl::OUString aColumnName;
+ ::rtl::OUStringBuffer sIndexCondition;
::std::vector<sal_Int32> aIndexColumnPositions;
SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
sal_Int32 i = 1;
- for(i = 1;aIter != m_pColumnNames->end();++aIter,++i)
+ for(i = 1;aIter != aEnd;++aIter,++i)
{
if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first))
{
- aSql += ::dbtools::quoteName( aQuote,aIter->first);
+ aSql.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rDeleteRow->get())[aIter->second.nPosition].isNull())
{
OSL_ENSURE(0,"can a primary key be null");
- aSql += ::rtl::OUString::createFromAscii(" IS NULL");
+ aSql.append(::rtl::OUString::createFromAscii(" IS NULL"));
}
else
- aSql += ::rtl::OUString::createFromAscii(" = ?");
- aSql += aAnd;
+ aSql.append(::rtl::OUString::createFromAscii(" = ?"));
+ aSql.append(aAnd);
}
else
{
+ ::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end();
for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin();
- aIndexIter != aAllIndexColumns.end();++aIndexIter)
+ aIndexIter != aIndexEnd;++aIndexIter)
{
if((*aIndexIter)->hasByName(aIter->first))
{
- sIndexCondition += ::dbtools::quoteName( aQuote,aIter->first);
+ sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rDeleteRow->get())[aIter->second.nPosition].isNull())
- sIndexCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ sIndexCondition.append(::rtl::OUString::createFromAscii(" IS NULL"));
else
{
- sIndexCondition += ::rtl::OUString::createFromAscii(" = ?");
+ sIndexCondition.append(::rtl::OUString::createFromAscii(" = ?"));
aIndexColumnPositions.push_back(aIter->second.nPosition);
}
- sIndexCondition += aAnd;
+ sIndexCondition.append(aAnd);
break;
}
}
}
}
- aSql += sIndexCondition;
- aSql = aSql.replaceAt(aSql.getLength()-5,5,::rtl::OUString::createFromAscii(" "));
+ aSql.append(sIndexCondition.makeStringAndClear());
+ aSql.setLength(aSql.getLength()-5);
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
aIter = (*m_pKeyColumnNames).begin();
+ aEnd = (*m_pKeyColumnNames).end();
i = 1;
- for(;aIter != (*m_pKeyColumnNames).end();++aIter,++i)
+ for(;aIter != aEnd;++aIter,++i)
{
setParameter(i,xParameter,(_rDeleteRow->get())[aIter->second.nPosition],aIter->second.nType,aIter->second.nScale);
}
// now we have to set the index values
::std::vector<sal_Int32>::iterator aIdxColIter = aIndexColumnPositions.begin();
- for(;aIdxColIter != aIndexColumnPositions.end();++aIdxColIter,++i)
+ ::std::vector<sal_Int32>::iterator aIdxColEnd = aIndexColumnPositions.end();
+ for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i)
{
setParameter(i,xParameter,(_rDeleteRow->get())[*aIdxColIter],(_rDeleteRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
}
@@ -1109,12 +1131,20 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
OSL_ENSURE(xParameter.is(),"No Parameter interface!");
xParameter->clearParameters();
sal_Int32 nPos=1;
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaIter = m_aParameterValueForCache.get().begin();
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd = m_aParameterValueForCache.get().end();
+ for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
+ {
+ ::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() );
+ }
connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->get().begin();
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
- for(;aPosIter != (*m_pKeyColumnNames).end();++aPosIter,++aIter,++nPos)
+ SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter,++aIter,++nPos)
setParameter(nPos,xParameter,*aIter,aPosIter->second.nType,aPosIter->second.nScale);
aPosIter = (*m_pForeignColumnNames).begin();
- for(;aPosIter != (*m_pForeignColumnNames).end();++aPosIter,++aIter,++nPos)
+ aPosEnd = (*m_pForeignColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter,++aIter,++nPos)
setParameter(nPos,xParameter,*aIter,aPosIter->second.nType,aPosIter->second.nScale);
m_xSet = m_xStatement->executeQuery();
@@ -1146,7 +1176,7 @@ sal_Bool OKeySet::fetchRow()
}
// now fetch the values from the missing columns from other tables
aPosIter = (*m_pForeignColumnNames).begin();
- aPosEnd = (*m_pForeignColumnNames).end();
+ aPosEnd = (*m_pForeignColumnNames).end();
for(;aPosIter != aPosEnd;++aPosIter,++aIter)
{
const SelectColumnDescription& rColDesc = aPosIter->second;
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 35716d0b9..3bda294c1 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -97,6 +97,7 @@ namespace dbaccess
::std::vector< ::rtl::OUString > m_aAutoColumns; // contains all columns which are autoincrement ones
+ ORowSetValueVector m_aParameterValueForCache;
SelectColumnsMetaData* m_pKeyColumnNames; // contains all key column names
SelectColumnsMetaData* m_pColumnNames; // contains all column names
SelectColumnsMetaData* m_pForeignColumnNames; // contains all column names of the rest
@@ -139,7 +140,8 @@ namespace dbaccess
OKeySet(const connectivity::OSQLTable& _xTable,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xTableKeys,
const ::rtl::OUString& _rUpdateTableName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer,
+ const ORowSetValueVector& _aParameterValueForCache);
// late ctor which can throw exceptions
virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index e84b69620..1a0a6cbbc 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -657,7 +657,8 @@ void ORowSet::freeResources( bool _bComplete )
MutexGuard aGuard(m_aMutex);
// free all clones
- for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); m_aClones.end() != i; i++)
+ connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
+ for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++)
{
Reference< XComponent > xComp(i->get(), UNO_QUERY);
if (xComp.is())
@@ -1715,13 +1716,14 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
// this exception doesn't matter here because when we catch an exception
// then the driver doesn't support this feature
}
-
+ m_aParameterValueForCache.get().resize(1);
Reference< XParameters > xParam( m_xStatement, UNO_QUERY_THROW );
size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues.get().size() );
for ( size_t i=1; i<=nParamCount; ++i )
{
ORowSetValue& rParamValue( getParameterStorage( (sal_Int32)i ) );
::dbtools::setObjectWithInfo( xParam, i, rParamValue.makeAny(), rParamValue.getTypeKind() );
+ m_aParameterValueForCache.get().push_back(rParamValue);
}
xResultSet = m_xStatement->executeQuery();
@@ -1863,7 +1865,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn: creating cache" );
- m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew );
+ m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache );
if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
{
m_nPrivileges = Privilege::SELECT;
@@ -2152,7 +2154,8 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark )
// notify ourself
onDeleteRow( _rBookmark );
// notify the clones
- for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); m_aClones.end() != i; i++)
+ connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
+ for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++)
{
Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY);
if(xTunnel.is())
@@ -2169,7 +2172,8 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32
// notify ourself
onDeletedRow( _rBookmark, _nPos );
// notify the clones
- for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); m_aClones.end() != i; i++)
+ connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
+ for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++)
{
Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY);
if(xTunnel.is())
@@ -2822,7 +2826,6 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo
rParent.m_pColumns->getByName(*pIter) >>= xColumn;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION))
aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION));
-
ORowSetColumn* pColumn = new ORowSetColumn( rParent.getMetaData(),
this,
i,
@@ -2856,7 +2859,7 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo
// sdb.RowSet Properties
// registerProperty(PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, PropertyAttribute::READONLY, &m_aDataSourceName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-
+ registerMayBeVoidProperty(PROPERTY_ACTIVE_CONNECTION,PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, &rParent.m_aActiveConnection, ::getCppuType(reinterpret_cast< Reference< XConnection >* >(NULL)));
registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, PropertyAttribute::READONLY, &m_nResultSetConcurrency,::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY, &m_nResultSetType, ::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
registerProperty(PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, PropertyAttribute::TRANSIENT, &m_nFetchDirection, ::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index 01dce838f..278ffa611 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -133,6 +133,7 @@ namespace dbaccess
(since we have not been executed, yet)
*/
ORowSetValueVector m_aPrematureParamValues;
+ ORowSetValueVector m_aParameterValueForCache;
::std::bit_vector m_aParametersSet;
::cppu::OInterfaceContainerHelper m_aRowsetListeners;
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index d9530cb86..bbd2e825a 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -226,7 +226,10 @@ void SAL_CALL ORowSetBase::disposing(void)
m_pColumns->disposing();
}
if ( m_pCache )
+ {
m_pCache->deregisterOldRow(m_aOldRow);
+ m_pCache->deleteIterator(this);
+ }
m_pCache = NULL;
}
// -------------------------------------------------------------------------
@@ -1322,7 +1325,8 @@ void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow)
sal_Int32 i=0;
try
{
- for(TDataColumns::iterator aIter = m_aDataColumns.begin();aIter != m_aDataColumns.end();++aIter,++i) // #104278# OJ ++i inserted
+ TDataColumns::iterator aEnd = m_aDataColumns.end();
+ for(TDataColumns::iterator aIter = m_aDataColumns.begin();aIter != aEnd;++aIter,++i) // #104278# OJ ++i inserted
(*aIter)->fireValueChange(_rOldRow.isValid() ? (_rOldRow->get())[i+1] : ::connectivity::ORowSetValue());
}
catch(Exception&)
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 1ee01cd63..91ba4a0c7 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -31,36 +31,89 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
+#ifndef _COMPHELPER_SEQSTREAM_HXX
#include <comphelper/seqstream.hxx>
+#endif
+#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
+#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
#include <com/sun/star/sdbcx/KeyType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_
#include <com/sun/star/sdbcx/Privilege.hpp>
+#endif
+#ifndef _DBACORE_DATACOLUMN_HXX_
#include "CRowSetDataColumn.hxx"
+#endif
+#ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX
#include "CRowSetColumn.hxx"
+#endif
+#ifndef DBACCESS_CORE_API_ROWSETBASE_HXX
#include "RowSetBase.hxx"
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _CONNECTIVITY_SQLPARSE_HXX
#include <connectivity/sqlparse.hxx>
+#endif
+#ifndef _CONNECTIVITY_SQLNODE_HXX
#include <connectivity/sqlnode.hxx>
+#endif
+#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
#include <connectivity/sqliterator.hxx>
+#endif
+#ifndef _COMPHELPER_PROPERTY_HXX_
#include <comphelper/property.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
+#endif
#include <algorithm>
+#ifndef DBACCESS_CORE_API_ROWSETCACHE_HXX
#include "RowSetCache.hxx"
+#endif
+#ifndef _DBA_CORE_RESOURCE_HXX_
#include "core_resource.hxx"
+#endif
+#ifndef _DBA_CORE_RESOURCE_HRC_
#include "core_resource.hrc"
+#endif
+#ifndef DBACCESS_CORE_API_BOOKMARKSET_HXX
#include "BookmarkSet.hxx"
+#endif
+#ifndef DBACCESS_CORE_API_STATICSET_HXX
#include "StaticSet.hxx"
+#endif
+#ifndef DBACCESS_CORE_API_KEYSET_HXX
#include "KeySet.hxx"
+#endif
+#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
#include "dbastrings.hrc"
-#include <rtl/logfile.hxx>
+#endif
using namespace dbaccess;
using namespace dbtools;
@@ -84,7 +137,8 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
const ::comphelper::ComponentContext& _rContext,
const ::rtl::OUString& _rUpdateTableName,
sal_Bool& _bModified,
- sal_Bool& _bNew)
+ sal_Bool& _bNew,
+ const ORowSetValueVector& _aParameterValueForCache)
:m_xSet(_xRs)
,m_xMetaData(Reference< XResultSetMetaDataSupplier >(_xRs,UNO_QUERY)->getMetaData())
,m_aContext( _rContext )
@@ -105,7 +159,6 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
,m_bModified(_bModified)
,m_bNew(_bNew)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::ORowSetCache" );
DBG_CTOR(ORowSetCache,NULL);
// check if all keys of the updateable table are fetched
@@ -194,18 +247,41 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
}
Reference< XPropertySet> xProp(_xRs,UNO_QUERY);
- sal_Bool bBookmarkable = xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
- any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is();
- sal_Bool bNeedKeySet = !bBookmarkable;
+ sal_Bool bNeedKeySet = !(xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
+ any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is() );
bNeedKeySet = bNeedKeySet || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETCONCURRENCY) &&
::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY)) == ResultSetConcurrency::READ_ONLY);
// first check if resultset is bookmarkable
- if ( !bNeedKeySet )
+ if(!bNeedKeySet)
{
- bNeedKeySet = impl_createBookmarkSet_nothrow(_xRs);
+ try
+ {
+ m_pCacheSet = new OBookmarkSet();
+ m_xCacheSet = m_pCacheSet;
+ m_pCacheSet->construct(_xRs);
+
+ // check privileges
+ m_nPrivileges = Privilege::SELECT;
+ if(Reference<XResultSetUpdate>(_xRs,UNO_QUERY).is()) // this interface is optional so we have to check it
+ {
+ Reference<XPropertySet> xTable(m_aUpdateTable,UNO_QUERY);
+ if(xTable.is() && xTable->getPropertySetInfo()->hasPropertyByName(PROPERTY_PRIVILEGES))
+ {
+ m_nPrivileges = 0;
+ xTable->getPropertyValue(PROPERTY_PRIVILEGES) >>= m_nPrivileges;
+ if(!m_nPrivileges)
+ m_nPrivileges = Privilege::SELECT;
+ }
+ }
+ }
+ catch(const SQLException&)
+ {
+ bNeedKeySet = sal_True;
+ }
+
}
- if ( bNeedKeySet )
+ if(bNeedKeySet)
{
// need to check if we could handle this select clause
bAllKeysFound = bAllKeysFound && (nTablesCount == 1 || checkJoin(xConnection,_xAnalyzer,aUpdateTableName));
@@ -213,16 +289,11 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
// || !(comphelper::hasProperty(PROPERTY_CANUPDATEINSERTEDROWS,xProp) && any2bool(xProp->getPropertyValue(PROPERTY_CANUPDATEINSERTEDROWS)))
// oj removed because keyset uses only the next// || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETTYPE) && comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) == ResultSetType::FORWARD_ONLY)
- if ( !bAllKeysFound )
+ if(!bAllKeysFound )
{
- if ( bBookmarkable )
- impl_createBookmarkSet_nothrow(_xRs);
- else
- {
- m_pCacheSet = new OStaticSet();
- m_xCacheSet = m_pCacheSet;
- m_pCacheSet->construct(_xRs);
- }
+ m_pCacheSet = new OStaticSet();
+ m_xCacheSet = m_pCacheSet;
+ m_pCacheSet->construct(_xRs);
m_nPrivileges = Privilege::SELECT;
}
else
@@ -258,7 +329,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
}
}
- OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer);
+ OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache);
try
{
m_pCacheSet = pKeySet;
@@ -298,6 +369,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY)) == ResultSetConcurrency::READ_ONLY)
m_nPrivileges = Privilege::SELECT;
}
+
// -------------------------------------------------------------------------
ORowSetCache::~ORowSetCache()
{
@@ -320,40 +392,10 @@ ORowSetCache::~ORowSetCache()
DBG_DTOR(ORowSetCache,NULL);
}
-// -----------------------------------------------------------------------------
-sal_Bool ORowSetCache::impl_createBookmarkSet_nothrow(const Reference< XResultSet >& _xRs)
-{
- sal_Bool bRet = sal_False;
- try
- {
- m_pCacheSet = new OBookmarkSet();
- m_xCacheSet = m_pCacheSet;
- m_pCacheSet->construct(_xRs);
- // check privileges
- m_nPrivileges = Privilege::SELECT;
- if(Reference<XResultSetUpdate>(_xRs,UNO_QUERY).is()) // this interface is optional so we have to check it
- {
- Reference<XPropertySet> xTable(m_aUpdateTable,UNO_QUERY);
- if(xTable.is() && xTable->getPropertySetInfo()->hasPropertyByName(PROPERTY_PRIVILEGES))
- {
- m_nPrivileges = 0;
- xTable->getPropertyValue(PROPERTY_PRIVILEGES) >>= m_nPrivileges;
- if(!m_nPrivileges)
- m_nPrivileges = Privilege::SELECT;
- }
- }
- }
- catch(const SQLException&)
- {
- bRet = sal_True;
- }
- return bRet;
-}
// -------------------------------------------------------------------------
void ORowSetCache::setMaxRowSize(sal_Int32 _nSize)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::setMaxRowSize" );
if(_nSize == m_nFetchSize)
return;
@@ -375,7 +417,8 @@ void ORowSetCache::setMaxRowSize(sal_Int32 _nSize)
::std::map<sal_Int32,sal_Bool> aCacheIterToChange;
// first get the positions where they stand now
ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
- for(;aCacheIter != m_aCacheIterators.end();++aCacheIter)
+ ORowSetCacheMap::iterator aCacheEnd = m_aCacheIterators.end();
+ for(;aCacheIter != aCacheEnd;++aCacheIter)
{
aCacheIterToChange[aCacheIter->first] = sal_False;
if ( !aCacheIter->second.pRowSet->isInsertRow()
@@ -425,14 +468,12 @@ void ORowSetCache::setMaxRowSize(sal_Int32 _nSize)
// XResultSetMetaDataSupplier
Reference< XResultSetMetaData > ORowSetCache::getMetaData( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::getMetaData" );
return m_xMetaData;
}
// -------------------------------------------------------------------------
// ::com::sun::star::sdbcx::XRowLocate
Any ORowSetCache::getBookmark( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::getBookmark" );
if(m_bAfterLast)
throwFunctionSequenceException(m_xSet.get());
@@ -457,7 +498,6 @@ Any ORowSetCache::getBookmark( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::moveToBookmark( const Any& bookmark )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveToBookmark" );
if ( m_pCacheSet->moveToBookmark(bookmark) )
{
m_bBeforeFirst = sal_False;
@@ -488,7 +528,6 @@ sal_Bool ORowSetCache::moveToBookmark( const Any& bookmark )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveRelativeToBookmark" );
sal_Bool bRet( moveToBookmark( bookmark ) );
if ( bRet )
{
@@ -504,20 +543,17 @@ sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 ro
// -------------------------------------------------------------------------
sal_Int32 ORowSetCache::compareBookmarks( const Any& _first, const Any& _second )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::compareBookmarks" );
return (!_first.hasValue() || !_second.hasValue()) ? CompareBookmark::NOT_COMPARABLE : m_pCacheSet->compareBookmarks(_first,_second);
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::hasOrderedBookmarks( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::hasOrderedBookmarks" );
return m_pCacheSet->hasOrderedBookmarks();
}
// -------------------------------------------------------------------------
sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::hashBookmark" );
return m_pCacheSet->hashBookmark(bookmark);
}
@@ -526,7 +562,6 @@ sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark )
// -----------------------------------------------------------------------------
void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateValue" );
checkUpdateConditions(columnIndex);
@@ -537,7 +572,6 @@ void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
// -------------------------------------------------------------------------
void ORowSetCache::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateBinaryStream" );
checkUpdateConditions(columnIndex);
@@ -549,7 +583,6 @@ void ORowSetCache::updateBinaryStream( sal_Int32 columnIndex, const Reference< :
// -------------------------------------------------------------------------
void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateCharacterStream" );
checkUpdateConditions(columnIndex);
@@ -562,7 +595,6 @@ void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference
// -------------------------------------------------------------------------
void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateObject" );
checkUpdateConditions(columnIndex);
@@ -573,7 +605,6 @@ void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x )
// -------------------------------------------------------------------------
void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateNumericObject" );
checkUpdateConditions(columnIndex);
@@ -585,7 +616,6 @@ void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal
// XResultSet
sal_Bool ORowSetCache::next( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::next" );
if(!isAfterLast())
@@ -610,7 +640,6 @@ sal_Bool ORowSetCache::next( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isBeforeFirst( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isBeforeFirst" );
// return !m_nPosition;
return m_bBeforeFirst;
@@ -618,21 +647,18 @@ sal_Bool ORowSetCache::isBeforeFirst( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isAfterLast( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isAfterLast" );
return m_bAfterLast;
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isFirst( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isFirst" );
return m_nPosition == 1; // ask resultset for
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isLast( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isLast" );
// return m_bRowCountFinal ? (m_nPosition==m_nRowCount) : m_pCacheSet->isLast();
return m_nPosition == m_nRowCount;
@@ -640,7 +666,6 @@ sal_Bool ORowSetCache::isLast( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::beforeFirst( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::beforeFirst" );
if(!m_bBeforeFirst)
@@ -657,7 +682,6 @@ sal_Bool ORowSetCache::beforeFirst( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::afterLast( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::afterLast" );
if(!m_bAfterLast)
@@ -681,12 +705,10 @@ sal_Bool ORowSetCache::afterLast( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::fillMatrix" );
OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!");
// fill the whole window with new data
ORowSetMatrix::iterator aIter = m_pMatrix->begin();
sal_Bool bCheck = m_pCacheSet->absolute(_nNewStartPos); // -1 no need to
- const sal_Int32 nColumnCount = m_xMetaData->getColumnCount();
sal_Int32 i=_nNewStartPos;
for(;i<_nNewEndPos;++i,++aIter)
@@ -694,7 +716,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
if(bCheck)
{
if(!aIter->isValid())
- *aIter = new ORowSetValueVector(nColumnCount);
+ *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount());
m_pCacheSet->fillValueRow(*aIter,i);
}
else
@@ -711,22 +733,23 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
if(m_nRowCount > m_nFetchSize)
{
ORowSetMatrix::iterator aEnd = aIter;
+ ORowSetMatrix::iterator aRealEnd = m_pMatrix->end();
sal_Int32 nPos = m_nRowCount - m_nFetchSize + 1;
_nNewStartPos = nPos;
bCheck = m_pCacheSet->absolute(_nNewStartPos);
- for(;bCheck && aIter != m_pMatrix->end();++aIter)
+ for(;bCheck && aIter != aRealEnd;++aIter)
{
if(bCheck)
{
if(!aIter->isValid())
- *aIter = new ORowSetValueVector(nColumnCount);
+ *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount());
m_pCacheSet->fillValueRow(*aIter,nPos++);
}
bCheck = m_pCacheSet->next();
}
if(aIter != aEnd)
- ::std::rotate(m_pMatrix->begin(),aEnd,m_pMatrix->end());
+ ::std::rotate(m_pMatrix->begin(),aEnd,aRealEnd);
}
break;
}
@@ -752,7 +775,6 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::moveWindow()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveWindow" );
sal_Bool bRet = sal_True;
@@ -803,7 +825,8 @@ sal_Bool ORowSetCache::moveWindow()
ptrdiff_t nNewDist = aEnd - m_pMatrix->begin();
ptrdiff_t nOffSet = m_pMatrix->end() - aEnd;
ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
- for(;aCacheIter != m_aCacheIterators.end();++aCacheIter)
+ ORowSetCacheMap::iterator aCacheEnd = m_aCacheIterators.end();
+ for(;aCacheIter != aCacheEnd;++aCacheIter)
{
if ( !aCacheIter->second.pRowSet->isInsertRow()
&& aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified )
@@ -990,7 +1013,6 @@ sal_Bool ORowSetCache::moveWindow()
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::first( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::first" );
// first move to the first row
// then check if the cache window is at the begining
// when not postionize the window and fill it with data
@@ -1016,7 +1038,6 @@ sal_Bool ORowSetCache::first( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::last( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::last" );
sal_Bool bRet = m_pCacheSet->last();
if(bRet)
{
@@ -1056,13 +1077,11 @@ sal_Bool ORowSetCache::last( )
// -------------------------------------------------------------------------
sal_Int32 ORowSetCache::getRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::getRow" );
return (isBeforeFirst() || isAfterLast()) ? 0 : m_nPosition;
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::absolute( sal_Int32 row )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::absolute" );
if(!row )
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_ABS_ZERO),NULL,SQLSTATE_GENERAL,1000,Any() );
@@ -1116,7 +1135,6 @@ sal_Bool ORowSetCache::absolute( sal_Int32 row )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::relative( sal_Int32 rows )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::relative" );
sal_Bool bErg = sal_True;
if(rows)
{
@@ -1145,7 +1163,6 @@ sal_Bool ORowSetCache::relative( sal_Int32 rows )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::previous( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::previous" );
sal_Bool bRet = sal_False;
if(!isBeforeFirst())
{
@@ -1177,7 +1194,6 @@ sal_Bool ORowSetCache::previous( )
// -------------------------------------------------------------------------
void ORowSetCache::refreshRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::refreshRow" );
if(isAfterLast())
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_REFESH_AFTERLAST),NULL,SQLSTATE_GENERAL,1000,Any() );
OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"refreshRow() called for invalid row!");
@@ -1191,20 +1207,17 @@ void ORowSetCache::refreshRow( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::rowUpdated( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::rowUpdated" );
return m_pCacheSet->rowUpdated();
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::rowInserted( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::rowInserted" );
return m_pCacheSet->rowInserted();
}
// -------------------------------------------------------------------------
// XResultSetUpdate
sal_Bool ORowSetCache::insertRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::insertRow" );
if ( !m_bNew || !m_aInsertRow->isValid() )
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_MOVETOINSERTROW_CALLED),NULL,SQLSTATE_GENERAL,1000,Any() );
@@ -1228,7 +1241,6 @@ sal_Bool ORowSetCache::insertRow( )
// -------------------------------------------------------------------------
void ORowSetCache::resetInsertRow(sal_Bool _bClearInsertRow)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::resetInsertRow" );
if ( _bClearInsertRow )
clearInsertRow();
m_bNew = sal_False;
@@ -1237,7 +1249,6 @@ void ORowSetCache::resetInsertRow(sal_Bool _bClearInsertRow)
// -------------------------------------------------------------------------
void ORowSetCache::cancelRowModification()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::cancelRowModification" );
// clear the insertrow references -> implies that the current row of the rowset changes as well
ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
ORowSetCacheMap::iterator aCacheEnd = m_aCacheIterators.end();
@@ -1251,7 +1262,6 @@ void ORowSetCache::cancelRowModification()
// -------------------------------------------------------------------------
void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateRow" );
if(isAfterLast() || isBeforeFirst())
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_UPDATEROW),NULL,SQLSTATE_GENERAL,1000,Any() );
@@ -1275,7 +1285,6 @@ void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow )
// -------------------------------------------------------------------------
bool ORowSetCache::deleteRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::deleteRow" );
if(isAfterLast() || isBeforeFirst())
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_DELETEROW),NULL,SQLSTATE_GENERAL,1000,Any() );
@@ -1291,7 +1300,8 @@ bool ORowSetCache::deleteRow( )
// (*m_pMatrix)[(m_nPosition - m_nStartPos)] = NULL; // set the deleted row to NULL
- for(++aPos;aPos != m_pMatrix->end() && aPos->isValid();++aPos)
+ ORowSetMatrix::iterator aEnd = m_pMatrix->end();
+ for(++aPos;aPos != aEnd && aPos->isValid();++aPos)
{
*(aPos-1) = *aPos;
(*aPos) = NULL;
@@ -1304,7 +1314,6 @@ bool ORowSetCache::deleteRow( )
// -------------------------------------------------------------------------
void ORowSetCache::cancelRowUpdates( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::cancelRowUpdates" );
m_bNew = m_bModified = sal_False;
if(!m_nPosition)
{
@@ -1323,7 +1332,6 @@ void ORowSetCache::cancelRowUpdates( )
// -------------------------------------------------------------------------
void ORowSetCache::moveToInsertRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveToInsertRow" );
m_bNew = sal_True;
m_bUpdated = m_bAfterLast = sal_False;
@@ -1333,7 +1341,8 @@ void ORowSetCache::moveToInsertRow( )
// we don't unbound the bookmark column
ORowSetValueVector::Vector::iterator aIter = (*m_aInsertRow)->get().begin()+1;
- for(;aIter != (*m_aInsertRow)->get().end();++aIter)
+ ORowSetValueVector::Vector::iterator aEnd = (*m_aInsertRow)->get().end();
+ for(;aIter != aEnd;++aIter)
{
aIter->setBound(sal_False);
aIter->setModified(sal_False);
@@ -1343,7 +1352,6 @@ void ORowSetCache::moveToInsertRow( )
// -------------------------------------------------------------------------
ORowSetCacheIterator ORowSetCache::createIterator(ORowSetBase* _pRowSet)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::createIterator" );
ORowSetCacheIterator_Helper aHelper;
aHelper.aIterator = m_pMatrix->end();
@@ -1351,14 +1359,29 @@ ORowSetCacheIterator ORowSetCache::createIterator(ORowSetBase* _pRowSet)
return ORowSetCacheIterator(m_aCacheIterators.insert(m_aCacheIterators.begin(),ORowSetCacheMap::value_type(m_aCacheIterators.size()+1,aHelper)),this,_pRowSet);
}
// -----------------------------------------------------------------------------
+void ORowSetCache::deleteIterator(const ORowSetBase* _pRowSet)
+{
+ ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
+ for(;aCacheIter != m_aCacheIterators.end();)
+ {
+ if ( aCacheIter->second.pRowSet == _pRowSet )
+ {
+ m_aCacheIterators.erase(aCacheIter);
+ aCacheIter = m_aCacheIterators.begin();
+ } // if ( aCacheIter->second.pRowSet == _pRowSet )
+ else
+ ++aCacheIter;
+ }
+}
+// -----------------------------------------------------------------------------
void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::rotateCacheIterator" );
if(_nDist)
{
// now correct the iterator in our iterator vector
ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
- for(;aCacheIter != m_aCacheIterators.end();++aCacheIter)
+ ORowSetCacheMap::iterator aCacheEnd = m_aCacheIterators.end();
+ for(;aCacheIter != aCacheEnd;++aCacheIter)
{
if ( !aCacheIter->second.pRowSet->isInsertRow()
&& aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified )
@@ -1382,7 +1405,6 @@ void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist)
// -------------------------------------------------------------------------
void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRow)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::setUpdateIterator" );
m_aInsertRow = m_pInsertMatrix->begin();
if(!m_aInsertRow->isValid())
*m_aInsertRow = new ORowSetValueVector(m_xMetaData->getColumnCount());
@@ -1390,13 +1412,13 @@ void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRo
(*(*m_aInsertRow)) = (*(*_rOriginalRow));
// we don't unbound the bookmark column
ORowSetValueVector::Vector::iterator aIter = (*m_aInsertRow)->get().begin();
- for(;aIter != (*m_aInsertRow)->get().end();++aIter)
+ ORowSetValueVector::Vector::iterator aEnd = (*m_aInsertRow)->get().end();
+ for(;aIter != aEnd;++aIter)
aIter->setModified(sal_False);
}
// -----------------------------------------------------------------------------
void ORowSetCache::checkPositionFlags()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkPositionFlags" );
if(m_bRowCountFinal)
{
m_bAfterLast = m_nPosition > m_nRowCount;
@@ -1407,14 +1429,12 @@ void ORowSetCache::checkPositionFlags()
// -----------------------------------------------------------------------------
void ORowSetCache::checkUpdateConditions(sal_Int32 columnIndex)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkUpdateConditions" );
if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->get().size())
throwFunctionSequenceException(m_xSet.get());
}
//------------------------------------------------------------------------------
sal_Bool ORowSetCache::checkInnerJoin(const ::connectivity::OSQLParseNode *pNode,const Reference< XConnection>& _xConnection,const ::rtl::OUString& _sUpdateTableName)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkInnerJoin" );
sal_Bool bOk = sal_False;
if (pNode->count() == 3 && // Ausdruck is geklammert
SQL_ISPUNCTUATION(pNode->getChild(0),"(") &&
@@ -1456,7 +1476,6 @@ sal_Bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection,
const Reference< XSingleSelectQueryAnalyzer >& _xAnalyzer,
const ::rtl::OUString& _sUpdateTableName )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkJoin" );
sal_Bool bOk = sal_False;
::rtl::OUString sSql = _xAnalyzer->getQuery();
::rtl::OUString sErrorMsg;
@@ -1515,7 +1534,6 @@ sal_Bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection,
// -----------------------------------------------------------------------------
void ORowSetCache::clearInsertRow()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::clearInsertRow" );
// we don't unbound the bookmark column
if ( m_aInsertRow != m_pInsertMatrix->end() && m_aInsertRow->isValid() )
{
@@ -1532,7 +1550,6 @@ void ORowSetCache::clearInsertRow()
// -----------------------------------------------------------------------------
ORowSetMatrix::iterator ORowSetCache::calcPosition() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::calcPosition" );
sal_Int32 nValue = (m_nPosition - m_nStartPos) - 1;
CHECK_MATRIX_POS(nValue);
return ( nValue < 0 || nValue >= static_cast<sal_Int32>(m_pMatrix->size()) ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue);
@@ -1541,7 +1558,6 @@ ORowSetMatrix::iterator ORowSetCache::calcPosition() const
TORowSetOldRowHelperRef ORowSetCache::registerOldRow()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::registerOldRow" );
TORowSetOldRowHelperRef pRef = new ORowSetOldRowHelper(ORowSetRow());
m_aOldRows.push_back(pRef);
return pRef;
@@ -1549,8 +1565,8 @@ TORowSetOldRowHelperRef ORowSetCache::registerOldRow()
// -----------------------------------------------------------------------------
void ORowSetCache::deregisterOldRow(const TORowSetOldRowHelperRef& _rRow)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::deregisterOldRow" );
- for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != m_aOldRows.end(); ++aOldRowIter)
+ TOldRowSetRows::iterator aOldRowEnd = m_aOldRows.end();
+ for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter)
{
if ( aOldRowIter->getBodyPtr() == _rRow.getBodyPtr() )
{
@@ -1563,8 +1579,8 @@ void ORowSetCache::deregisterOldRow(const TORowSetOldRowHelperRef& _rRow)
// -----------------------------------------------------------------------------
sal_Bool ORowSetCache::reFillMatrix(sal_Int32 _nNewStartPos,sal_Int32 _nNewEndPos)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::reFillMatrix" );
- for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != m_aOldRows.end(); ++aOldRowIter)
+ TOldRowSetRows::iterator aOldRowEnd = m_aOldRows.end();
+ for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter)
{
if ( aOldRowIter->isValid() && aOldRowIter->getBody().getRow().isValid() )
aOldRowIter->getBody().setRow(new ORowSetValueVector(aOldRowIter->getBody().getRow().getBody()) );
@@ -1578,7 +1594,6 @@ sal_Bool ORowSetCache::reFillMatrix(sal_Int32 _nNewStartPos,sal_Int32 _nNewEndPo
// -----------------------------------------------------------------------------
sal_Bool ORowSetCache::fill(ORowSetMatrix::iterator& _aIter,const ORowSetMatrix::iterator& _aEnd,sal_Int32& _nPos,sal_Bool _bCheck)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::fill" );
sal_Int32 nColumnCount = m_xMetaData->getColumnCount();
for(; _bCheck && _aIter != _aEnd;)
{
@@ -1586,7 +1601,8 @@ sal_Bool ORowSetCache::fill(ORowSetMatrix::iterator& _aIter,const ORowSetMatrix:
*_aIter = new ORowSetValueVector(nColumnCount);
else
{
- for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != m_aOldRows.end(); ++aOldRowIter)
+ TOldRowSetRows::iterator aOldRowEnd = m_aOldRows.end();
+ for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter)
{
if ( aOldRowIter->getBody().getRow().isEqualBody(*_aIter) )
*_aIter = new ORowSetValueVector(nColumnCount);
diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx
index 9013bf394..94ea9822e 100644
--- a/dbaccess/source/core/api/RowSetCache.hxx
+++ b/dbaccess/source/core/api/RowSetCache.hxx
@@ -194,13 +194,15 @@ namespace dbaccess
const ::comphelper::ComponentContext& _rContext,
const ::rtl::OUString& _rUpdateTableName,
sal_Bool& _bModified,
- sal_Bool& _bNew);
+ sal_Bool& _bNew,
+ const ORowSetValueVector& _aParameterValueForCache);
~ORowSetCache();
// called from the rowset when a updateXXX was called for the first time
void setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRow);
ORowSetCacheIterator createIterator(ORowSetBase* _pRowSet);
+ void deleteIterator(const ORowSetBase* _pRowSet);
// sets the size of the matrix
void setMaxRowSize(sal_Int32 _nSize);
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index ab952d356..574bd1778 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -262,7 +262,8 @@ OSingleSelectQueryComposer::~OSingleSelectQueryComposer()
delete *aColIter;
::std::vector<OPrivateTables*>::iterator aTabIter = m_aTablesCollection.begin();
- for(;aTabIter != m_aTablesCollection.end();++aTabIter)
+ ::std::vector<OPrivateTables*>::iterator aTabEnd = m_aTablesCollection.end();
+ for(;aTabIter != aTabEnd;++aTabIter)
delete *aTabIter;
}
// -------------------------------------------------------------------------
@@ -572,14 +573,19 @@ void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const
*pComposer, getKeyword( _ePart ) );
// construct the complete statement
- ::rtl::OUString aSql(m_aPureSelectSQL);
+ ::rtl::OUStringBuffer aSql(m_aPureSelectSQL);
for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) )
- aSql += aClauses[ eLoopParts ];
+ aSql.append(aClauses[ eLoopParts ]);
// set the query
- setQuery_Impl(aSql);
- // parameters may also have changed
- clearParametersCollection();
+ setQuery_Impl(aSql.makeStringAndClear());
+
+ // clear column collections which (might) have changed
+ clearColumns( ParameterColumns );
+ if ( _ePart == Order )
+ clearColumns( OrderColumns );
+ if ( _ePart == Group )
+ clearColumns( GroupByColumns );
// also, since the "additive filter" change, we need to rebuild our "additive" statement
aSql = m_aPureSelectSQL;
@@ -590,10 +596,10 @@ void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const
aClauses[ _ePart ] = getComposedClause( ::rtl::OUString(), _rClause, *pComposer, getKeyword( _ePart ) );
// and parse it, so that m_aAdditiveIterator is up to date
for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) )
- aSql += aClauses[ eLoopParts ];
+ aSql.append(aClauses[ eLoopParts ]);
try
{
- parseAndCheck_throwError( m_aSqlParser, aSql, m_aAdditiveIterator, *this );
+ parseAndCheck_throwError( m_aSqlParser, aSql.makeStringAndClear(), m_aAdditiveIterator, *this );
}
catch( const Exception& e )
{
@@ -642,7 +648,8 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getTables( ) thro
{
const OSQLTables& aTables = m_aSqlIterator.getTables();
::std::vector< ::rtl::OUString> aNames;
- for(OSQLTables::const_iterator aIter = aTables.begin(); aIter != aTables.end();++aIter)
+ OSQLTables::const_iterator aEnd = aTables.end();
+ for(OSQLTables::const_iterator aIter = aTables.begin(); aIter != aEnd;++aIter)
aNames.push_back(aIter->first);
m_pTables = new OPrivateTables(aTables,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames);
@@ -674,26 +681,42 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
bCase = m_xMetaData->supportsMixedCaseQuotedIdentifiers();
aSelectColumns = m_aSqlIterator.getSelectColumns();
- ::rtl::OUString sSql = m_aPureSelectSQL;
- sSql += STR_WHERE;
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" 0 = 1 "));
- ::rtl::OUString sGroupBy = getSQLPart(Group,m_aSqlIterator,sal_True);
+ ::rtl::OUStringBuffer aSQL;
+ aSQL.append( m_aPureSelectSQL );
+ aSQL.append( STR_WHERE );
+
+ // preserve the original WHERE clause
+ // #i102234# / 2009-06-02 / frank.schoenheit@sun.com
+ ::rtl::OUString sOriginalWhereClause = getSQLPart( Where, m_aSqlIterator, sal_False );
+ if ( sOriginalWhereClause.getLength() )
+ {
+ aSQL.appendAscii( " ( 0 = 1 ) AND ( " );
+ aSQL.append( sOriginalWhereClause );
+ aSQL.appendAscii( " ) " );
+ }
+ else
+ {
+ aSQL.appendAscii( " ( 0 = 1 ) " );
+ }
+
+ ::rtl::OUString sGroupBy = getSQLPart( Group, m_aSqlIterator, sal_True );
if ( sGroupBy.getLength() )
- sSql += sGroupBy;
+ aSQL.append( sGroupBy );
+ ::rtl::OUString sSQL( aSQL.makeStringAndClear() );
// normalize the statement so that it doesn't contain any application-level features anymore
::rtl::OUString sError;
- const ::std::auto_ptr< OSQLParseNode > pStatementTree( m_aSqlParser.parseTree( sError, sSql, false ) );
+ const ::std::auto_ptr< OSQLParseNode > pStatementTree( m_aSqlParser.parseTree( sError, sSQL, false ) );
DBG_ASSERT( pStatementTree.get(), "OSingleSelectQueryComposer::getColumns: could not parse the column retrieval statement!" );
if ( pStatementTree.get() )
- if ( !pStatementTree->parseNodeToExecutableStatement( sSql, m_xConnection, m_aSqlParser, NULL ) )
+ if ( !pStatementTree->parseNodeToExecutableStatement( sSQL, m_xConnection, m_aSqlParser, NULL ) )
break;
Reference< XResultSetMetaData > xResultSetMeta;
Reference< XResultSetMetaDataSupplier > xResMetaDataSup;
try
{
- xPreparedStatement.set( m_xConnection->prepareStatement( sSql ), UNO_QUERY_THROW );
+ xPreparedStatement.set( m_xConnection->prepareStatement( sSQL ), UNO_QUERY_THROW );
xResMetaDataSup.set( xPreparedStatement, UNO_QUERY_THROW );
xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_QUERY_THROW );
}
@@ -705,7 +728,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
Reference< XPropertySet > xStatementProps( xStatement, UNO_QUERY_THROW );
try { xStatementProps->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( sal_False ) ); }
catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
- xResMetaDataSup.set( xStatement->executeQuery( sSql ), UNO_QUERY_THROW );
+ xResMetaDataSup.set( xStatement->executeQuery( sSQL ), UNO_QUERY_THROW );
xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_QUERY_THROW );
}
@@ -1232,7 +1255,8 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getParameters( )
{
::vos::ORef< OSQLColumns> aCols = m_aSqlIterator.getParameters();
::std::vector< ::rtl::OUString> aNames;
- for(OSQLColumns::Vector::const_iterator aIter = aCols->get().begin(); aIter != aCols->get().end();++aIter)
+ OSQLColumns::Vector::const_iterator aEnd = aCols->get().end();
+ for(OSQLColumns::Vector::const_iterator aIter = aCols->get().begin(); aIter != aEnd;++aIter)
aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME)));
m_aCurrentColumns[ParameterColumns] = new OPrivateColumns(aCols,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True);
}
@@ -1240,14 +1264,15 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getParameters( )
return m_aCurrentColumns[ParameterColumns];
}
// -----------------------------------------------------------------------------
-void OSingleSelectQueryComposer::clearParametersCollection()
+void OSingleSelectQueryComposer::clearColumns( const EColumnType _eType )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearParametersCollection" );
- if ( m_aCurrentColumns[ParameterColumns] )
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearColumns" );
+ OPrivateColumns* pColumns = m_aCurrentColumns[ _eType ];
+ if ( pColumns != NULL )
{
- m_aCurrentColumns[ParameterColumns]->disposing();
- m_aColumnsCollection.push_back(m_aCurrentColumns[ParameterColumns]);
- m_aCurrentColumns[ParameterColumns] = NULL;
+ pColumns->disposing();
+ m_aColumnsCollection.push_back( pColumns );
+ m_aCurrentColumns[ _eType ] = NULL;
}
}
// -----------------------------------------------------------------------------
@@ -1285,7 +1310,8 @@ Reference< XIndexAccess > OSingleSelectQueryComposer::setCurrentColumns( EColumn
if ( !m_aCurrentColumns[_eType] )
{
::std::vector< ::rtl::OUString> aNames;
- for(OSQLColumns::Vector::const_iterator aIter = _rCols->get().begin(); aIter != _rCols->get().end();++aIter)
+ OSQLColumns::Vector::const_iterator aEnd = _rCols->get().end();
+ for(OSQLColumns::Vector::const_iterator aIter = _rCols->get().begin(); aIter != aEnd;++aIter)
aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME)));
m_aCurrentColumns[_eType] = new OPrivateColumns(_rCols,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True);
}
@@ -1340,75 +1366,75 @@ namespace
{
::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter )
{
- ::rtl::OUString sRet;
+ ::rtl::OUStringBuffer sRet;
const Sequence< PropertyValue >* pOrIter = filter.getConstArray();
const Sequence< PropertyValue >* pOrEnd = pOrIter + filter.getLength();
while ( pOrIter != pOrEnd )
{
if ( pOrIter->getLength() )
{
- sRet += L_BRACKET;
+ sRet.append(L_BRACKET);
const PropertyValue* pAndIter = pOrIter->getConstArray();
const PropertyValue* pAndEnd = pAndIter + pOrIter->getLength();
while ( pAndIter != pAndEnd )
{
- sRet += pAndIter->Name;
+ sRet.append(pAndIter->Name);
::rtl::OUString sValue;
pAndIter->Value >>= sValue;
switch( pAndIter->Handle )
{
case SQLFilterOperator::EQUAL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::NOT_EQUAL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <> "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <> ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::LESS:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" < "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" < ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::GREATER:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" > "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" > ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::LESS_EQUAL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <= "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <= ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::GREATER_EQUAL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" >= "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" >= ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::LIKE:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" LIKE "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" LIKE ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::NOT_LIKE:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT LIKE "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT LIKE ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::SQLNULL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")) ;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")) );
break;
case SQLFilterOperator::NOT_SQLNULL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NOT NULL")) ;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NOT NULL")) );
break;
default:
throw IllegalArgumentException();
}
++pAndIter;
if ( pAndIter != pAndEnd )
- sRet += STR_AND;
+ sRet.append(STR_AND);
}
- sRet += R_BRACKET;
+ sRet.append(R_BRACKET);
}
++pOrIter;
if ( pOrIter != pOrEnd && sRet.getLength() )
- sRet += STR_OR;
+ sRet.append(STR_OR);
}
- return sRet;
+ return sRet.makeStringAndClear();
}
}
// -----------------------------------------------------------------------------
@@ -1431,7 +1457,8 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
if ( !column.is()
|| !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_VALUE)
- || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) )
+ || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME)
+ || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_TYPE))
throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any() );
sal_Int32 nType = 0;
diff --git a/dbaccess/source/core/api/resultset.cxx b/dbaccess/source/core/api/resultset.cxx
index 8e91bda0e..f70e67f0f 100644
--- a/dbaccess/source/core/api/resultset.cxx
+++ b/dbaccess/source/core/api/resultset.cxx
@@ -1,1211 +1,1211 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: resultset.cxx,v $
- * $Revision: 1.21 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-#ifndef _DBA_COREAPI_RESULTSET_HXX_
-#include <resultset.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
-#include "dbastrings.hrc"
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
-#include "apitools.hxx"
-#endif
-#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
-#include <com/sun/star/lang/DisposedException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
-#include <comphelper/property.hxx>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
-#include <comphelper/types.hxx>
-#endif
-#ifndef _TOOLS_DEBUG_HXX //autogen
-#include <tools/debug.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
-#include <tools/diagnose_ex.h>
-#endif
-#ifndef _DBA_COREAPI_DATACOLUMN_HXX_
-#include <datacolumn.hxx>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
-#include <connectivity/dbexception.hxx>
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
-#include <connectivity/dbtools.hxx>
-#endif
-#ifndef _CPPUHELPER_EXC_HLP_HXX_
-#include <cppuhelper/exc_hlp.hxx>
-#endif
-#ifndef _OSL_THREAD_H_
-#include <osl/thread.h>
-#endif
-#include <rtl/logfile.hxx>
-
-
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-//using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::cppu;
-using namespace ::osl;
-using namespace dbaccess;
-using namespace dbtools;
-
-DBG_NAME(OResultSet)
-
-//--------------------------------------------------------------------------
-OResultSet::OResultSet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResultSet,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xStatement,
- sal_Bool _bCaseSensitive)
- :OResultSetBase(m_aMutex)
- ,OPropertySetHelper(OResultSetBase::rBHelper)
- ,m_xDelegatorResultSet(_xResultSet)
- ,m_aWarnings( Reference< XWarningsSupplier >( _xResultSet, UNO_QUERY ) )
- ,m_bIsBookmarkable(sal_False)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::OResultSet" );
- DBG_CTOR(OResultSet, NULL);
-
- m_pColumns = new OColumns(*this, m_aMutex, _bCaseSensitive, ::std::vector< ::rtl::OUString>(), NULL,NULL);
-
- try
- {
- m_aStatement = _xStatement;
- m_xDelegatorResultSetUpdate = m_xDelegatorResultSetUpdate.query( m_xDelegatorResultSet );
- m_xDelegatorRow = m_xDelegatorRow.query( m_xDelegatorResultSet );
- m_xDelegatorRowUpdate = m_xDelegatorRowUpdate.query( m_xDelegatorResultSet );
-
- Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
- xSet->getPropertyValue(PROPERTY_RESULTSETTYPE) >>= m_nResultSetType;
- xSet->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY) >>= m_nResultSetConcurrency;
-
- // test for Bookmarks
- if (ResultSetType::FORWARD_ONLY != m_nResultSetType)
- {
- Reference <XPropertySetInfo > xInfo(xSet->getPropertySetInfo());
- if (xInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE))
- {
- m_bIsBookmarkable = ::comphelper::getBOOL(xSet->getPropertyValue(PROPERTY_ISBOOKMARKABLE));
- OSL_ENSURE( !m_bIsBookmarkable || Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is(),
- "OResultSet::OResultSet: aggregate is inconsistent in it's bookmarkable attribute!" );
- m_bIsBookmarkable = m_bIsBookmarkable && Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is();
- }
- }
- }
- catch(Exception&)
- {
- }
-}
-
-//--------------------------------------------------------------------------
-OResultSet::~OResultSet()
-{
- m_pColumns->acquire();
- m_pColumns->disposing();
- delete m_pColumns;
-
- DBG_DTOR(OResultSet, NULL);
-}
-
-// com::sun::star::lang::XTypeProvider
-//--------------------------------------------------------------------------
-Sequence< Type > OResultSet::getTypes() throw (RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTypes" );
- OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ),
- OResultSetBase::getTypes());
-
- return aTypes.getTypes();
-}
-
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OResultSet::getImplementationId() throw (RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationId" );
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::uno::XInterface
-//--------------------------------------------------------------------------
-Any OResultSet::queryInterface( const Type & rType ) throw (RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" );
- Any aIface = OResultSetBase::queryInterface( rType );
- if (!aIface.hasValue())
- aIface = ::cppu::queryInterface(
- rType,
- static_cast< XPropertySet * >( this ));
-
- return aIface;
-}
-
-//--------------------------------------------------------------------------
-void OResultSet::acquire() throw ()
-{
- OResultSetBase::acquire();
-}
-
-//--------------------------------------------------------------------------
-void OResultSet::release() throw ()
-{
- OResultSetBase::release();
-}
-
-
-// OResultSetBase
-//------------------------------------------------------------------------------
-void OResultSet::disposing()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
- OPropertySetHelper::disposing();
-
- MutexGuard aGuard(m_aMutex);
-
- // free the columns
- m_pColumns->disposing();
-
- // close the pending result set
- Reference< XCloseable > (m_xDelegatorResultSet, UNO_QUERY)->close();
-
- m_xDelegatorResultSet = NULL;
- m_xDelegatorRow = NULL;
- m_xDelegatorRowUpdate = NULL;
-
- m_aStatement = Reference< XInterface >();
-}
-
-// XCloseable
-//------------------------------------------------------------------------------
-void OResultSet::close(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::close" );
- {
- MutexGuard aGuard( m_aMutex );
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
- }
- dispose();
-}
-
-// XServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString OResultSet::getImplementationName( ) throw(RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationName" );
- return rtl::OUString::createFromAscii("com.sun.star.sdb.OResultSet");
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::supportsService" );
- return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
-}
-
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > OResultSet::getSupportedServiceNames( ) throw (RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getSupportedServiceNames" );
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = SERVICE_SDBC_RESULTSET;
- aSNS[1] = SERVICE_SDB_RESULTSET;
- return aSNS;
-}
-
-// com::sun::star::beans::XPropertySet
-//------------------------------------------------------------------------------
-Reference< XPropertySetInfo > OResultSet::getPropertySetInfo() throw (RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" );
- return createPropertySetInfo( getInfoHelper() ) ;
-}
-
-// comphelper::OPropertyArrayUsageHelper
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" );
- BEGIN_PROPERTY_HELPER(6)
- DECL_PROP1(CURSORNAME, ::rtl::OUString, READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP1_BOOL(ISBOOKMARKABLE, READONLY);
- DECL_PROP1(RESULTSETCONCURRENCY, sal_Int32, READONLY);
- DECL_PROP1(RESULTSETTYPE, sal_Int32, READONLY);
- END_PROPERTY_HELPER();
-}
-
-// cppu::OPropertySetHelper
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& OResultSet::getInfoHelper()
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" );
- return *getArrayHelper();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::convertFastPropertyValue" );
- // be lazy ...
- rConvertedValue = rValue;
- getFastPropertyValue( rOldValue, nHandle );
- return sal_True;
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::setFastPropertyValue_NoBroadcast" );
- // set it for the driver result set
- Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
- switch (nHandle)
- {
- case PROPERTY_ID_FETCHDIRECTION:
- xSet->setPropertyValue(PROPERTY_FETCHDIRECTION, rValue);
- break;
- case PROPERTY_ID_FETCHSIZE:
- xSet->setPropertyValue(PROPERTY_FETCHSIZE, rValue);
- break;
- default:
- DBG_ERROR("unknown Property");
- }
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFastPropertyValue" );
- switch (nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- {
- sal_Bool bVal = m_bIsBookmarkable;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- default:
- {
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- const_cast<OResultSet*>(this)->getInfoHelper().
- fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- rValue = Reference< XPropertySet >(m_xDelegatorResultSet, UNO_QUERY)->getPropertyValue(aPropName);
- }
- }
-}
-
-// XWarningsSupplier
-//------------------------------------------------------------------------------
-Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
- return m_aWarnings.getWarnings();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
- m_aWarnings.clearWarnings();
-}
-
-// ::com::sun::star::sdbc::XResultSetMetaDataSupplier
-//------------------------------------------------------------------------------
-Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
-}
-
-// ::com::sun::star::sdbc::XColumnLocate
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::findColumn" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return Reference< XColumnLocate >(m_xDelegatorResultSet, UNO_QUERY)->findColumn(columnName);
-}
-
-//------------------------------------------------------------------------------
-namespace
-{
- static Reference< XDatabaseMetaData > lcl_getDBMetaDataFromStatement_nothrow( const Reference< XInterface >& _rxStatement )
- {
- Reference< XDatabaseMetaData > xDBMetaData;
- try
- {
- Reference< XStatement > xStatement( _rxStatement, UNO_QUERY );
- Reference< XPreparedStatement > xPreparedStatement( _rxStatement, UNO_QUERY );
- Reference< XConnection > xConn;
- if ( xStatement.is() )
- xConn = xStatement->getConnection();
- else if ( xPreparedStatement.is() )
- xConn = xPreparedStatement->getConnection();
- if ( xConn.is() )
- xDBMetaData = xConn->getMetaData();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return xDBMetaData;
- }
-}
-// ::com::sun::star::sdbcx::XColumnsSupplier
-//------------------------------------------------------------------------------
-Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(void) throw( RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getColumns" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- // do we have to populate the columns
- if (!m_pColumns->isInitialized())
- {
- // get the metadata
- Reference< XResultSetMetaData > xMetaData = Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
-
- sal_Int32 nColCount = 0;
- // do we have columns
- try
- {
- Reference< XDatabaseMetaData > xDBMetaData( lcl_getDBMetaDataFromStatement_nothrow( getStatement() ) );
- nColCount = xMetaData->getColumnCount();
-
- for ( sal_Int32 i = 0; i < nColCount; ++i)
- {
- // retrieve the name of the column
- rtl::OUString sName = xMetaData->getColumnName(i + 1);
- ODataColumn* pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
-
- // don't silently assume that the name is unique - result set implementations
- // are allowed to return duplicate names, but we are required to have
- // unique column names
- if ( m_pColumns->hasByName( sName ) )
- sName = ::dbtools::createUniqueName( m_pColumns, sName );
-
- m_pColumns->append( sName, pColumn );
- }
- }
- catch ( const SQLException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- m_pColumns->setInitialized();
-
- #if OSL_DEBUG_LEVEL > 0
- // some sanity checks. Especially in case we auto-adjusted the column names above,
- // this might be reasonable
- try
- {
- const Reference< XNameAccess > xColNames( static_cast< XNameAccess* >( m_pColumns ), UNO_SET_THROW );
- const Sequence< ::rtl::OUString > aNames( xColNames->getElementNames() );
- OSL_POSTCOND( aNames.getLength() == nColCount,
- "OResultSet::getColumns: invalid column count!" );
- for ( const ::rtl::OUString* pName = aNames.getConstArray();
- pName != aNames.getConstArray() + aNames.getLength();
- ++pName
- )
- {
- Reference< XPropertySet > xColProps( xColNames->getByName( *pName ), UNO_QUERY_THROW );
- ::rtl::OUString sName;
- OSL_VERIFY( xColProps->getPropertyValue( PROPERTY_NAME ) >>= sName );
- OSL_POSTCOND( sName == *pName, "OResultSet::getColumns: invalid column name!" );
- }
-
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- #endif
- }
- return m_pColumns;
-}
-
-// ::com::sun::star::sdbc::XRow
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::wasNull" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->wasNull();
-}
-//------------------------------------------------------------------------------
-rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getString" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getString(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getBoolean(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getByte" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getByte(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getShort" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getShort(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInt" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getInt(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getLong" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getLong(columnIndex);
-}
-//------------------------------------------------------------------------------
-float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFloat" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getFloat(columnIndex);
-}
-//------------------------------------------------------------------------------
-double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDouble" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getDouble(columnIndex);
-}
-//------------------------------------------------------------------------------
-Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBytes" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getBytes(columnIndex);
-}
-//------------------------------------------------------------------------------
-::com::sun::star::util::Date OResultSet::getDate(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDate" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getDate(columnIndex);
-}
-//------------------------------------------------------------------------------
-::com::sun::star::util::Time OResultSet::getTime(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTime" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getTime(columnIndex);
-}
-//------------------------------------------------------------------------------
-::com::sun::star::util::DateTime OResultSet::getTimestamp(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getTimestamp(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getBinaryStream(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getCharacterStream(columnIndex);
-}
-//------------------------------------------------------------------------------
-Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getObject" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getObject(columnIndex, typeMap);
-}
-//------------------------------------------------------------------------------
-Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRef" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getRef(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBlob" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getBlob(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getClob" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getClob(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getArray" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getArray(columnIndex);
-}
-
-// ::com::sun::star::sdbc::XRowUpdate
-//------------------------------------------------------------------------------
-void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNull" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateNull(columnIndex);
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateBoolean(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateByte" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateByte(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateShort" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateShort(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateInt" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateInt(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateLong" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateLong(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateFloat(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateDouble(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateString" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateString(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateBytes(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDate" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateDate(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTime" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateTime(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateTimestamp(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateBinaryStream(columnIndex, x, length);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateCharacterStream(columnIndex, x, length);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateNumericObject(columnIndex, x, scale);
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateObject" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateObject(columnIndex, x);
-}
-
-// ::com::sun::star::sdbc::XResultSet
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::next" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->next();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->isBeforeFirst();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->isAfterLast();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isFirst" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->isFirst();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isLast" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->isLast();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- m_xDelegatorResultSet->beforeFirst();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::afterLast(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::afterLast" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- m_xDelegatorResultSet->afterLast();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::first" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->first();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::last" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->last();
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->getRow();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::absolute" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->absolute(row);
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::relative" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->relative(rows);
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::previous" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->previous();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::refreshRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- m_xDelegatorResultSet->refreshRow();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowUpdated" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->rowUpdated();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->rowInserted();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->rowDeleted();
-}
-
-//------------------------------------------------------------------------------
-Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getStatement" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_aStatement;
-}
-
-// ::com::sun::star::sdbcx::XRowLocate
-//------------------------------------------------------------------------------
-Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBookmark" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->getBookmark();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToBookmark" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveToBookmark(bookmark);
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveRelativeToBookmark" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveRelativeToBookmark(bookmark, rows);
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::compareBookmarks(const Any& _first, const Any& _second) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::compareBookmarks" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->compareBookmarks(_first, _second);
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hasOrderedBookmarks" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hasOrderedBookmarks();
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hashBookmark" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hashBookmark(bookmark);
-}
-
-// ::com::sun::star::sdbc::XResultSetUpdate
-//------------------------------------------------------------------------------
-void OResultSet::insertRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::insertRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->insertRow();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::updateRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->updateRow();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::deleteRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->deleteRow();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->cancelRowUpdates();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->moveToInsertRow();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::moveToCurrentRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->moveToCurrentRow();
-}
-
-// -----------------------------------------------------------------------------
-void OResultSet::checkReadOnly() const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkReadOnly" );
- if ( ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
- || !m_xDelegatorResultSetUpdate.is()
- )
- throwSQLException( "The result set is read-only.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
-}
-
-// -----------------------------------------------------------------------------
-void OResultSet::checkBookmarkable() const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkBookmarkable" );
- if ( !m_bIsBookmarkable )
- throwSQLException( "The result set does not have bookmark support.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
-}
-// -----------------------------------------------------------------------------
-
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: resultset.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_dbaccess.hxx"
+#ifndef _DBA_COREAPI_RESULTSET_HXX_
+#include <resultset.hxx>
+#endif
+#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
+#include "dbastrings.hrc"
+#endif
+#ifndef _DBASHARED_APITOOLS_HXX_
+#include "apitools.hxx"
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _COMPHELPER_PROPERTY_HXX_
+#include <comphelper/property.hxx>
+#endif
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef TOOLS_DIAGNOSE_EX_H
+#include <tools/diagnose_ex.h>
+#endif
+#ifndef _DBA_COREAPI_DATACOLUMN_HXX_
+#include <datacolumn.hxx>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include <connectivity/dbtools.hxx>
+#endif
+#ifndef _CPPUHELPER_EXC_HLP_HXX_
+#include <cppuhelper/exc_hlp.hxx>
+#endif
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
+#endif
+#include <rtl/logfile.hxx>
+
+
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+//using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace dbaccess;
+using namespace dbtools;
+
+DBG_NAME(OResultSet)
+
+//--------------------------------------------------------------------------
+OResultSet::OResultSet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResultSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xStatement,
+ sal_Bool _bCaseSensitive)
+ :OResultSetBase(m_aMutex)
+ ,OPropertySetHelper(OResultSetBase::rBHelper)
+ ,m_xDelegatorResultSet(_xResultSet)
+ ,m_aWarnings( Reference< XWarningsSupplier >( _xResultSet, UNO_QUERY ) )
+ ,m_bIsBookmarkable(sal_False)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::OResultSet" );
+ DBG_CTOR(OResultSet, NULL);
+
+ m_pColumns = new OColumns(*this, m_aMutex, _bCaseSensitive, ::std::vector< ::rtl::OUString>(), NULL,NULL);
+
+ try
+ {
+ m_aStatement = _xStatement;
+ m_xDelegatorResultSetUpdate = m_xDelegatorResultSetUpdate.query( m_xDelegatorResultSet );
+ m_xDelegatorRow = m_xDelegatorRow.query( m_xDelegatorResultSet );
+ m_xDelegatorRowUpdate = m_xDelegatorRowUpdate.query( m_xDelegatorResultSet );
+
+ Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
+ xSet->getPropertyValue(PROPERTY_RESULTSETTYPE) >>= m_nResultSetType;
+ xSet->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY) >>= m_nResultSetConcurrency;
+
+ // test for Bookmarks
+ if (ResultSetType::FORWARD_ONLY != m_nResultSetType)
+ {
+ Reference <XPropertySetInfo > xInfo(xSet->getPropertySetInfo());
+ if (xInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE))
+ {
+ m_bIsBookmarkable = ::comphelper::getBOOL(xSet->getPropertyValue(PROPERTY_ISBOOKMARKABLE));
+ OSL_ENSURE( !m_bIsBookmarkable || Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is(),
+ "OResultSet::OResultSet: aggregate is inconsistent in it's bookmarkable attribute!" );
+ m_bIsBookmarkable = m_bIsBookmarkable && Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is();
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ }
+}
+
+//--------------------------------------------------------------------------
+OResultSet::~OResultSet()
+{
+ m_pColumns->acquire();
+ m_pColumns->disposing();
+ delete m_pColumns;
+
+ DBG_DTOR(OResultSet, NULL);
+}
+
+// com::sun::star::lang::XTypeProvider
+//--------------------------------------------------------------------------
+Sequence< Type > OResultSet::getTypes() throw (RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTypes" );
+ OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ),
+ OResultSetBase::getTypes());
+
+ return aTypes.getTypes();
+}
+
+//--------------------------------------------------------------------------
+Sequence< sal_Int8 > OResultSet::getImplementationId() throw (RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationId" );
+ static OImplementationId * pId = 0;
+ if (! pId)
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+// com::sun::star::uno::XInterface
+//--------------------------------------------------------------------------
+Any OResultSet::queryInterface( const Type & rType ) throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" );
+ Any aIface = OResultSetBase::queryInterface( rType );
+ if (!aIface.hasValue())
+ aIface = ::cppu::queryInterface(
+ rType,
+ static_cast< XPropertySet * >( this ));
+
+ return aIface;
+}
+
+//--------------------------------------------------------------------------
+void OResultSet::acquire() throw ()
+{
+ OResultSetBase::acquire();
+}
+
+//--------------------------------------------------------------------------
+void OResultSet::release() throw ()
+{
+ OResultSetBase::release();
+}
+
+
+// OResultSetBase
+//------------------------------------------------------------------------------
+void OResultSet::disposing()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
+ OPropertySetHelper::disposing();
+
+ MutexGuard aGuard(m_aMutex);
+
+ // free the columns
+ m_pColumns->disposing();
+
+ // close the pending result set
+ Reference< XCloseable > (m_xDelegatorResultSet, UNO_QUERY)->close();
+
+ m_xDelegatorResultSet = NULL;
+ m_xDelegatorRow = NULL;
+ m_xDelegatorRowUpdate = NULL;
+
+ m_aStatement = Reference< XInterface >();
+}
+
+// XCloseable
+//------------------------------------------------------------------------------
+void OResultSet::close(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::close" );
+ {
+ MutexGuard aGuard( m_aMutex );
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+ }
+ dispose();
+}
+
+// XServiceInfo
+//------------------------------------------------------------------------------
+rtl::OUString OResultSet::getImplementationName( ) throw(RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationName" );
+ return rtl::OUString::createFromAscii("com.sun.star.sdb.OResultSet");
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::supportsService" );
+ return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
+}
+
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString > OResultSet::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getSupportedServiceNames" );
+ Sequence< ::rtl::OUString > aSNS( 2 );
+ aSNS[0] = SERVICE_SDBC_RESULTSET;
+ aSNS[1] = SERVICE_SDB_RESULTSET;
+ return aSNS;
+}
+
+// com::sun::star::beans::XPropertySet
+//------------------------------------------------------------------------------
+Reference< XPropertySetInfo > OResultSet::getPropertySetInfo() throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" );
+ return createPropertySetInfo( getInfoHelper() ) ;
+}
+
+// comphelper::OPropertyArrayUsageHelper
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" );
+ BEGIN_PROPERTY_HELPER(6)
+ DECL_PROP1(CURSORNAME, ::rtl::OUString, READONLY);
+ DECL_PROP0(FETCHDIRECTION, sal_Int32);
+ DECL_PROP0(FETCHSIZE, sal_Int32);
+ DECL_PROP1_BOOL(ISBOOKMARKABLE, READONLY);
+ DECL_PROP1(RESULTSETCONCURRENCY, sal_Int32, READONLY);
+ DECL_PROP1(RESULTSETTYPE, sal_Int32, READONLY);
+ END_PROPERTY_HELPER();
+}
+
+// cppu::OPropertySetHelper
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& OResultSet::getInfoHelper()
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" );
+ return *getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException )
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::convertFastPropertyValue" );
+ // be lazy ...
+ rConvertedValue = rValue;
+ getFastPropertyValue( rOldValue, nHandle );
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::setFastPropertyValue_NoBroadcast" );
+ // set it for the driver result set
+ Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
+ switch (nHandle)
+ {
+ case PROPERTY_ID_FETCHDIRECTION:
+ xSet->setPropertyValue(PROPERTY_FETCHDIRECTION, rValue);
+ break;
+ case PROPERTY_ID_FETCHSIZE:
+ xSet->setPropertyValue(PROPERTY_FETCHSIZE, rValue);
+ break;
+ default:
+ DBG_ERROR("unknown Property");
+ }
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFastPropertyValue" );
+ switch (nHandle)
+ {
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ {
+ sal_Bool bVal = m_bIsBookmarkable;
+ rValue.setValue(&bVal, getBooleanCppuType());
+ } break;
+ default:
+ {
+ // get the property name
+ ::rtl::OUString aPropName;
+ sal_Int16 nAttributes;
+ const_cast<OResultSet*>(this)->getInfoHelper().
+ fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
+ OSL_ENSURE(aPropName.getLength(), "property not found?");
+
+ // now read the value
+ rValue = Reference< XPropertySet >(m_xDelegatorResultSet, UNO_QUERY)->getPropertyValue(aPropName);
+ }
+ }
+}
+
+// XWarningsSupplier
+//------------------------------------------------------------------------------
+Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+ return m_aWarnings.getWarnings();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+ m_aWarnings.clearWarnings();
+}
+
+// ::com::sun::star::sdbc::XResultSetMetaDataSupplier
+//------------------------------------------------------------------------------
+Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
+}
+
+// ::com::sun::star::sdbc::XColumnLocate
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::findColumn" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return Reference< XColumnLocate >(m_xDelegatorResultSet, UNO_QUERY)->findColumn(columnName);
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ static Reference< XDatabaseMetaData > lcl_getDBMetaDataFromStatement_nothrow( const Reference< XInterface >& _rxStatement )
+ {
+ Reference< XDatabaseMetaData > xDBMetaData;
+ try
+ {
+ Reference< XStatement > xStatement( _rxStatement, UNO_QUERY );
+ Reference< XPreparedStatement > xPreparedStatement( _rxStatement, UNO_QUERY );
+ Reference< XConnection > xConn;
+ if ( xStatement.is() )
+ xConn = xStatement->getConnection();
+ else if ( xPreparedStatement.is() )
+ xConn = xPreparedStatement->getConnection();
+ if ( xConn.is() )
+ xDBMetaData = xConn->getMetaData();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xDBMetaData;
+ }
+}
+// ::com::sun::star::sdbcx::XColumnsSupplier
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(void) throw( RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getColumns" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ // do we have to populate the columns
+ if (!m_pColumns->isInitialized())
+ {
+ // get the metadata
+ Reference< XResultSetMetaData > xMetaData = Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
+
+ sal_Int32 nColCount = 0;
+ // do we have columns
+ try
+ {
+ Reference< XDatabaseMetaData > xDBMetaData( lcl_getDBMetaDataFromStatement_nothrow( getStatement() ) );
+ nColCount = xMetaData->getColumnCount();
+
+ for ( sal_Int32 i = 0; i < nColCount; ++i)
+ {
+ // retrieve the name of the column
+ rtl::OUString sName = xMetaData->getColumnName(i + 1);
+ ODataColumn* pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
+
+ // don't silently assume that the name is unique - result set implementations
+ // are allowed to return duplicate names, but we are required to have
+ // unique column names
+ if ( m_pColumns->hasByName( sName ) )
+ sName = ::dbtools::createUniqueName( m_pColumns, sName );
+
+ m_pColumns->append( sName, pColumn );
+ }
+ }
+ catch ( const SQLException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ m_pColumns->setInitialized();
+
+ #if OSL_DEBUG_LEVEL > 0
+ // some sanity checks. Especially in case we auto-adjusted the column names above,
+ // this might be reasonable
+ try
+ {
+ const Reference< XNameAccess > xColNames( static_cast< XNameAccess* >( m_pColumns ), UNO_SET_THROW );
+ const Sequence< ::rtl::OUString > aNames( xColNames->getElementNames() );
+ OSL_POSTCOND( aNames.getLength() == nColCount,
+ "OResultSet::getColumns: invalid column count!" );
+ for ( const ::rtl::OUString* pName = aNames.getConstArray();
+ pName != aNames.getConstArray() + aNames.getLength();
+ ++pName
+ )
+ {
+ Reference< XPropertySet > xColProps( xColNames->getByName( *pName ), UNO_QUERY_THROW );
+ ::rtl::OUString sName;
+ OSL_VERIFY( xColProps->getPropertyValue( PROPERTY_NAME ) >>= sName );
+ OSL_POSTCOND( sName == *pName, "OResultSet::getColumns: invalid column name!" );
+ }
+
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ #endif
+ }
+ return m_pColumns;
+}
+
+// ::com::sun::star::sdbc::XRow
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::wasNull" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->wasNull();
+}
+//------------------------------------------------------------------------------
+rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getString" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getString(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBoolean(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getByte" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getByte(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getShort" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getShort(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInt" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getInt(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getLong" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getLong(columnIndex);
+}
+//------------------------------------------------------------------------------
+float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFloat" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getFloat(columnIndex);
+}
+//------------------------------------------------------------------------------
+double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDouble" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getDouble(columnIndex);
+}
+//------------------------------------------------------------------------------
+Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBytes" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBytes(columnIndex);
+}
+//------------------------------------------------------------------------------
+::com::sun::star::util::Date OResultSet::getDate(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDate" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getDate(columnIndex);
+}
+//------------------------------------------------------------------------------
+::com::sun::star::util::Time OResultSet::getTime(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTime" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getTime(columnIndex);
+}
+//------------------------------------------------------------------------------
+::com::sun::star::util::DateTime OResultSet::getTimestamp(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getTimestamp(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBinaryStream(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getCharacterStream(columnIndex);
+}
+//------------------------------------------------------------------------------
+Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getObject" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getObject(columnIndex, typeMap);
+}
+//------------------------------------------------------------------------------
+Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRef" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getRef(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBlob" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBlob(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getClob" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getClob(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getArray" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getArray(columnIndex);
+}
+
+// ::com::sun::star::sdbc::XRowUpdate
+//------------------------------------------------------------------------------
+void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNull" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateNull(columnIndex);
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateBoolean(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateByte" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateByte(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateShort" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateShort(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateInt" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateInt(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateLong" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateLong(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateFloat(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateDouble(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateString" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateString(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateBytes(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDate" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateDate(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTime" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateTime(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateTimestamp(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateBinaryStream(columnIndex, x, length);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateCharacterStream(columnIndex, x, length);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateNumericObject(columnIndex, x, scale);
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateObject" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateObject(columnIndex, x);
+}
+
+// ::com::sun::star::sdbc::XResultSet
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::next" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->next();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isBeforeFirst();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isAfterLast();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isFirst" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isFirst();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isLast" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isLast();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ m_xDelegatorResultSet->beforeFirst();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::afterLast(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::afterLast" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ m_xDelegatorResultSet->afterLast();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::first" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->first();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::last" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->last();
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->getRow();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::absolute" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->absolute(row);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::relative" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->relative(rows);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::previous" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->previous();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::refreshRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ m_xDelegatorResultSet->refreshRow();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowUpdated" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->rowUpdated();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->rowInserted();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->rowDeleted();
+}
+
+//------------------------------------------------------------------------------
+Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getStatement" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_aStatement;
+}
+
+// ::com::sun::star::sdbcx::XRowLocate
+//------------------------------------------------------------------------------
+Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->getBookmark();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveToBookmark(bookmark);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveRelativeToBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveRelativeToBookmark(bookmark, rows);
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::compareBookmarks(const Any& _first, const Any& _second) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::compareBookmarks" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->compareBookmarks(_first, _second);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hasOrderedBookmarks" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hasOrderedBookmarks();
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hashBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hashBookmark(bookmark);
+}
+
+// ::com::sun::star::sdbc::XResultSetUpdate
+//------------------------------------------------------------------------------
+void OResultSet::insertRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::insertRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->insertRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::updateRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->updateRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::deleteRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->deleteRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->cancelRowUpdates();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->moveToInsertRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::moveToCurrentRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->moveToCurrentRow();
+}
+
+// -----------------------------------------------------------------------------
+void OResultSet::checkReadOnly() const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkReadOnly" );
+ if ( ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
+ || !m_xDelegatorResultSetUpdate.is()
+ )
+ throwSQLException( "The result set is read-only.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
+}
+
+// -----------------------------------------------------------------------------
+void OResultSet::checkBookmarkable() const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkBookmarkable" );
+ if ( !m_bIsBookmarkable )
+ throwSQLException( "The result set does not have bookmark support.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
+}
+// -----------------------------------------------------------------------------
+
diff --git a/dbaccess/source/core/api/statement.cxx b/dbaccess/source/core/api/statement.cxx
index 1611cb84c..da5532ea3 100644
--- a/dbaccess/source/core/api/statement.cxx
+++ b/dbaccess/source/core/api/statement.cxx
@@ -111,12 +111,14 @@ Sequence< Type > OStatementBase::getTypes() throw (RuntimeException)
::getCppuType( (const Reference< XWarningsSupplier > *)0 ),
::getCppuType( (const Reference< XCloseable > *)0 ),
::getCppuType( (const Reference< XMultipleResults > *)0 ),
- ::getCppuType( (const Reference< XPreparedBatchExecution > *)0 ),
::getCppuType( (const Reference< ::com::sun::star::util::XCancellable > *)0 ),
OSubComponent::getTypes() );
Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY);
if ( xGRes.is() )
aTypes = OTypeCollection(::getCppuType( (const Reference< XGeneratedResultSet > *)0 ),aTypes.getTypes());
+ Reference< XPreparedBatchExecution > xPreparedBatchExecution(m_xAggregateAsSet, UNO_QUERY);
+ if ( xPreparedBatchExecution.is() )
+ aTypes = OTypeCollection(::getCppuType( (const Reference< XPreparedBatchExecution > *)0 ),aTypes.getTypes());
return aTypes.getTypes();
}
@@ -134,7 +136,6 @@ Any OStatementBase::queryInterface( const Type & rType ) throw (RuntimeException
static_cast< XPropertySet * >( this ),
static_cast< XWarningsSupplier * >( this ),
static_cast< XCloseable * >( this ),
- static_cast< XPreparedBatchExecution * >( this ),
static_cast< XMultipleResults * >( this ),
static_cast< ::com::sun::star::util::XCancellable * >( this ));
if ( !aIface.hasValue() )
@@ -142,6 +143,12 @@ Any OStatementBase::queryInterface( const Type & rType ) throw (RuntimeException
Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY);
if ( ::getCppuType( (const Reference< XGeneratedResultSet > *)0 ) == rType && xGRes.is() )
aIface = ::cppu::queryInterface(rType,static_cast< XGeneratedResultSet * >( this ));
+ } // if ( !aIface.hasValue() )
+ if ( !aIface.hasValue() )
+ {
+ Reference< XPreparedBatchExecution > xGRes(m_xAggregateAsSet, UNO_QUERY);
+ if ( ::getCppuType( (const Reference< XPreparedBatchExecution > *)0 ) == rType && xGRes.is() )
+ aIface = ::cppu::queryInterface(rType,static_cast< XPreparedBatchExecution * >( this ));
}
}
return aIface;
@@ -583,6 +590,46 @@ sal_Bool OStatement::execute( const rtl::OUString& _rSQL ) throw( SQLException,
::rtl::OUString sSQL( impl_doEscapeProcessing_nothrow( _rSQL ) );
return m_xAggregateStatement->execute( sSQL );
}
+//------------------------------------------------------------------------------
+void OStatement::addBatch( const rtl::OUString& _rSQL ) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+
+ // first check the meta data
+ Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
+ if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ throwFunctionSequenceException(*this);
+
+ ::rtl::OUString sSQL( impl_doEscapeProcessing_nothrow( _rSQL ) );
+ Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->addBatch( sSQL );
+}
+//------------------------------------------------------------------------------
+void OStatement::clearBatch( ) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ // first check the meta data
+ Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
+ if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ throwFunctionSequenceException(*this);
+
+ Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->clearBatch();
+}
+//------------------------------------------------------------------------------
+Sequence< sal_Int32 > OStatement::executeBatch( ) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ // first check the meta data
+ Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
+ if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ throwFunctionSequenceException(*this);
+ return Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->executeBatch( );
+}
//------------------------------------------------------------------------------
Reference< XConnection > OStatement::getConnection(void) throw( SQLException, RuntimeException )
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 69d9b797d..1148cf440 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -608,7 +608,8 @@ void ODatabaseModelImpl::clearConnections()
aConnections.swap( m_aConnections );
Reference< XConnection > xConn;
- for ( OWeakConnectionArray::iterator i = aConnections.begin(); aConnections.end() != i; ++i )
+ OWeakConnectionArray::iterator aEnd = aConnections.end();
+ for ( OWeakConnectionArray::iterator i = aConnections.begin(); aEnd != i; ++i )
{
xConn = *i;
if ( xConn.is() )
diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx
index 028dc1386..4eded6a82 100644
--- a/dbaccess/source/core/dataaccess/connection.cxx
+++ b/dbaccess/source/core/dataaccess/connection.cxx
@@ -534,7 +534,8 @@ void OConnection::disposing()
OSubComponent::disposing();
OConnectionWrapper::disposing();
- for (OWeakRefArrayIterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
+ OWeakRefArrayIterator aEnd = m_aStatements.end();
+ for (OWeakRefArrayIterator i = m_aStatements.begin(); aEnd != i; ++i)
{
Reference<XComponent> xComp(i->get(),UNO_QUERY);
::comphelper::disposeComponent(xComp);
@@ -549,7 +550,8 @@ void OConnection::disposing()
::comphelper::disposeComponent(m_xQueries);
- for (OWeakRefArrayIterator j = m_aComposers.begin(); m_aComposers.end() != j; ++j)
+ OWeakRefArrayIterator aComposerEnd = m_aComposers.end();
+ for (OWeakRefArrayIterator j = m_aComposers.begin(); aComposerEnd != j; ++j)
{
Reference<XComponent> xComp(j->get(),UNO_QUERY);
::comphelper::disposeComponent(xComp);
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 92ce7bd95..d1e5e8c56 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -610,6 +610,11 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
aThisDriverSettings.getNodeValue(getDbLocationNodeName()) >>= sURL;
sURL = SvtPathOptions().SubstituteVariable(sURL);
+ if ( m_aDatabaseObjects.find( _rName ) != m_aDatabaseObjects.end() )
+ {
+ m_aDatasourceProperties[ sURL ] = m_aDatasourceProperties[ _rName ];
+ }
+
// check if URL is already loaded
ObjectCacheIterator aExistent = m_aDatabaseObjects.find(sURL);
if ( aExistent != m_aDatabaseObjects.end() )
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 73de7893f..7aaf0d2e4 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1102,7 +1102,8 @@ void ODatabaseDocument::impl_closeControllerFrames_nolck_throw( sal_Bool _bDeliv
{
Controllers aCopy = m_aControllers;
- for ( Controllers::iterator aIter = aCopy.begin(); aIter != aCopy.end() ; ++aIter )
+ Controllers::iterator aEnd = aCopy.end();
+ for ( Controllers::iterator aIter = aCopy.begin(); aIter != aEnd ; ++aIter )
{
if ( !aIter->is() )
continue;
diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
index 19b991349..0943b6a85 100644
--- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
+++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
@@ -160,8 +160,8 @@ namespace dbaccess
sal_Int32 getPredicateType(::connectivity::OSQLParseNode * _pPredicate) const;
// clears all Columns,Parameters and tables and insert it to their vectors
void clearCurrentCollections();
- // clear only the parameter columns
- void clearParametersCollection();
+ // clears the columns collection given by EColumnType
+ void clearColumns( const EColumnType _eType );
/** retrieves a particular part of a statement
@param _rIterator
diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc
index 81e8b8d2c..b18a1d2ed 100644
--- a/dbaccess/source/core/inc/core_resource.hrc
+++ b/dbaccess/source/core/inc/core_resource.hrc
@@ -89,8 +89,5 @@
#define RID_STR_NAME_NOT_FOUND ( RID_CORE_STRINGS_START + 45 )
#define RID_STR_QUERY_DOES_NOT_EXIST ( RID_CORE_STRINGS_START + 46 )
-#define RSC_DATASOURCE_TYPES ( RID_CORE_OTHER_START + 1 )
-#define RSC_DATASOURCE_TYPE_UINAMES ( RID_CORE_OTHER_START + 2 )
-
#endif // _DBA_CORE_RESOURCE_HRC_
diff --git a/dbaccess/source/core/inc/statement.hxx b/dbaccess/source/core/inc/statement.hxx
index 9d992f0bb..7bfc929da 100644
--- a/dbaccess/source/core/inc/statement.hxx
+++ b/dbaccess/source/core/inc/statement.hxx
@@ -54,6 +54,7 @@
#ifndef _COM_SUN_STAR_SDBC_XPREPAREDBATCHEXECUTION_HDL_
#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
#endif
+#include <com/sun/star/sdbc/XBatchExecution.hpp>
#ifndef _COM_SUN_STAR_SDBC_XGENERATEDRESULTSET_HPP_
#include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
#endif
@@ -72,9 +73,8 @@
#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
#include <comphelper/broadcasthelper.hxx>
#endif
-#ifndef _CPPUHELPER_IMPLBASE2_HXX_
-#include <cppuhelper/implbase2.hxx>
-#endif
+
+#include <cppuhelper/implbase3.hxx>
//************************************************************
// OStatementBase
@@ -171,8 +171,9 @@ protected:
//************************************************************
// OStatement
//************************************************************
-typedef ::cppu::ImplHelper2 < ::com::sun::star::sdbc::XStatement
+typedef ::cppu::ImplHelper3 < ::com::sun::star::sdbc::XStatement
, ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::sdbc::XBatchExecution
> OStatement_IFACE;
class OStatement :public OStatementBase
,public OStatement_IFACE
@@ -203,6 +204,13 @@ public:
// OComponentHelper
virtual void SAL_CALL disposing();
+ // XBatchExecution
+ virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ using OStatementBase::addBatch;
+
private:
/** does escape processing for the given SQL command, if the our EscapeProcessing
property allows so.
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 15427b008..e49b3fa8a 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -34,18 +34,20 @@
#include "dsntypes.hxx"
#include "dbamiscres.hrc"
#include <unotools/confignode.hxx>
-#include <tools/rc.hxx>
#include <tools/debug.hxx>
+#include <tools/wldcrd.hxx>
#include <osl/file.hxx>
#include "dbastrings.hrc"
#include "core_resource.hxx"
#include "core_resource.hrc"
#include <comphelper/documentconstants.hxx>
+#include <connectivity/DriversConfig.hxx>
//.........................................................................
namespace dbaccess
{
//.........................................................................
+ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
@@ -61,84 +63,31 @@ namespace dbaccess
_nPortNumber = _sUrl.GetToken(1,':').ToInt32();
}
}
- class ODataSourceTypeStringListResource : public Resource
- {
- ::std::vector<String> m_aStrings;
- public:
- ODataSourceTypeStringListResource(USHORT _nResId ) : Resource(ResId(_nResId,*ResourceManager::getResManager()))
- {
- m_aStrings.reserve(STR_END);
- for (int i = STR_MYSQL_ODBC; i < STR_END ; ++i)
- {
- m_aStrings.push_back(String(DBA_RES(sal::static_int_cast<USHORT>(i))));
- }
-
- }
- ~ODataSourceTypeStringListResource()
- {
- FreeResource();
- }
- /** fill the vector with our readed strings
- @param _rToFill
- Vector to fill.
- */
- inline void fill( ::std::vector<String>& _rToFill )
- {
- _rToFill = m_aStrings;
- }
- };
-
- ::rtl::OUString lcl_getUserDefinedDriverNodeName()
- {
- static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess/UserDefinedDriverSettings"));
- return s_sNodeName;
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString lcl_getDriverTypeDisplayNodeName()
- {
- static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("DriverTypeDisplayName"));
- return s_sNodeName;
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString lcl_getDriverDsnPrefixNodeName()
- {
- static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("DriverDsnPrefix"));
- return s_sNodeName;
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString lcl_getDriverExtensionNodeName()
- {
- static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("Extension"));
- return s_sNodeName;
- }
-
}
//=========================================================================
//= ODsnTypeCollection
//=========================================================================
DBG_NAME(ODsnTypeCollection)
//-------------------------------------------------------------------------
-ODsnTypeCollection::ODsnTypeCollection()
+ODsnTypeCollection::ODsnTypeCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory)
+:m_xFactory(_xFactory)
#ifdef DBG_UTIL
-:m_nLivingIterators(0)
+,m_nLivingIterators(0)
#endif
{
DBG_CTOR(ODsnTypeCollection,NULL);
- ODataSourceTypeStringListResource aTypes(RSC_DATASOURCE_TYPES);
- aTypes.fill(m_aDsnPrefixes);
-
- ODataSourceTypeStringListResource aDisplayNames(RSC_DATASOURCE_TYPE_UINAMES);
- aDisplayNames.fill(m_aDsnTypesDisplayNames);
-
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+ const ::rtl::OUString* pIter = aURLs.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
+ for(;pIter != pEnd;++pIter )
+ {
+ m_aDsnPrefixes.push_back(*pIter);
+ m_aDsnTypesDisplayNames.push_back(aDriverConfig.getDriverTypeDisplayName(*pIter));
+ }
DBG_ASSERT(m_aDsnTypesDisplayNames.size() == m_aDsnPrefixes.size(),
"ODsnTypeCollection::ODsnTypeCollection : invalid resources !");
- String sCurrentType;
-
- for (StringVector::iterator aIter = m_aDsnPrefixes.begin();aIter != m_aDsnPrefixes.end();++aIter)
- {
- m_aDsnTypes.push_back(implDetermineType(*aIter));
- }
}
//-------------------------------------------------------------------------
@@ -147,302 +96,261 @@ ODsnTypeCollection::~ODsnTypeCollection()
DBG_DTOR(ODsnTypeCollection,NULL);
DBG_ASSERT(0 == m_nLivingIterators, "ODsnTypeCollection::~ODsnTypeCollection : there are still living iterator objects!");
}
-// -----------------------------------------------------------------------------
-void ODsnTypeCollection::initUserDriverTypes(const Reference< XMultiServiceFactory >& _rxORB)
+//-------------------------------------------------------------------------
+String ODsnTypeCollection::getTypeDisplayName(const ::rtl::OUString& _sURL) const
{
- // read the user driver out of the configuration
- // the config node where all pooling relevant info are stored under
- ::utl::OConfigurationTreeRoot aUserDefinedDriverRoot = ::utl::OConfigurationTreeRoot::createWithServiceFactory(
- _rxORB, lcl_getUserDefinedDriverNodeName(), -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
-
- if ( aUserDefinedDriverRoot.isValid() )
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ return aDriverConfig.getDriverTypeDisplayName(_sURL);
+}
+//-------------------------------------------------------------------------
+String ODsnTypeCollection::cutPrefix(const ::rtl::OUString& _sURL) const
+{
+ String sURL( _sURL);
+ String sRet;
+ String sOldPattern;
+ StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
+ StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
+ for(;aIter != aEnd;++aIter)
{
- Sequence< ::rtl::OUString > aDriverKeys = aUserDefinedDriverRoot.getNodeNames();
- const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
- const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
- for (sal_Int32 i=0;pDriverKeys != pDriverKeysEnd && i <= DST_USERDEFINE10; ++pDriverKeys)
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.Len() < aIter->Len() && aWildCard.Matches(_sURL) )
{
- ::utl::OConfigurationNode aThisDriverSettings = aUserDefinedDriverRoot.openNode(*pDriverKeys);
- if ( aThisDriverSettings.isValid() )
- {
- // read the needed information
- ::rtl::OUString sDsnPrefix,sDsnTypeDisplayName,sExtension;
- aThisDriverSettings.getNodeValue(lcl_getDriverTypeDisplayNodeName()) >>= sDsnTypeDisplayName;
- aThisDriverSettings.getNodeValue(lcl_getDriverDsnPrefixNodeName()) >>= sDsnPrefix;
- aThisDriverSettings.getNodeValue(lcl_getDriverExtensionNodeName()) >>= sExtension;
-
- m_aDsnTypesDisplayNames.push_back(sDsnTypeDisplayName);
- m_aDsnPrefixes.push_back(sDsnPrefix);
- m_aDsnTypes.push_back(static_cast<DATASOURCE_TYPE>(DST_USERDEFINE1 + i++));
- m_aUserExtensions.push_back(sExtension);
- }
+ if ( aIter->Len() < sURL.Len() )
+ sRet = sURL.Copy(sURL.Match(*aIter));
+ else
+ sRet = sURL.Copy(aIter->Match(sURL));
+ sOldPattern = *aIter;
}
}
+
+ return sRet;
}
-
//-------------------------------------------------------------------------
-DATASOURCE_TYPE ODsnTypeCollection::getType(const String& _rDsn) const
+String ODsnTypeCollection::getPrefix(const ::rtl::OUString& _sURL) const
{
- DATASOURCE_TYPE eType = DST_UNKNOWN;
- // look for user defined driver types
+ String sURL( _sURL);
+ String sRet;
+ String sOldPattern;
StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
- for (; aIter != aEnd; ++aIter)
+ for(;aIter != aEnd;++aIter)
{
- if ( _rDsn.Len() >= aIter->Len() && aIter->EqualsIgnoreCaseAscii(_rDsn,0, aIter->Len()) )
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.Len() < aIter->Len() && aWildCard.Matches(sURL) )
{
- size_t nPos = (aIter - m_aDsnPrefixes.begin());
- if ( nPos < m_aDsnTypes.size() )
- {
- eType = m_aDsnTypes[nPos];
- break;
- }
+ if ( aIter->Len() < sURL.Len() )
+ sRet = aIter->Copy(0,sURL.Match(*aIter));
+ else
+ sRet = sURL.Copy(0,aIter->Match(sURL));
+ sRet.EraseTrailingChars('*');
+ sOldPattern = *aIter;
}
}
- return eType;
+
+ return sRet;
}
-
-//-------------------------------------------------------------------------
-String ODsnTypeCollection::getTypeDisplayName(DATASOURCE_TYPE _eType) const
+// -----------------------------------------------------------------------------
+bool ODsnTypeCollection::isConnectionUrlRequired(const ::rtl::OUString& _sURL) const
{
- String sDisplayName;
-
- sal_Int32 nIndex = implDetermineTypeIndex(_eType);
- if ((nIndex >= 0) && (nIndex < (sal_Int32)m_aDsnTypesDisplayNames.size()))
- sDisplayName = m_aDsnTypesDisplayNames[nIndex];
-
- return sDisplayName;
+ String sURL( _sURL);
+ String sRet;
+ String sOldPattern;
+ StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
+ StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
+ for(;aIter != aEnd;++aIter)
+ {
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.Len() < aIter->Len() && aWildCard.Matches(sURL) )
+ {
+ sRet = *aIter;
+ sOldPattern = *aIter;
+ }
+ } // for(;aIter != aEnd;++aIter)
+ return sRet.GetChar(sRet.Len()-1) == '*';
}
-
-//-------------------------------------------------------------------------
-String ODsnTypeCollection::getDatasourcePrefix(DATASOURCE_TYPE _eType) const
+// -----------------------------------------------------------------------------
+String ODsnTypeCollection::getMediaType(const ::rtl::OUString& _sURL) const
{
- String sPrefix;
- sal_Int32 nIndex = implDetermineTypeIndex(_eType);
- if ((nIndex >= 0) && (nIndex < (sal_Int32)m_aDsnPrefixes.size()))
- sPrefix = m_aDsnPrefixes[nIndex];
-
- return sPrefix;
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("MediaType",::rtl::OUString());
}
-
-//-------------------------------------------------------------------------
-String ODsnTypeCollection::cutPrefix(const String& _rDsn) const
+// -----------------------------------------------------------------------------
+String ODsnTypeCollection::getDatasourcePrefixFromMediaType(const ::rtl::OUString& _sMediaType,const ::rtl::OUString& _sExtension)
{
- DATASOURCE_TYPE eType = getType(_rDsn);
- String sPrefix = getDatasourcePrefix(eType);
- return _rDsn.Copy(sPrefix.Len());
+ String sURL;
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+ const ::rtl::OUString* pIter = aURLs.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
+ for(;pIter != pEnd;++pIter )
+ {
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(*pIter);
+ if ( aFeatures.getOrDefault("MediaType",::rtl::OUString()) == _sMediaType )
+ {
+ const ::rtl::OUString sFileExtension = aFeatures.getOrDefault("Extension",::rtl::OUString());
+ if ( (sFileExtension.getLength() && _sExtension == sFileExtension ) || !sFileExtension.getLength() || !_sExtension.getLength() )
+ {
+ sURL = *pIter;
+ break;
+ }
+ }
+ } // for(;pIter != pEnd;++pIter )
+ sURL.EraseTrailingChars('*');
+ return sURL;
}
// -----------------------------------------------------------------------------
-String ODsnTypeCollection::getMediaType(DATASOURCE_TYPE _eType) const
+bool ODsnTypeCollection::isShowPropertiesEnabled( const ::rtl::OUString& _sURL ) const
{
- String sRet;
- switch (_eType)
- {
- case DST_DBASE:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("application/dbase"));
- break;
- case DST_FLAT:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("text/csv"));
- break;
- case DST_CALC:
- sRet = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET;
- break;
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("application/msaccess"));
- break;
- default:
- break;
- }
- return sRet;
+ return !( _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:embedded:hsqldb",sizeof("sdbc:embedded:hsqldb")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:outlook",sizeof("sdbc:address:outlook")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:outlookexp",sizeof("sdbc:address:outlookexp")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:mozilla:",sizeof("sdbc:address:mozilla:")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:kab",sizeof("sdbc:address:kab")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:evolution:local",sizeof("sdbc:address:evolution:local")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:evolution:groupwise",sizeof("sdbc:address:evolution:groupwise")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:evolution:ldap",sizeof("sdbc:address:evolution:ldap")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:macab",sizeof("sdbc:address:macab")-1) );
}
// -----------------------------------------------------------------------------
-String ODsnTypeCollection::getDatasourcePrefixFromMediaType(const String& _sMediaType,const String& _sExtension)
+void ODsnTypeCollection::extractHostNamePort(const ::rtl::OUString& _rDsn,String& _sDatabaseName,String& _rsHostname,sal_Int32& _nPortNumber) const
{
- ::rtl::OUString sURL(RTL_CONSTASCII_USTRINGPARAM("sdbc:"));
- if ( _sMediaType.EqualsIgnoreCaseAscii( "text/csv" ) )
+ String sUrl = cutPrefix(_rDsn);
+ if ( _rDsn.matchIgnoreAsciiCaseAsciiL("jdbc:oracle:thin:",sizeof("jdbc:oracle:thin:")-1) )
{
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("flat:"));
+ lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
+ if ( !_rsHostname.Len() && sUrl.GetTokenCount(':') == 2 )
+ {
+ _nPortNumber = -1;
+ _rsHostname = sUrl.GetToken(0,':');
+ }
+ if ( _rsHostname.Len() )
+ _rsHostname = _rsHostname.GetToken(_rsHostname.GetTokenCount('@') - 1,'@');
+ _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':');
+ } // if ( _rDsn.matchIgnoreAsciiCaseAsciiL("jdbc:oracle:thin:",sizeof("jdbc:oracle:thin:")-1) )
+ else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:address:ldap:",sizeof("sdbc:address:ldap:")-1) )
+ {
+ lcl_extractHostAndPort(sUrl,_sDatabaseName,_nPortNumber);
}
- else if ( _sMediaType.EqualsIgnoreCaseAscii( "application/dbase" ) )
+ else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:adabas:",sizeof("sdbc:adabas:")-1) )
{
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dbase:"));
+ if ( sUrl.GetTokenCount(':') == 2 )
+ _rsHostname = sUrl.GetToken(0,':');
+ _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':');
}
- else if ( _sMediaType.EqualsIgnoreCaseAscii( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) )
+ else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:mysql:mysqlc:",sizeof("sdbc:mysql:mysqlc:")-1) || _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:mysql:jdbc:",sizeof("sdbc:mysql:jdbc:")-1) )
{
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("calc:"));
+ lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
+
+ if ( _nPortNumber == -1 && !_rsHostname.Len() && sUrl.GetTokenCount('/') == 2 )
+ _rsHostname = sUrl.GetToken(0,'/');
+ _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount('/') - 1,'/');
}
- else if ( _sMediaType.EqualsIgnoreCaseAscii( "application/msaccess" ) )
+ else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=",sizeof("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")-1)
+ || _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=",sizeof("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=")-1))
{
- if ( _sExtension.EqualsIgnoreCaseAscii( "mdb" ) )
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="));
- else
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE="));
+ ::rtl::OUString sNewFileName;
+ if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None )
+ {
+ _sDatabaseName = sNewFileName;
+ }
}
- return sURL;
}
// -----------------------------------------------------------------------------
-void ODsnTypeCollection::extractHostNamePort(const String& _rDsn,String& _sDatabaseName,String& _rsHostname,sal_Int32& _nPortNumber) const
+String ODsnTypeCollection::getJavaDriverClass(const ::rtl::OUString& _sURL) const
{
- DATASOURCE_TYPE eType = getType(_rDsn);
- String sUrl = cutPrefix(_rDsn);
- switch( eType )
- {
- case DST_ORACLE_JDBC:
- lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
- if ( !_rsHostname.Len() && sUrl.GetTokenCount(':') == 2 )
- {
- _nPortNumber = -1;
- _rsHostname = sUrl.GetToken(0,':');
- }
- if ( _rsHostname.Len() )
- _rsHostname = _rsHostname.GetToken(_rsHostname.GetTokenCount('@') - 1,'@');
- _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':');
- break;
- case DST_LDAP:
- lcl_extractHostAndPort(sUrl,_sDatabaseName,_nPortNumber);
- break;
- case DST_ADABAS:
- if ( sUrl.GetTokenCount(':') == 2 )
- _rsHostname = sUrl.GetToken(0,':');
- _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':');
- break;
- case DST_MYSQL_NATIVE:
- case DST_MYSQL_JDBC:
- {
- lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
-
- if ( _nPortNumber == -1 && !_rsHostname.Len() && sUrl.GetTokenCount('/') == 2 )
- _rsHostname = sUrl.GetToken(0,'/');
- _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount('/') - 1,'/');
- }
- break;
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- {
- ::rtl::OUString sNewFileName;
- if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None )
- {
- _sDatabaseName = sNewFileName;
- }
- }
- break;
- default:
- break;
- }
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getProperties(_sURL);
+ return aFeatures.getOrDefault("JavaDriverClass",::rtl::OUString());
}
-
//-------------------------------------------------------------------------
-sal_Bool ODsnTypeCollection::isFileSystemBased(DATASOURCE_TYPE _eType) const
+sal_Bool ODsnTypeCollection::isFileSystemBased(const ::rtl::OUString& _sURL) const
{
- switch (_eType)
- {
- case DST_DBASE:
- case DST_FLAT:
- case DST_CALC:
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- return sal_True;
-
- case DST_USERDEFINE1:
- case DST_USERDEFINE2:
- case DST_USERDEFINE3:
- case DST_USERDEFINE4:
- case DST_USERDEFINE5:
- case DST_USERDEFINE6:
- case DST_USERDEFINE7:
- case DST_USERDEFINE8:
- case DST_USERDEFINE9:
- case DST_USERDEFINE10:
- {
- StringVector::size_type nPos = static_cast<sal_Int16>(_eType-DST_USERDEFINE1);
- return nPos < m_aUserExtensions.size() && m_aUserExtensions[nPos].Len() != 0;
- }
- default:
- return sal_False;
- }
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("FileSystemBased",sal_False);
+}
+// -----------------------------------------------------------------------------
+sal_Bool ODsnTypeCollection::supportsTableCreation(const ::rtl::OUString& _sURL) const
+{
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("SupportsTableCreation",sal_False);
+}
+// -----------------------------------------------------------------------------
+sal_Bool ODsnTypeCollection::supportsBrowsing(const ::rtl::OUString& _sURL) const
+{
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("SupportsBrowsing",sal_False);
+}
+// -----------------------------------------------------------------------------
+bool ODsnTypeCollection::needsJVM(const String& _sURL) const
+{
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("UseJava",sal_False);
+}
+// -----------------------------------------------------------------------------
+Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( const ::rtl::OUString& _sURL ) const
+{
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURL);
+ return aProperties.getPropertyValues();
}
-
-sal_Bool ODsnTypeCollection::supportsTableCreation(DATASOURCE_TYPE _eType)
+// -----------------------------------------------------------------------------
+String ODsnTypeCollection::getTypeExtension(const ::rtl::OUString& _sURL) const
{
- BOOL bSupportsTableCreation;
- switch( _eType )
- {
- case DST_MOZILLA:
- case DST_OUTLOOK:
- case DST_OUTLOOKEXP:
- case DST_FLAT:
- case DST_EVOLUTION:
- case DST_EVOLUTION_GROUPWISE:
- case DST_EVOLUTION_LDAP:
- case DST_KAB:
- case DST_THUNDERBIRD:
- case DST_CALC:
- bSupportsTableCreation = FALSE;
- break;
- case DST_DBASE:
- case DST_ADABAS:
- case DST_ADO:
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- case DST_MYSQL_ODBC:
- case DST_ODBC:
- case DST_MYSQL_JDBC:
- case DST_MYSQL_NATIVE:
- case DST_ORACLE_JDBC:
- case DST_LDAP:
- case DST_JDBC:
- default:
- bSupportsTableCreation = TRUE;
- break;
- }
- return bSupportsTableCreation;
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("Extension",::rtl::OUString());
+}
+//-------------------------------------------------------------------------
+bool ODsnTypeCollection::isEmbeddedDatabase( const ::rtl::OUString& _sURL ) const
+{
+ const ::rtl::OUString sEmbeddedDatabaseURL = getEmbeddedDatabase();
+ WildCard aWildCard(sEmbeddedDatabaseURL);
+ return aWildCard.Matches(_sURL);
}
// -----------------------------------------------------------------------------
-sal_Bool ODsnTypeCollection::supportsBrowsing(DATASOURCE_TYPE _eType)
+::rtl::OUString ODsnTypeCollection::getEmbeddedDatabase() const
{
- sal_Bool bEnableBrowseButton = sal_False;
- switch( _eType )
+ ::rtl::OUString sEmbeddedDatabaseURL;
+ static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess")); ///Installed
+ const ::utl::OConfigurationTreeRoot aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(m_xFactory, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
+ if ( aInstalled.isValid() )
{
- case DST_DBASE:
- case DST_FLAT:
- case DST_CALC:
- case DST_ADABAS:
- case DST_ADO:
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- case DST_MYSQL_ODBC:
- case DST_ODBC:
- case DST_MOZILLA:
- case DST_THUNDERBIRD:
- bEnableBrowseButton = TRUE;
- break;
- case DST_MYSQL_NATIVE:
- case DST_MYSQL_JDBC:
- case DST_ORACLE_JDBC:
- case DST_LDAP:
- case DST_OUTLOOK:
- case DST_OUTLOOKEXP:
- case DST_JDBC:
- case DST_EVOLUTION:
- case DST_EVOLUTION_GROUPWISE:
- case DST_EVOLUTION_LDAP:
- case DST_KAB:
- bEnableBrowseButton = FALSE;
- break;
- default:
- bEnableBrowseButton = getTypeExtension(_eType).Len() != 0;
- break;
- }
- return bEnableBrowseButton;
+ if ( aInstalled.hasByName("EmbeddedDatabases/DefaultEmbeddedDatabase/Value") )
+ {
+ static const ::rtl::OUString s_sValue(RTL_CONSTASCII_USTRINGPARAM("EmbeddedDatabases/DefaultEmbeddedDatabase/Value"));
+
+ aInstalled.getNodeValue(s_sValue) >>= sEmbeddedDatabaseURL;
+ if ( sEmbeddedDatabaseURL.getLength() )
+ aInstalled.getNodeValue(s_sValue + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sEmbeddedDatabaseURL + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/URL"))) >>= sEmbeddedDatabaseURL;
+ }
+ } // if ( aInstalled.isValid() )
+ if ( !sEmbeddedDatabaseURL.getLength() )
+ sEmbeddedDatabaseURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:embedded:hsqldb"));
+ return sEmbeddedDatabaseURL;
+}
+//-------------------------------------------------------------------------
+ODsnTypeCollection::TypeIterator ODsnTypeCollection::begin() const
+{
+ return TypeIterator(this, 0);
}
-
//-------------------------------------------------------------------------
-DATASOURCE_TYPE ODsnTypeCollection::implDetermineType(const String& _rDsn) const
+ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const
{
- sal_uInt16 nSeparator = _rDsn.Search((sal_Unicode)':');
+ return TypeIterator(this, m_aDsnTypesDisplayNames.size());
+}
+//-------------------------------------------------------------------------
+DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const
+{
+ String sDsn(_rDsn);
+ sDsn.EraseTrailingChars('*');
+ sal_uInt16 nSeparator = sDsn.Search((sal_Unicode)':');
if (STRING_NOTFOUND == nSeparator)
{
// there should be at least one such separator
@@ -450,19 +358,19 @@ DATASOURCE_TYPE ODsnTypeCollection::implDetermineType(const String& _rDsn) const
return DST_UNKNOWN;
}
// find first :
- sal_uInt16 nOracleSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1);
+ sal_uInt16 nOracleSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1);
if ( nOracleSeparator != STRING_NOTFOUND )
{
- nOracleSeparator = _rDsn.Search((sal_Unicode)':', nOracleSeparator + 1);
- if (nOracleSeparator != STRING_NOTFOUND && _rDsn.EqualsIgnoreCaseAscii("jdbc:oracle:thin", 0, nOracleSeparator))
+ nOracleSeparator = sDsn.Search((sal_Unicode)':', nOracleSeparator + 1);
+ if (nOracleSeparator != STRING_NOTFOUND && sDsn.EqualsIgnoreCaseAscii("jdbc:oracle:thin", 0, nOracleSeparator))
return DST_ORACLE_JDBC;
}
- if (_rDsn.EqualsIgnoreCaseAscii("jdbc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("jdbc", 0, nSeparator))
return DST_JDBC;
// find second :
- nSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1);
+ nSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1);
if (STRING_NOTFOUND == nSeparator)
{
// at the moment only jdbc is allowed to have just one separator
@@ -470,156 +378,185 @@ DATASOURCE_TYPE ODsnTypeCollection::implDetermineType(const String& _rDsn) const
return DST_UNKNOWN;
}
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:adabas", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:adabas", 0, nSeparator))
return DST_ADABAS;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:odbc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:odbc", 0, nSeparator))
return DST_ODBC;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:dbase", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:dbase", 0, nSeparator))
return DST_DBASE;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:ado:", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:ado:", 0, nSeparator))
{
- nSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1);
- if (STRING_NOTFOUND != nSeparator && _rDsn.EqualsIgnoreCaseAscii("sdbc:ado:access",0, nSeparator) )
+ nSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1);
+ if (STRING_NOTFOUND != nSeparator && sDsn.EqualsIgnoreCaseAscii("sdbc:ado:access",0, nSeparator) )
{
- nSeparator = _rDsn.Search((sal_Unicode)';', nSeparator + 1);
- if (STRING_NOTFOUND != nSeparator && _rDsn.EqualsIgnoreCaseAscii("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0",0, nSeparator) )
+ nSeparator = sDsn.Search((sal_Unicode)';', nSeparator + 1);
+ if (STRING_NOTFOUND != nSeparator && sDsn.EqualsIgnoreCaseAscii("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0",0, nSeparator) )
return DST_MSACCESS_2007;
return DST_MSACCESS;
}
return DST_ADO;
}
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:flat:", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:flat:", 0, nSeparator))
return DST_FLAT;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:calc:", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:calc:", 0, nSeparator))
return DST_CALC;
- //if ( ( 11 <= nSeparator) && _rDsn.EqualsIgnoreCaseAscii("sdbc:mysqlc:", 0, nSeparator))
+ //if ( ( 11 <= nSeparator) && sDsn.EqualsIgnoreCaseAscii("sdbc:mysqlc:", 0, nSeparator))
// return DST_MYSQL_NATIVE;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:embedded:hsqldb", 0, _rDsn.Len()))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:embedded:hsqldb", 0, sDsn.Len()))
return DST_EMBEDDED_HSQLDB;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:address:", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:address:", 0, nSeparator))
{
++nSeparator;
- if (_rDsn.EqualsIgnoreCaseAscii("mozilla:", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("mozilla:", nSeparator,sDsn.Len() - nSeparator))
return DST_MOZILLA;
- if (_rDsn.EqualsIgnoreCaseAscii("thunderbird:", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("thunderbird:", nSeparator,sDsn.Len() - nSeparator))
return DST_THUNDERBIRD;
- if (_rDsn.EqualsIgnoreCaseAscii("ldap:", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("ldap:", nSeparator,sDsn.Len() - nSeparator))
return DST_LDAP;
- if (_rDsn.EqualsIgnoreCaseAscii("outlook", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("outlook", nSeparator,sDsn.Len() - nSeparator))
return DST_OUTLOOK;
- if (_rDsn.EqualsIgnoreCaseAscii("outlookexp", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("outlookexp", nSeparator,sDsn.Len() - nSeparator))
return DST_OUTLOOKEXP;
- if (_rDsn.EqualsIgnoreCaseAscii("evolution:ldap", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("evolution:ldap", nSeparator,sDsn.Len() - nSeparator))
return DST_EVOLUTION_LDAP;
- if (_rDsn.EqualsIgnoreCaseAscii("evolution:groupwise", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("evolution:groupwise", nSeparator,sDsn.Len() - nSeparator))
return DST_EVOLUTION_GROUPWISE;
- if (_rDsn.EqualsIgnoreCaseAscii("evolution:local", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("evolution:local", nSeparator,sDsn.Len() - nSeparator))
return DST_EVOLUTION;
- if (_rDsn.EqualsIgnoreCaseAscii("kab", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("kab", nSeparator,sDsn.Len() - nSeparator))
return DST_KAB;
- if (_rDsn.EqualsIgnoreCaseAscii("macab", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("macab", nSeparator,sDsn.Len() - nSeparator))
return DST_MACAB;
}
// find third :
- nSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1);
+ nSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1);
if (STRING_NOTFOUND == nSeparator)
{
DBG_ERROR("ODsnTypeCollection::implDetermineType : missing the third colon !");
return DST_UNKNOWN;
}
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:mysql:odbc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:mysql:odbc", 0, nSeparator))
return DST_MYSQL_ODBC;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:mysql:jdbc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:mysql:jdbc", 0, nSeparator))
return DST_MYSQL_JDBC;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:mysql:mysqlc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:mysql:mysqlc", 0, nSeparator))
return DST_MYSQL_NATIVE;
DBG_ERROR("ODsnTypeCollection::implDetermineType : unrecognized data source type !");
return DST_UNKNOWN;
}
// -----------------------------------------------------------------------------
-sal_Int32 ODsnTypeCollection::implDetermineTypeIndex(DATASOURCE_TYPE _eType) const
+void ODsnTypeCollection::fillPageIds(const ::rtl::OUString& _sURL,::std::vector<sal_Int16>& _rOutPathIds) const
{
- DBG_ASSERT(
- (m_aDsnTypesDisplayNames.size() == m_aDsnPrefixes.size())
- && (m_aDsnTypesDisplayNames.size() == m_aDsnTypes.size()),
- "ODsnTypeCollection::implDetermineTypeIndex : inconsistent structures !");
-
- // the type of the datasource described by the DSN string
- if (DST_UNKNOWN == _eType)
+ DATASOURCE_TYPE eType = determineType(_sURL);
+ switch(eType)
{
- return -1;
+ case DST_ADO:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ADO);
+ break;
+ case DST_DBASE:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_DBASE);
+ break;
+ case DST_FLAT:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_TEXT);
+ break;
+ case DST_CALC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_SPREADSHEET);
+ break;
+ case DST_ODBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ODBC);
+ break;
+ case DST_JDBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_JDBC);
+ break;
+ case DST_MYSQL_ODBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_INTRO);
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_ODBC);
+ break;
+ case DST_MYSQL_JDBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_INTRO);
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_JDBC);
+ break;
+ case DST_MYSQL_NATIVE:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_INTRO);
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_NATIVE);
+ break;
+ case DST_ORACLE_JDBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ORACLE);
+ break;
+ case DST_ADABAS:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ADABAS);
+ break;
+ case DST_LDAP:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_LDAP);
+ break;
+ case DST_MSACCESS:
+ case DST_MSACCESS_2007:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MSACCESS);
+ break;
+ case DST_OUTLOOKEXP:
+ case DST_OUTLOOK:
+ case DST_MOZILLA:
+ case DST_THUNDERBIRD:
+ case DST_EVOLUTION:
+ case DST_EVOLUTION_GROUPWISE:
+ case DST_EVOLUTION_LDAP:
+ case DST_KAB:
+ case DST_MACAB:
+ case DST_EMBEDDED_HSQLDB:
+ break;
+ default:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_USERDEFINED);
+ break;
}
-
- // search this type in our arrays
- sal_Int32 nIndex = 0;
- ConstTypeVectorIterator aSearch = m_aDsnTypes.begin();
-
- for (; aSearch != m_aDsnTypes.end(); ++nIndex, ++aSearch)
- if (*aSearch == _eType)
- return nIndex;
-
- DBG_ERROR("ODsnTypeCollection::implDetermineTypeIndex : recognized the DSN schema, but did not find the type!");
- return -1;
}
// -----------------------------------------------------------------------------
-Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( DATASOURCE_TYPE _eType ) const
+::rtl::OUString ODsnTypeCollection::getType(const ::rtl::OUString& _sURL) const
{
- Sequence< PropertyValue > aSettings;
-
- switch ( _eType )
+ ::rtl::OUString sOldPattern;
+ StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
+ StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
+ for(;aIter != aEnd;++aIter)
{
- case DST_EMBEDDED_HSQLDB:
- aSettings.realloc( 3 );
-
- aSettings[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoIncrementCreation" ) );
- aSettings[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IDENTITY" ) );
-
- aSettings[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoRetrievingStatement" ) );
- aSettings[1].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CALL IDENTITY()" ) );
-
- aSettings[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutoRetrievingEnabled" ) );
- aSettings[2].Value <<= (sal_Bool)sal_True;
- break;
-
- default:
- DBG_ERROR( "ODsnTypeCollection::getDefaultDBSettings: type is unsupported by this method!" );
- break;
- }
-
- return aSettings;
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.getLength() < aIter->Len() && aWildCard.Matches(_sURL) )
+ {
+ sOldPattern = *aIter;
+ }
+ } // for(sal_Int32 i = 0;aIter != aEnd;++aIter,++i)
+ return sOldPattern;
}
-
// -----------------------------------------------------------------------------
-String ODsnTypeCollection::getTypeExtension(DATASOURCE_TYPE _eType) const
-{
- StringVector::size_type nPos = static_cast<sal_uInt16>(_eType-DST_USERDEFINE1);
- return nPos < m_aUserExtensions.size() ? m_aUserExtensions[nPos] : String();
-}
-//-------------------------------------------------------------------------
-bool ODsnTypeCollection::isEmbeddedDatabase( DATASOURCE_TYPE _eType ) const
+sal_Int32 ODsnTypeCollection::getIndexOf(const ::rtl::OUString& _sURL) const
{
- // the only known embedded type so far is DST_EMBEDDED_HSQLDB
- return ( _eType == DST_EMBEDDED_HSQLDB );
-}
-//-------------------------------------------------------------------------
-ODsnTypeCollection::TypeIterator ODsnTypeCollection::begin() const
-{
- return TypeIterator(this, 0);
+ sal_Int32 nRet = -1;
+ String sURL( _sURL);
+ String sOldPattern;
+ StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
+ StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
+ for(sal_Int32 i = 0;aIter != aEnd;++aIter,++i)
+ {
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.Len() < aIter->Len() && aWildCard.Matches(sURL) )
+ {
+ nRet = i;
+ sOldPattern = *aIter;
+ }
+ }
+
+ return nRet;
}
-
-//-------------------------------------------------------------------------
-ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const
+// -----------------------------------------------------------------------------
+sal_Int32 ODsnTypeCollection::size() const
{
- return TypeIterator(this, m_aDsnTypes.size());
+ return m_aDsnPrefixes.size();
}
-
//=========================================================================
//= ODsnTypeCollection::TypeIterator
//=========================================================================
@@ -653,24 +590,22 @@ ODsnTypeCollection::TypeIterator::~TypeIterator()
}
//-------------------------------------------------------------------------
-DATASOURCE_TYPE ODsnTypeCollection::TypeIterator::getType() const
-{
- DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypes.size(), "ODsnTypeCollection::TypeIterator::getType : invalid position!");
- return m_pContainer->m_aDsnTypes[m_nPosition];
-}
-
-//-------------------------------------------------------------------------
String ODsnTypeCollection::TypeIterator::getDisplayName() const
{
DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size(), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!");
return m_pContainer->m_aDsnTypesDisplayNames[m_nPosition];
}
-
+// -----------------------------------------------------------------------------
+::rtl::OUString ODsnTypeCollection::TypeIterator::getURLPrefix() const
+{
+ DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnPrefixes.size(), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!");
+ return m_pContainer->m_aDsnPrefixes[m_nPosition];
+}
//-------------------------------------------------------------------------
const ODsnTypeCollection::TypeIterator& ODsnTypeCollection::TypeIterator::operator++()
{
- DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypes.size(), "ODsnTypeCollection::TypeIterator::operator++ : invalid position!");
- if (m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypes.size())
+ DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size(), "ODsnTypeCollection::TypeIterator::operator++ : invalid position!");
+ if (m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size())
++m_nPosition;
return *this;
}
diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src
index 88a1c0d3e..cb2c768c7 100644
--- a/dbaccess/source/core/resource/strings.src
+++ b/dbaccess/source/core/resource/strings.src
@@ -241,203 +241,3 @@ String RID_STR_NAME_NOT_FOUND
};
//-------------------------------------------------------------------------
-Resource RSC_DATASOURCE_TYPES
-{
- String STR_MYSQL_ODBC
- {
- Text ="sdbc:mysql:odbc:";
- };
- String STR_MYSQL_JDBC
- {
- Text ="sdbc:mysql:jdbc:";
- };
- String STR_ADABAS
- {
- Text ="sdbc:adabas:";
- };
- String STR_ORACLE_JDBC
- {
- Text ="jdbc:oracle:thin:";
- };
- String STR_JDBC
- {
- Text ="jdbc:";
- };
- String STR_ODBC
- {
- Text ="sdbc:odbc:";
- };
- String STR_DBASE
- {
- Text ="sdbc:dbase:";
- };
- String STR_MSACCESS
- {
- Text ="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=";
- };
- String STR_MSACCESS2007
- {
- Text ="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=";
- };
- String STR_ADO
- {
- Text ="sdbc:ado:";
- };
- String STR_FLAT
- {
- Text ="sdbc:flat:";
- };
- String STR_CALC
- {
- Text ="sdbc:calc:";
- };
- String STR_MOZILLA
- {
- Text ="sdbc:address:mozilla:";
- };
- String STR_LDAP
- {
- Text ="sdbc:address:ldap:";
- };
- String STR_OUTLOOK
- {
- Text ="sdbc:address:outlook";
- };
- String STR_OUTLOOKEXP
- {
- Text ="sdbc:address:outlookexp";
- };
- String STR_EVOLUTION
- {
- Text ="sdbc:address:evolution:local";
- };
- String STR_EVOLUTION_GROUPWISE
- {
- Text ="sdbc:address:evolution:groupwise";
- };
- String STR_EVOLUTION_LDAP
- {
- Text ="sdbc:address:evolution:ldap";
- };
- String STR_KAB
- {
- Text ="sdbc:address:kab";
- };
- String STR_EMBEDDED_HSQLDB
- {
- Text = "sdbc:embedded:hsqldb";
- };
- String STR_MACAB
- {
- Text ="sdbc:address:macab";
- };
- String STR_THUNDERBIRD
- {
- Text ="sdbc:address:thunderbird:";
- };
- String STR_MYSQL_NATIVE
- {
- Text ="sdbc:mysql:mysqlc:";
- };
-};
-
-Resource RSC_DATASOURCE_TYPE_UINAMES
-{
- String STR_MYSQL_ODBC
- {
- Text[ en-US ] = "MySQL (ODBC)";
- };
- String STR_MYSQL_JDBC
- {
- Text[ en-US ] = "MySQL (JDBC)";
- };
- String STR_ADABAS
- {
- Text[ en-US ] = "Adabas D";
- };
- String STR_ORACLE_JDBC
- {
- Text[ en-US ] = "Oracle JDBC";
- };
-
- String STR_JDBC
- {
- Text[ en-US ] = "JDBC";
- };
- String STR_ODBC
- {
- Text[ en-US ] = "ODBC";
- };
- String STR_DBASE
- {
- Text[ en-US ] = "dBASE";
- };
- String STR_MSACCESS
- {
- Text[ en-US ] = "Microsoft Access";
- };
- String STR_MSACCESS2007
- {
- Text[ en-US ] = "Microsoft Access 2007";
- };
- String STR_ADO
- {
- Text[ en-US ] = "ADO";
- };
- String STR_FLAT
- {
- Text[ en-US ] = "Text";
- };
- String STR_CALC
- {
- Text[ en-US ] = "Spreadsheet";
- };
- String STR_MOZILLA
- {
- Text[ en-US ] = "Mozilla Address Book";
- };
- String STR_LDAP
- {
- Text[ en-US ] = "LDAP Address Book";
- };
- String STR_OUTLOOK
- {
- Text[ en-US ] = "Microsoft Outlook Address Book";
- };
- String STR_OUTLOOKEXP
- {
- Text[ en-US ] = "Microsoft Windows Address Book";
- };
- String STR_EVOLUTION
- {
- Text[ en-US ] = "Evolution Local";
- };
- String STR_EVOLUTION_GROUPWISE
- {
- Text[ en-US ] = "Groupwise";
- };
- String STR_EVOLUTION_LDAP
- {
- Text[ en-US ] = "Evolution LDAP";
- };
- String STR_KAB
- {
- Text[ en-US ] = "KDE Address Book";
- };
- String STR_MACAB
- {
- Text[ en-US ] = "Mac OS X Address Book";
- };
- String STR_EMBEDDED_HSQLDB
- {
- Text[ en-US ] = "HSQL database engine";
- };
- String STR_THUNDERBIRD
- {
- Text[ en-US ] = "Thunderbird Address Book";
- };
- String STR_MYSQL_NATIVE
- {
- Text[ en-US ] = "MySQL (Native)";
- };
-};
diff --git a/dbaccess/source/ext/macromigration/makefile.mk b/dbaccess/source/ext/macromigration/makefile.mk
index 32be89263..b108cac66 100644
--- a/dbaccess/source/ext/macromigration/makefile.mk
+++ b/dbaccess/source/ext/macromigration/makefile.mk
@@ -78,6 +78,7 @@ SHL1STDLIBS= \
$(SVTOOLLIB) \
$(SVLLIB) \
$(VCLLIB) \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(UCBHELPERLIB) \
$(XMLSCRIPTLIB)
diff --git a/dbaccess/source/filter/xml/makefile.mk b/dbaccess/source/filter/xml/makefile.mk
index 8a7554ed4..41388880a 100644
--- a/dbaccess/source/filter/xml/makefile.mk
+++ b/dbaccess/source/filter/xml/makefile.mk
@@ -88,6 +88,8 @@ SHL1STDLIBS=\
$(CPPULIB) \
$(SFXLIB) \
$(SVLLIB) \
+ $(DBTOOLSLIB) \
+ $(UNOTOOLSLIB) \
$(SO2LIB) \
$(SALLIB)
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index e01984c75..f671ae235 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -106,6 +106,7 @@
#include <svtools/filenotation.hxx>
#include <svtools/pathoptions.hxx>
#include <tools/diagnose_ex.h>
+#include <connectivity/DriversConfig.hxx>
#include <boost/optional.hpp>
@@ -251,6 +252,7 @@ namespace dbaxml
// -----------------------------------------------------------------------------
ODBExport::ODBExport(const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 nExportFlag)
: SvXMLExport( _rxMSF,MAP_10TH_MM,XML_DATABASE, EXPORT_OASIS | nExportFlag)
+,m_aTypeCollection(_rxMSF)
,m_bAllreadyFilled(sal_False)
{
GetMM100UnitConverter().setCoreMeasureUnit(MAP_10TH_MM);
@@ -339,6 +341,11 @@ void ODBExport::exportDataSource()
xSettingsState->getPropertyDefault( INFO_DECIMALDELIMITER ) >>= aDelimiter.sDecimal;
xSettingsState->getPropertyDefault( INFO_THOUSANDSDELIMITER ) >>= aDelimiter.sThousand;
+ ::connectivity::DriversConfig aDriverConfig(getServiceFactory());
+ const ::rtl::OUString sURL = ::comphelper::getString(xProp->getPropertyValue(PROPERTY_URL));
+ ::comphelper::NamedValueCollection aMetaData = aDriverConfig.getMetaData(sURL);
+ aMetaData.merge( aDriverConfig.getProperties(sURL),true ) ;
+
static ::rtl::OUString s_sTrue(::xmloff::token::GetXMLToken( XML_TRUE ));
static ::rtl::OUString s_sFalse(::xmloff::token::GetXMLToken( XML_FALSE ));
// loop through the properties, and export only those which are not defaulted
@@ -507,8 +514,11 @@ void ODBExport::exportDataSource()
}
else
{
- m_aDataSourceSettings.push_back( TypedPropertyValue(
- pProperties->Name, pProperties->Type, aValue ) );
+ if ( !aMetaData.has(pProperties->Name) || aMetaData.get(pProperties->Name) != aValue )
+ {
+ m_aDataSourceSettings.push_back( TypedPropertyValue(
+ pProperties->Name, pProperties->Type, aValue ) );
+ }
continue;
}
}
@@ -609,8 +619,7 @@ void ODBExport::exportConnectionData()
::rtl::OUString sValue;
Reference<XPropertySet> xProp(getDataSource());
xProp->getPropertyValue(PROPERTY_URL) >>= sValue;
- const ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(sValue);
- if ( m_aTypeCollection.isFileSystemBased(eType) )
+ if ( m_aTypeCollection.isFileSystemBased(sValue) )
{
SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, sal_True, sal_True);
{
@@ -620,11 +629,16 @@ void ODBExport::exportConnectionData()
if ( sOrigUrl == sFileName )
{
::svt::OFileNotation aTransformer( sFileName );
- AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,GetRelativeReference(aTransformer.get( ::svt::OFileNotation::N_URL )));
+ ::rtl::OUStringBuffer sURL( aTransformer.get( ::svt::OFileNotation::N_URL ) );
+ if ( sURL.charAt(sURL.getLength()-1) != '/' )
+ sURL.append(sal_Unicode('/'));
+
+ AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,GetRelativeReference(sURL.makeStringAndClear()));
} // if ( sOrigUrl == sFileName )
else
AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,sOrigUrl);
- AddAttribute(XML_NAMESPACE_DB,XML_MEDIA_TYPE,m_aTypeCollection.getMediaType(eType));
+ AddAttribute(XML_NAMESPACE_DB,XML_MEDIA_TYPE,m_aTypeCollection.getMediaType(sValue));
+ const ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.determineType(sValue);
try
{
::rtl::OUString sExtension;
@@ -655,7 +669,7 @@ void ODBExport::exportConnectionData()
{
SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, sal_True, sal_True);
{
- String sType = m_aTypeCollection.getDatasourcePrefix(eType);
+ String sType = m_aTypeCollection.getPrefix(sValue);
sType.EraseTrailingChars(':');
AddAttribute(XML_NAMESPACE_DB,XML_TYPE,sType);
AddAttribute(XML_NAMESPACE_DB,XML_HOSTNAME,sHostName);
diff --git a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
index 0a00a01c0..ab348bcc2 100644
--- a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
+++ b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
@@ -126,7 +126,8 @@ OXMLFileBasedDatabase::OXMLFileBasedDatabase( ODBFilter& rImport,
}
if ( sLocation.getLength() && sMediaType.getLength() )
{
- ::rtl::OUString sURL(dbaccess::ODsnTypeCollection::getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension));
+ ::dbaccess::ODsnTypeCollection aTypeCollection(rImport.getORB());
+ ::rtl::OUString sURL(aTypeCollection.getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension));
sURL += sLocation;
try
{
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index d310ab6c0..c4f9c323b 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -115,20 +115,28 @@
#ifndef _COM_SUN_STAR_UTIL_XMODIFIABLE_HPP_
#include <com/sun/star/util/XModifiable.hpp>
#endif
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
#ifndef _SV_SVAPP_HXX //autogen
#include <vcl/svapp.hxx>
#endif
#ifndef _VOS_MUTEX_HXX_
#include <vos/mutex.hxx>
#endif
-#ifndef _SFXECODE_HXX
#include <svtools/sfxecode.hxx>
-#endif
+#include <svtools/moduleoptions.hxx>
#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/helper/vclunohelper.hxx>
#endif
#include <tools/diagnose_ex.h>
#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/mimeconfighelper.hxx>
+#include <comphelper/documentconstants.hxx>
+#include <comphelper/uno3.hxx>
+#include <osl/thread.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <connectivity/DriversConfig.hxx>
+#include "dsntypes.hxx"
using namespace ::com::sun::star;
@@ -139,6 +147,138 @@ extern "C" void SAL_CALL createRegistryInfo_ODBFilter( )
//--------------------------------------------------------------------------
namespace dbaxml
{
+ namespace
+ {
+ class FastLoader : public ::osl::Thread
+ {
+ public:
+ typedef enum { E_JAVA, E_CALC } StartType;
+ FastLoader(uno::Reference< lang::XMultiServiceFactory > const & _xFactory,StartType _eType)
+ :m_xFactory(_xFactory)
+ ,m_eWhat(_eType)
+ {}
+
+ protected:
+ virtual ~FastLoader(){}
+
+ /// Working method which should be overridden.
+ virtual void SAL_CALL run();
+ virtual void SAL_CALL onTerminated();
+ private:
+ uno::Reference< lang::XMultiServiceFactory > m_xFactory;
+ StartType m_eWhat;
+ };
+
+ void SAL_CALL FastLoader::run()
+ {
+ if ( m_eWhat == E_JAVA )
+ {
+ static bool s_bFirstTime = true;
+ if ( s_bFirstTime )
+ {
+ s_bFirstTime = false;
+ try
+ {
+ ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_xFactory);
+ }
+ catch(uno::Exception& ex)
+ {
+ (void)ex;
+ OSL_ASSERT(0);
+ }
+ } // if ( s_bFirstTime )
+ } // if ( m_eWhat == E_JAVA )
+ else if ( m_eWhat == E_CALC )
+ {
+ static bool s_bFirstTime = true;
+ if ( s_bFirstTime )
+ {
+ s_bFirstTime = false;
+ try
+ {
+ uno::Reference<frame::XComponentLoader> xFrameLoad( m_xFactory->createInstance(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")))
+ ,uno::UNO_QUERY);
+ const ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank"));
+ sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
+ uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY_THROW)->findFrame(sTarget,nFrameSearchFlag);
+ xFrameLoad.set( xFrame,uno::UNO_QUERY);
+
+ if ( xFrameLoad.is() )
+ {
+ uno::Sequence < beans::PropertyValue > aArgs( 3);
+ sal_Int32 nLen = 0;
+ aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate"));
+ aArgs[nLen++].Value <<= sal_False;
+
+ aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
+ aArgs[nLen++].Value <<= sal_True;
+
+ aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden"));
+ aArgs[nLen++].Value <<= sal_True;
+
+ ::comphelper::MimeConfigurationHelper aHelper(m_xFactory);
+ SvtModuleOptions aModuleOptions;
+ uno::Reference< frame::XModel > xModel(xFrameLoad->loadComponentFromURL(
+ aModuleOptions.GetFactoryEmptyDocumentURL( aModuleOptions.ClassifyFactoryByServiceName( aHelper.GetDocServiceNameFromMediaType(MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET) )),
+ ::rtl::OUString(), // empty frame name
+ 0,
+ aArgs
+ ),uno::UNO_QUERY);
+ ::comphelper::disposeComponent(xModel);
+ }
+ }
+ catch(uno::Exception& ex)
+ {
+ (void)ex;
+ OSL_ASSERT(0);
+ }
+ }
+ }
+ }
+ void SAL_CALL FastLoader::onTerminated()
+ {
+ delete this;
+ }
+
+ class DatasourceURLListener : public ::cppu::WeakImplHelper1< beans::XPropertyChangeListener >
+ {
+ uno::Reference< lang::XMultiServiceFactory > m_xFactory;
+ ::dbaccess::ODsnTypeCollection m_aTypeCollection;
+ DatasourceURLListener(const DatasourceURLListener&);
+ void operator =(const DatasourceURLListener&);
+ protected:
+ virtual ~DatasourceURLListener(){}
+ public:
+ DatasourceURLListener(uno::Reference< lang::XMultiServiceFactory > const & _xFactory) : m_xFactory(_xFactory),m_aTypeCollection(_xFactory){}
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const beans::PropertyChangeEvent& _rEvent ) throw (uno::RuntimeException)
+ {
+ ::rtl::OUString sURL;
+ _rEvent.NewValue >>= sURL;
+ FastLoader* pCreatorThread = NULL;
+
+ if ( m_aTypeCollection.needsJVM(sURL) )
+ {
+ pCreatorThread = new FastLoader(m_xFactory,FastLoader::E_JAVA);
+ } // if ( m_aTypeCollection.needsJVM(sURL) )
+ else if ( sURL.matchIgnoreAsciiCaseAsciiL("sdbc:calc:",10,0) )
+ {
+ pCreatorThread = new FastLoader(m_xFactory,FastLoader::E_CALC);
+ }
+ if ( pCreatorThread )
+ {
+ pCreatorThread->createSuspended();
+ pCreatorThread->setPriority(osl_Thread_PriorityBelowNormal);
+ pCreatorThread->resume();
+ }
+ }
+ // XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& /*_rSource*/ ) throw (uno::RuntimeException)
+ {
+ }
+ };
+ }
sal_Char __READONLY_DATA sXML_np__db[] = "_db";
sal_Char __READONLY_DATA sXML_np___db[] = "__db";
@@ -391,11 +531,11 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
{
uno::Reference<sdb::XOfficeDatabaseDocument> xOfficeDoc(GetModel(),UNO_QUERY_THROW);
m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW);
- OSL_ENSURE(m_xDataSource.is(),"DataSource is NULL!");
+ uno::Reference<beans::XPropertyChangeListener> xListener = new DatasourceURLListener(getServiceFactory());
+ m_xDataSource->addPropertyChangeListener(PROPERTY_URL,xListener);
uno::Reference< XNumberFormatsSupplier > xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY);
SetNumberFormatsSupplier(xNum);
-
uno::Reference<XComponent> xModel(GetModel(),UNO_QUERY);
sal_Int32 nRet = ReadThroughComponent( xStorage
,xModel
@@ -820,16 +960,30 @@ UniReference < XMLPropertySetMapper > ODBFilter::GetCellStylesPropertySetMapper(
void ODBFilter::setPropertyInfo()
{
Reference<XPropertySet> xDataSource(getDataSource());
- if ( !m_aInfoSequence.empty() && xDataSource.is() )
+ if ( xDataSource.is() )
{
- try
+ ::connectivity::DriversConfig aDriverConfig(getServiceFactory());
+ const ::rtl::OUString sURL = ::comphelper::getString(xDataSource->getPropertyValue(PROPERTY_URL));
+ ::comphelper::NamedValueCollection aMetaData = aDriverConfig.getMetaData(sURL);
+ aMetaData.merge( aDriverConfig.getProperties(sURL),true ) ;
+ Sequence<PropertyValue> aInfo;
+ if ( !m_aInfoSequence.empty() )
{
- xDataSource->setPropertyValue(PROPERTY_INFO,makeAny(Sequence<PropertyValue>(&(*m_aInfoSequence.begin()),m_aInfoSequence.size())));
+ aInfo = Sequence<PropertyValue>(&(*m_aInfoSequence.begin()),m_aInfoSequence.size());
}
- catch(Exception)
+ aMetaData.merge(::comphelper::NamedValueCollection(aInfo),true);
+ aMetaData >>= aInfo;
+ if ( aInfo.getLength() )
{
- DBG_UNHANDLED_EXCEPTION();
- }
+ try
+ {
+ xDataSource->setPropertyValue(PROPERTY_INFO,makeAny(aInfo));
+ }
+ catch(Exception)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ } // if ( !m_aInfoSequence.empty() && xDataSource.is() )
}
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/inc/dbustrings.hrc b/dbaccess/source/inc/dbustrings.hrc
index f2a49cd54..a949b8427 100644
--- a/dbaccess/source/inc/dbustrings.hrc
+++ b/dbaccess/source/inc/dbustrings.hrc
@@ -74,6 +74,7 @@ namespace dbaui
DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULTCONTROL);
DECLARE_CONSTASCII_USTRING(PROPERTY_TABSTOP);
DECLARE_CONSTASCII_USTRING(PROPERTY_ENABLED);
+ DECLARE_CONSTASCII_USTRING(PROPERTY_MOUSE_WHEEL_BEHAVIOR);
}
#endif // DBACCESS_SHARED_DBUSTRINGS_HRC
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index 302bae4f5..81cd04933 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -89,6 +89,27 @@ enum DATASOURCE_TYPE
DST_UNKNOWN /// unrecognized type
};
+#define PAGE_DBSETUPWIZARD_INTRO 0
+#define PAGE_DBSETUPWIZARD_DBASE 1
+#define PAGE_DBSETUPWIZARD_TEXT 2
+#define PAGE_DBSETUPWIZARD_MSACCESS 3
+#define PAGE_DBSETUPWIZARD_LDAP 4
+#define PAGE_DBSETUPWIZARD_ADABAS 5
+#define PAGE_DBSETUPWIZARD_MYSQL_INTRO 6
+#define PAGE_DBSETUPWIZARD_MYSQL_JDBC 7
+#define PAGE_DBSETUPWIZARD_MYSQL_ODBC 8
+#define PAGE_DBSETUPWIZARD_ORACLE 9
+#define PAGE_DBSETUPWIZARD_JDBC 10
+#define PAGE_DBSETUPWIZARD_ADO 11
+#define PAGE_DBSETUPWIZARD_ODBC 12
+#define PAGE_DBSETUPWIZARD_SPREADSHEET 13
+#define PAGE_DBSETUPWIZARD_AUTHENTIFICATION 14
+#define PAGE_DBSETUPWIZARD_MOZILLA 15
+#define PAGE_DBSETUPWIZARD_FINAL 16
+#define PAGE_DBSETUPWIZARD_USERDEFINED 17
+#define PAGE_DBSETUPWIZARD_MYSQL_NATIVE 18
+
+
//=========================================================================
//= ODsnTypeCollection
//=========================================================================
@@ -96,13 +117,10 @@ class OOO_DLLPUBLIC_DBA ODsnTypeCollection
{
protected:
DECLARE_STL_VECTOR(String, StringVector);
- DECLARE_STL_VECTOR(DATASOURCE_TYPE, TypeVector);
- typedef ::std::map<DATASOURCE_TYPE,DATASOURCE_TYPE> TRelatedTypes;
StringVector m_aDsnTypesDisplayNames; /// user readable names for the datasource types
StringVector m_aDsnPrefixes; /// DSN prefixes which determine the type of a datasource
- TypeVector m_aDsnTypes; /// types of datasources we know
- StringVector m_aUserExtensions; /// extensions of user defined types
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
#ifdef DBG_UTIL
sal_Int32 m_nLivingIterators; /// just for debugging reasons, counts the living iterators
@@ -112,68 +130,70 @@ public:
class TypeIterator;
friend class ODsnTypeCollection::TypeIterator;
- ODsnTypeCollection();
+ ODsnTypeCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory);
~ODsnTypeCollection();
- /// get the datasource type from a DSN string
- DATASOURCE_TYPE getType(const String& _rDsn) const;
-
/// get the datasource type display name from a DSN string
- String getTypeDisplayName(DATASOURCE_TYPE _eType) const;
-
- /// the the DSN prefix associated with a given type
- String getDatasourcePrefix(DATASOURCE_TYPE _eType) const;
+ String getTypeDisplayName(const ::rtl::OUString& _sURL) const;
/// returns the extension of the user defined type
- String getTypeExtension(DATASOURCE_TYPE _eType) const;
+ String getTypeExtension(const ::rtl::OUString& _sURL) const;
/// on a given string, cut the type prefix and return the result
- String cutPrefix(const String& _rDsn) const;
+ String cutPrefix(const ::rtl::OUString& _sURL) const;
+
+ /// on a given string, return the type prefix
+ String getPrefix(const ::rtl::OUString& _sURL) const;
+
+ /// on a given string, return the Java Driver Class
+ String getJavaDriverClass(const ::rtl::OUString& _sURL) const;
/// returns the media type of a file based database
- String getMediaType(DATASOURCE_TYPE _eType) const;
+ String getMediaType(const ::rtl::OUString& _sURL) const;
/// returns the dsn prefix for a given media type
- static String getDatasourcePrefixFromMediaType(const String& _sMediaType,const String& _sExtension = String() );
+ String getDatasourcePrefixFromMediaType(const ::rtl::OUString& _sMediaType,const ::rtl::OUString& _sExtension = ::rtl::OUString() );
- void extractHostNamePort(const String& _rDsn,String& _sDatabaseName,String& _rHostname,sal_Int32& _nPortNumber) const;
+ void extractHostNamePort(const ::rtl::OUString& _rDsn,String& _sDatabaseName,String& _rHostname,sal_Int32& _nPortNumber) const;
/// check if the given data source allows creation of tables
- sal_Bool supportsTableCreation(DATASOURCE_TYPE _eType);
+ sal_Bool supportsTableCreation(const ::rtl::OUString& _sURL) const;
// check if a Browse button may be shown to insert connection url
- sal_Bool supportsBrowsing(DATASOURCE_TYPE _eType);
+ sal_Bool supportsBrowsing(const ::rtl::OUString& _sURL) const;
/// check if the given data source tyoe is based on the file system - i.e. the URL is a prefix plus a file URL
- sal_Bool isFileSystemBased(DATASOURCE_TYPE _eType) const;
+ sal_Bool isFileSystemBased(const ::rtl::OUString& _sURL) const;
+
+ bool isConnectionUrlRequired(const ::rtl::OUString& _sURL) const;
/// checks if the given data source type embeds its data into the database document
- bool isEmbeddedDatabase( DATASOURCE_TYPE _eType ) const;
+ bool isEmbeddedDatabase( const ::rtl::OUString& _sURL ) const;
- /** returns default settings for newly created databases of the given type.
+ ::rtl::OUString getEmbeddedDatabase() const;
+
+ // returns true when the properties dialog can be shown, otherwise false.
+ bool isShowPropertiesEnabled( const ::rtl::OUString& _sURL ) const;
- Currently implemented (and used) for DST_EMBEDDED_HSQLDB only
+ /** returns default settings for newly created databases of the given type.
*/
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>
- getDefaultDBSettings( DATASOURCE_TYPE _eType ) const;
+ getDefaultDBSettings( const ::rtl::OUString& _sURL ) const;
/// get access to the first element of the types collection
TypeIterator begin() const;
/// get access to the (last + 1st) element of the types collection
TypeIterator end() const;
- /** read all user defined driver types.
- @param _rxORB
- The service factory
- */
- void initUserDriverTypes(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
+ void fillPageIds(const ::rtl::OUString& _sURL,::std::vector<sal_Int16>& _rOutPathIds) const;
-protected:
- /// return the connection type a DSN string represents
- DATASOURCE_TYPE implDetermineType(const String& _rDsn) const;
+ DATASOURCE_TYPE determineType(const String& _rDsn) const;
+
+ bool needsJVM(const String& _rDsn) const;
- /// return the index within the internal structures for the connection type given
- sal_Int32 implDetermineTypeIndex(DATASOURCE_TYPE _eType) const;
+ sal_Int32 getIndexOf(const ::rtl::OUString& _sURL) const;
+ sal_Int32 size() const;
+ ::rtl::OUString getType(const ::rtl::OUString& _sURL) const;
};
//-------------------------------------------------------------------------
@@ -194,7 +214,7 @@ public:
TypeIterator(const TypeIterator& _rSource);
~TypeIterator();
- DATASOURCE_TYPE getType() const;
+ ::rtl::OUString getURLPrefix() const;
String getDisplayName() const;
/// prefix increment
diff --git a/dbaccess/source/sdbtools/resource/sdbt_strings.src b/dbaccess/source/sdbtools/resource/sdbt_strings.src
index 0c04e4ae2..a3113f7ea 100644
--- a/dbaccess/source/sdbtools/resource/sdbt_strings.src
+++ b/dbaccess/source/sdbtools/resource/sdbt_strings.src
@@ -64,5 +64,5 @@ String STR_INVALID_COMPOSITION_TYPE
String STR_INVALID_COMMAND_TYPE
{
- Text [ en-US ] = "Invalid command type - only TABLE and AND QUERY from com.sun.star.sdb.CommandType are allowed.";
+ Text [ en-US ] = "Invalid command type - only TABLE and QUERY from com.sun.star.sdb.CommandType are allowed.";
};
diff --git a/dbaccess/source/shared/dbustrings.cxx b/dbaccess/source/shared/dbustrings.cxx
index cf1436305..e450d9b2c 100644
--- a/dbaccess/source/shared/dbustrings.cxx
+++ b/dbaccess/source/shared/dbustrings.cxx
@@ -72,4 +72,5 @@ namespace dbaui
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TABSTOP, "TabStop");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULTCONTROL, "DefaultControl");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ENABLED, "Enabled");
+ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MOUSE_WHEEL_BEHAVIOR, "MouseWheelBehavior");
}
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index eb650826e..2af08e0d0 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -155,7 +155,7 @@
#ifndef _DBAUI_LISTVIEWITEMS_HXX_
#include "listviewitems.hxx"
#endif
-#include "ExtensionNotPresent.hxx"
+
#ifndef DBAUI_APPDETAILVIEW_HXX
#include "AppDetailView.hxx"
#endif
@@ -410,6 +410,7 @@ OApplicationController::OApplicationController(const Reference< XMultiServiceFac
:OApplicationController_CBASE( _rxORB )
,m_aContextMenuInterceptors( getMutex() )
,m_pSubComponentManager( new SubComponentManager( *this, getSharedMutex() ) )
+ ,m_aTypeCollection(_rxORB)
,m_aTableCopyHelper(this)
,m_pClipbordNotifier(NULL)
,m_nAsyncDrop(0)
@@ -422,8 +423,6 @@ OApplicationController::OApplicationController(const Reference< XMultiServiceFac
,m_pSelectionNotifier( new SelectionNotifier( getMutex(), *this ) )
{
DBG_CTOR(OApplicationController,NULL);
-
- m_aTypeCollection.initUserDriverTypes(_rxORB);
}
//------------------------------------------------------------------------------
OApplicationController::~OApplicationController()
@@ -940,11 +939,8 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = getContainer()->getSelectionCount() > 0 && getContainer()->isALeafSelected();
break;
case SID_DB_APP_DSUSERADMIN:
- {
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- aReturn.bEnabled = ( ::dbaccess::DST_EMBEDDED_HSQLDB != eType );
- }
- break;
+ aReturn.bEnabled = !m_aTypeCollection.isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
+ break;
case SID_DB_APP_DSRELDESIGN:
aReturn.bEnabled = sal_True;
break;
@@ -955,36 +951,13 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = getContainer()->getElementType() == E_TABLE && isConnected();
break;
case SID_DB_APP_DSPROPS:
- aReturn.bEnabled = m_xDataSource.is();
- if ( aReturn.bEnabled )
- {
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- aReturn.bEnabled = ::dbaccess::DST_EMBEDDED_HSQLDB != eType
- && ::dbaccess::DST_MOZILLA != eType
- && ::dbaccess::DST_EVOLUTION != eType
- && ::dbaccess::DST_EVOLUTION_GROUPWISE != eType
- && ::dbaccess::DST_EVOLUTION_LDAP != eType
- && ::dbaccess::DST_KAB != eType
- && ::dbaccess::DST_MACAB != eType
- && ::dbaccess::DST_OUTLOOK != eType
- && ::dbaccess::DST_OUTLOOKEXP != eType;
- }
+ aReturn.bEnabled = m_xDataSource.is() && m_aTypeCollection.isShowPropertiesEnabled(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
break;
case SID_DB_APP_DSCONNECTION_TYPE:
- aReturn.bEnabled = !isDataSourceReadOnly() && m_xDataSource.is();
- if ( aReturn.bEnabled )
- {
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- aReturn.bEnabled = ::dbaccess::DST_EMBEDDED_HSQLDB != eType;
- }
+ aReturn.bEnabled = !isDataSourceReadOnly() && m_xDataSource.is() && !m_aTypeCollection.isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
break;
case SID_DB_APP_DSADVANCED_SETTINGS:
- aReturn.bEnabled = m_xDataSource.is();
- if ( aReturn.bEnabled )
- {
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType( ::comphelper::getString( m_xDataSource->getPropertyValue( PROPERTY_URL ) ) );
- aReturn.bEnabled = AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( eType );
- }
+ aReturn.bEnabled = m_xDataSource.is() && AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( m_aTypeCollection.getType(::comphelper::getString( m_xDataSource->getPropertyValue( PROPERTY_URL ) )) );
break;
case SID_DB_APP_CONVERTTOVIEW:
aReturn.bEnabled = !isDataSourceReadOnly();
@@ -1034,15 +1007,16 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = m_xDataSource.is();
if ( aReturn.bEnabled )
{
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
+ ::rtl::OUString sURL;
+ m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
::rtl::OUString sDSTypeName;
- if ( m_aTypeCollection.isEmbeddedDatabase( eType ) )
+ if ( m_aTypeCollection.isEmbeddedDatabase( sURL ) )
{
sDSTypeName = String( ModuleRes( RID_STR_EMBEDDED_DATABASE ) );
}
else
{
- sDSTypeName = m_aTypeCollection.getTypeDisplayName(eType);
+ sDSTypeName = m_aTypeCollection.getTypeDisplayName(sURL);
}
aReturn.sTitle = sDSTypeName;
}
@@ -1053,8 +1027,6 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
{
::rtl::OUString sURL;
m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType( sURL );
-
String sDatabaseName;
String sHostName;
sal_Int32 nPortNumber( -1 );
@@ -1063,7 +1035,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
if ( !sDatabaseName.Len() )
sDatabaseName = m_aTypeCollection.cutPrefix( sURL );
- if ( m_aTypeCollection.isFileSystemBased(eType) )
+ if ( m_aTypeCollection.isFileSystemBased(sURL) )
{
sDatabaseName = SvtPathOptions().SubstituteVariable( sDatabaseName );
if ( sDatabaseName.Len() )
@@ -1075,7 +1047,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
}
if ( sDatabaseName.Len() == 0 )
- sDatabaseName = m_aTypeCollection.getTypeDisplayName( eType );
+ sDatabaseName = m_aTypeCollection.getTypeDisplayName( sURL );
aReturn.sTitle = sDatabaseName;
}
diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx
index 41d56494a..74c628be3 100644
--- a/dbaccess/source/ui/app/AppControllerDnD.cxx
+++ b/dbaccess/source/ui/app/AppControllerDnD.cxx
@@ -719,19 +719,24 @@ sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAcc
}
// the target object name (as we'll suggest it to the user)
- String sTargetName;
- Reference< XNameAccess > xQueries;
+ ::rtl::OUString sTargetName;
try
{
- // the query container
- xQueries.set(getQueryDefintions(),UNO_QUERY);
- String aQueryDefaultName = String(ModuleRes(STR_QRY_TITLE));
- aQueryDefaultName = aQueryDefaultName.GetToken(0,' ');
- sTargetName = ::dbtools::createUniqueName(xQueries,aQueryDefaultName);
+ if ( CommandType::QUERY == nCommandType )
+ sTargetName = sCommand;
+
+ if ( !sTargetName.getLength() )
+ {
+ String sDefaultName = String( ModuleRes( STR_QRY_TITLE ) );
+ sDefaultName = sDefaultName.GetToken( 0, ' ' );
+
+ Reference< XNameAccess > xQueries( getQueryDefintions(), UNO_QUERY_THROW );
+ sTargetName = ::dbtools::createUniqueName( xQueries, sDefaultName, sal_False );
+ }
}
- catch(Exception)
+ catch(const Exception&)
{
- OSL_ENSURE(0,"could not create query default name!");
+ DBG_UNHANDLED_EXCEPTION();
}
Reference< XPropertySet > xQuery;
@@ -742,16 +747,14 @@ sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAcc
try
{
// the concrete query
- Reference< XDataSource > xDataSource( getDataSourceByName( sDataSourceName, getView(), getORB(), NULL ) );
- Reference< XQueryDefinitionsSupplier > xSourceQuerySup( xDataSource, UNO_QUERY );
- if ( xSourceQuerySup.is() )
- xQueries.set(xSourceQuerySup->getQueryDefinitions(),UNO_QUERY);
-
- if ( xQueries.is() && xQueries->hasByName(sCommand) )
+ Reference< XQueryDefinitionsSupplier > xSourceQuerySup(
+ getDataSourceByName( sDataSourceName, getView(), getORB(), NULL ),
+ UNO_QUERY_THROW );
+ Reference< XNameAccess > xQueries( xSourceQuerySup->getQueryDefinitions(), UNO_SET_THROW );
+ if ( xQueries->hasByName( sCommand ) )
{
- xQuery.set(xQueries->getByName(sCommand),UNO_QUERY);
- bSuccess = xQuery.is();
- xQueries.clear();
+ xQuery.set( xQueries->getByName(sCommand), UNO_QUERY_THROW );
+ bSuccess = true;
}
}
catch(SQLException&) { throw; } // caught and handled by the outer catch
@@ -780,19 +783,28 @@ sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAcc
// here we have everything needed to create a new query object ...
// ... ehm, except a new name
ensureConnection();
- DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::QUERY );
- OSaveAsDlg aAskForName( getView(),
- CommandType::QUERY,
- getORB(),
- getConnection(),
- sTargetName,
- aNameChecker,
- SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
- if ( RET_OK != aAskForName.Execute() )
- // cancelled by the user
- return sal_False;
- sTargetName = aAskForName.getName();
+ DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::QUERY );
+ ::dbtools::SQLExceptionInfo aDummy;
+ bool bNeedAskForName = ( sCommand.getLength() == 0 )
+ /* we did not have a source name, so the target name was auto-generated */
+ || ( !aNameChecker.isNameValid( sTargetName, aDummy ) );
+ /* name is invalid in the target DB (e.g. because it already
+ has a /table/ with that name) */
+ if ( bNeedAskForName )
+ {
+ OSaveAsDlg aAskForName( getView(),
+ CommandType::QUERY,
+ getORB(),
+ getConnection(),
+ sTargetName,
+ aNameChecker,
+ SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
+ if ( RET_OK != aAskForName.Execute() )
+ // cancelled by the user
+ return sal_False;
+ sTargetName = aAskForName.getName();
+ }
// create a new object
Reference< XPropertySet > xNewQuery(xQueryFactory->createInstance(), UNO_QUERY);
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index e2059153f..147d55a8d 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -489,6 +489,7 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun
:SbaXDataBrowserController_Base(_rM)
,m_pClipbordNotifier( NULL )
,m_aAsyncGetCellFocus(LINK(this, SbaXDataBrowserController, OnAsyncGetCellFocus))
+ ,m_aAsyncDisplayError( LINK( this, SbaXDataBrowserController, OnAsyncDisplayError ) )
,m_sStateSaveRecord(ModuleRes(RID_STR_SAVE_CURRENT_RECORD))
,m_sStateUndoRecord(ModuleRes(RID_STR_UNDO_MODIFY_RECORD))
,m_sModuleIdentifier( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DataSourceBrowser" ) ) )
@@ -498,7 +499,6 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun
,m_nFormActionNestingLevel(0)
,m_bLoadCanceled( sal_False )
,m_bClosingKillOpen( sal_False )
- ,m_bErrorOccured( sal_False )
,m_bCannotSelectUnfiltered( true )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::SbaXDataBrowserController" );
@@ -608,7 +608,7 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r
}
}
- return _rxLoadable->isLoaded() && !errorOccured();
+ return _rxLoadable->isLoaded();
}
// -----------------------------------------------------------------------------
@@ -1068,13 +1068,11 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t
// the filter or the sort criterias have changed ? -> update our parser
if (evt.PropertyName.equals(PROPERTY_ACTIVECOMMAND))
{
- initializeParser();
if (m_xParser.is())
DO_SAFE( m_xParser->setElementaryQuery(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new query to my parser !" );
}
else if (evt.PropertyName.equals(PROPERTY_FILTER))
{
- initializeParser();
if ( m_xParser.is() && m_xParser->getFilter() != ::comphelper::getString(evt.NewValue))
{
DO_SAFE( m_xParser->setFilter(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
@@ -1083,7 +1081,6 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t
}
else if (evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE))
{
- initializeParser();
if ( m_xParser.is() && m_xParser->getHavingClause() != ::comphelper::getString(evt.NewValue))
{
DO_SAFE( m_xParser->setHavingClause(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
@@ -1092,7 +1089,6 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t
}
else if (evt.PropertyName.equals(PROPERTY_ORDER))
{
- initializeParser();
if ( m_xParser.is() && m_xParser->getOrder() != ::comphelper::getString(evt.NewValue))
{
DO_SAFE( m_xParser->setOrder(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new order to my parser !" );
@@ -1201,6 +1197,7 @@ sal_Bool SbaXDataBrowserController::suspend(sal_Bool /*bSuspend*/) throw( Runtim
DBG_ASSERT(m_nPendingLoadFinished == 0, "SbaXDataBrowserController::suspend : there shouldn't be a pending load !");
m_aAsyncGetCellFocus.CancelCall();
+ m_aAsyncDisplayError.CancelCall();
m_aAsyncInvalidateAll.CancelCall();
sal_Bool bSuccess = SaveModified();
@@ -1345,17 +1342,33 @@ void SbaXDataBrowserController::frameAction(const ::com::sun::star::frame::Frame
}
//------------------------------------------------------------------------------
+IMPL_LINK( SbaXDataBrowserController, OnAsyncDisplayError, void*, /* _pNotInterestedIn */ )
+{
+ if ( m_aCurrentError.isValid() )
+ {
+ OSQLMessageBox aDlg( getBrowserView(), m_aCurrentError );
+ aDlg.Execute();
+ }
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
void SbaXDataBrowserController::errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw( RuntimeException )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::errorOccured" );
- SQLExceptionInfo aInfo(aEvent.Reason);
- if ( aInfo.isValid() )
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ SQLExceptionInfo aInfo( aEvent.Reason );
+ if ( !aInfo.isValid() )
+ return;
+
+ if ( m_nFormActionNestingLevel )
{
- ::vos::OGuard aGuard(Application::GetSolarMutex());
- showError( aInfo );
+ OSL_ENSURE( !m_aCurrentError.isValid(), "SbaXDataBrowserController::errorOccured: can handle one error per transaction only!" );
+ m_aCurrentError = aInfo;
}
- if (m_nFormActionNestingLevel)
- m_bErrorOccured = true;
+ else
+ m_aAsyncDisplayError.Call();
}
//------------------------------------------------------------------------------
@@ -1531,10 +1544,16 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const
}
break;
- case ID_BROWSER_PASTE:
case ID_BROWSER_COPY:
+ if ( getBrowserView()->getVclControl()->GetSelectRowCount() )
+ {
+ aReturn.bEnabled = m_aCurrentFrame.isActive();
+ break;
+ }
+ // run through
+ case ID_BROWSER_PASTE:
case ID_BROWSER_CUT:
- {
+ {
CellControllerRef xCurrentController = getBrowserView()->getVclControl()->Controller();
if (xCurrentController.Is() && xCurrentController->ISA(EditCellController))
{
@@ -1776,7 +1795,6 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
- initializeParser();
const ::rtl::OUString sOldVal = bFilter ? m_xParser->getFilter() : m_xParser->getOrder();
const ::rtl::OUString sOldHaving = m_xParser->getHavingClause();
try
@@ -1979,6 +1997,12 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
break;
case ID_BROWSER_COPY:
+ if ( getBrowserView()->getVclControl()->GetSelectRowCount() > 0 )
+ {
+ getBrowserView()->getVclControl()->CopySelectedRowsToClipboard();
+ break;
+ }
+ // run through
case ID_BROWSER_CUT:
case ID_BROWSER_PASTE:
{
@@ -1993,9 +2017,9 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
Edit& rEdit = (Edit&)xCurrentController->GetWindow();
switch (nId)
{
- case ID_BROWSER_CUT : rEdit.Cut(); break;
- case SID_COPY : rEdit.Copy(); break;
- case ID_BROWSER_PASTE : rEdit.Paste(); break;
+ case ID_BROWSER_CUT : rEdit.Cut(); break;
+ case SID_COPY : rEdit.Copy(); break;
+ case ID_BROWSER_PASTE : rEdit.Paste(); break;
}
if (ID_BROWSER_CUT == nId || ID_BROWSER_PASTE == nId)
{
@@ -2021,7 +2045,6 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
if (!xField.is())
break;
- initializeParser();
const ::rtl::OUString sOldSort = m_xParser->getOrder();
sal_Bool bParserSuccess = sal_False;
HANDLE_SQL_ERRORS(
@@ -2052,7 +2075,6 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
sal_Bool bHaving = sal_False;
::rtl::OUString sName;
xField->getPropertyValue(PROPERTY_NAME) >>= sName;
- initializeParser();
Reference< XColumnsSupplier > xColumnsSupplier(m_xParser, UNO_QUERY);
Reference< ::com::sun::star::container::XNameAccess > xCols = xColumnsSupplier.is() ? xColumnsSupplier->getColumns() : Reference< ::com::sun::star::container::XNameAccess > ();
if ( xCols.is() && xCols->hasByName(sName) )
@@ -2562,6 +2584,9 @@ void SbaXDataBrowserController::LoadFinished(sal_Bool /*bWasSynch*/)
getBrowserView()->getGridControl()->setDesignMode(sal_False);
// -------------------------------
+ initializeParser();
+
+ // -------------------------------
InvalidateAll();
m_aAsyncGetCellFocus.Call();
@@ -2597,7 +2622,7 @@ void SbaXDataBrowserController::initializeParser() const
}
catch(Exception&)
{
- DBG_WARNING("SbaXDataBrowserController::initializeParser: something went wrong while creating the parser !");
+ DBG_UNHANDLED_EXCEPTION();
m_xParser = NULL;
// no further handling, we ignore the error
}
@@ -2659,10 +2684,9 @@ void SbaXDataBrowserController::reloaded(const EventObject& /*aEvent*/) throw( R
//------------------------------------------------------------------------------
void SbaXDataBrowserController::enterFormAction()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::enterFormAction" );
- if (!m_nFormActionNestingLevel)
- // first action -> reset flag
- m_bErrorOccured = false;
+ if ( !m_nFormActionNestingLevel )
+ // first action -> reset
+ m_aCurrentError.clear();
++m_nFormActionNestingLevel;
}
@@ -2670,9 +2694,14 @@ void SbaXDataBrowserController::enterFormAction()
//------------------------------------------------------------------------------
void SbaXDataBrowserController::leaveFormAction()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::leaveFormAction" );
- DBG_ASSERT(m_nFormActionNestingLevel > 0, "SbaXDataBrowserController::leaveFormAction : invalid call !");
- --m_nFormActionNestingLevel;
+ DBG_ASSERT( m_nFormActionNestingLevel > 0, "SbaXDataBrowserController::leaveFormAction : invalid call !" );
+ if ( --m_nFormActionNestingLevel > 0 )
+ return;
+
+ if ( !m_aCurrentError.isValid() )
+ return;
+
+ m_aAsyncDisplayError.Call();
}
// -------------------------------------------------------------------------
@@ -2699,7 +2728,6 @@ sal_Bool SbaXDataBrowserController::isValidCursor() const
bIsValid = ::cppu::any2bool(xProp->getPropertyValue(PROPERTY_ISNEW));
if ( !bIsValid )
{
- initializeParser();
bIsValid = m_xParser.is();
}
} // if ( !bIsValid )
diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx
index fe8b0ac51..97e9aa41e 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -61,6 +61,7 @@
#ifndef _SVX_DATACCESSDESCRIPTOR_HXX_
#include <svx/dataaccessdescriptor.hxx>
#endif
+#include "UITools.hxx"
namespace dbaui
@@ -141,7 +142,8 @@ namespace dbaui
// -----------------------------------------------------------------------------
ODataClipboard::ODataClipboard( const Reference< XPropertySet >& _rxLivingForm,
const Sequence< Any >& _rSelectedRows,
- const Reference< XResultSet>& _rxResultSet)
+ const Reference< XResultSet>& _rxResultSet,
+ const Reference< XMultiServiceFactory >& _rxORB)
:ODataAccessObjectTransferable( _rxLivingForm )
,m_pHtml(NULL)
,m_pRtf(NULL)
@@ -158,6 +160,20 @@ namespace dbaui
getDescriptor()[daCursor] <<= _rxResultSet;
addCompatibleSelectionDescription( _rSelectedRows );
+ if ( xConnection.is() && _rxORB.is() )
+ {
+ Reference< XNumberFormatter > xFormatter( getNumberFormatter( xConnection, _rxORB ) );
+ if ( xFormatter.is() )
+ {
+ m_pHtml = new OHTMLImportExport( getDescriptor(),_rxORB, xFormatter );
+ m_aEventListeners.push_back( m_pHtml );
+
+ m_pRtf = new ORTFImportExport( getDescriptor(),_rxORB, xFormatter );
+ m_aEventListeners.push_back( m_pRtf );
+ }
+ }
+
+
osl_decrementInterlockedCount( &m_refCount );
}
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index fc9952443..c108a66c0 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -165,7 +165,9 @@ void SbaTableQueryBrowser::SelectionChanged()
InvalidateFeature(ID_BROWSER_INSERTCOLUMNS);
InvalidateFeature(ID_BROWSER_INSERTCONTENT);
InvalidateFeature(ID_BROWSER_FORMLETTER);
- }
+ } // if ( !m_bShowMenu )
+ InvalidateFeature(ID_BROWSER_COPY);
+ InvalidateFeature(ID_BROWSER_CUT);
}
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::describeSupportedFeatures()
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 02a917184..832f90f98 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -983,9 +983,16 @@ void SbaGridControl::PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu)
rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, aNewItems.GetItemText(ID_BROWSER_ROWHEIGHT), 0, nPos++);
rMenu.SetHelpId(ID_BROWSER_ROWHEIGHT, aNewItems.GetHelpId(ID_BROWSER_ROWHEIGHT));
+ rMenu.InsertSeparator(nPos++);
+ } // if (!IsReadOnlyDB())
+
+ if ( GetSelectRowCount() > 0 )
+ {
+ rMenu.InsertItem(ID_BROWSER_COPY, aNewItems.GetItemText(SID_COPY), 0, nPos++);
+ rMenu.SetHelpId(ID_BROWSER_COPY, aNewItems.GetHelpId(SID_COPY));
+
+ rMenu.InsertSeparator(nPos++);
}
- if (nPos)
- rMenu.InsertSeparator(nPos);
}
//------------------------------------------------------------------------------
@@ -1145,6 +1152,9 @@ void SbaGridControl::PostExecuteRowContextMenu(sal_uInt16 nRow, const PopupMenu&
case ID_BROWSER_ROWHEIGHT:
SetRowHeight();
break;
+ case ID_BROWSER_COPY:
+ CopySelectedRowsToClipboard();
+ break;
default:
FmGridControl::PostExecuteRowContextMenu(nRow, rMenu, nExecutionResult);
@@ -1418,10 +1428,23 @@ void SbaGridControl::DoColumnDrag(sal_uInt16 nColumnPos)
}
// -----------------------------------------------------------------------
-void SbaGridControl::DoRowDrag(sal_Int16 nRowPos)
+void SbaGridControl::CopySelectedRowsToClipboard()
+{
+ DBG_ASSERT( GetSelectRowCount() > 0, "SbaGridControl::CopySelectedRowsToClipboard: invalid call!" );
+ implTransferSelectedRows( (sal_Int16)FirstSelectedRow(), true );
+}
+
+// -----------------------------------------------------------------------
+void SbaGridControl::DoRowDrag( sal_Int16 nRowPos )
+{
+ implTransferSelectedRows( nRowPos, false );
+}
+
+// -----------------------------------------------------------------------
+void SbaGridControl::implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfClipboardFalseIfDrag )
{
Reference< XPropertySet > xDataSource(getDataSource(), UNO_QUERY);
- DBG_ASSERT(xDataSource.is(), "SbaGridControl::DoRowDrag : invalid data source !");
+ DBG_ASSERT(xDataSource.is(), "SbaGridControl::implTransferSelectedRows : invalid data source !");
// build the sequence of numbers of selected rows
Sequence< Any > aSelectedRows;
@@ -1452,10 +1475,13 @@ void SbaGridControl::DoRowDrag(sal_Int16 nRowPos)
if ( xResultSetAccess.is() )
xRowSetClone = xResultSetAccess->createResultSet();
- ODataClipboard* pTransfer = new ODataClipboard(xDataSource, aSelectedRows,xRowSetClone);
+ ODataClipboard* pTransfer = new ODataClipboard(xDataSource, aSelectedRows,xRowSetClone, getServiceManager());
Reference< XTransferable > xEnsureDelete = pTransfer;
- pTransfer->StartDrag(this, DND_ACTION_COPY | DND_ACTION_LINK);
+ if ( _bTrueIfClipboardFalseIfDrag )
+ pTransfer->CopyToClipboard( this );
+ else
+ pTransfer->StartDrag(this, DND_ACTION_COPY | DND_ACTION_LINK);
}
catch(Exception&)
{
diff --git a/dbaccess/source/ui/browser/sbagrid.src b/dbaccess/source/ui/browser/sbagrid.src
index db2f8d979..b99bfba29 100644
--- a/dbaccess/source/ui/browser/sbagrid.src
+++ b/dbaccess/source/ui/browser/sbagrid.src
@@ -84,6 +84,10 @@ Menu RID_SBA_GRID_ROWCTXMENU
HelpID = HID_BROWSER_ROWHEIGHT ;
Text [ en-US ] = "Row Height..." ;
};
+ MenuItem
+ {
+ ITEM_EDIT_COPY
+ };
};
};
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index ad47627c0..73bb97694 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -60,6 +60,8 @@
/** === begin UNO includes === **/
#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/MouseWheelBehavior.hpp>
#include <com/sun/star/awt/TextAlign.hpp>
#include <com/sun/star/awt/VisualEffect.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -684,13 +686,23 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
aCopyProperties.push_back( PROPERTY_WIDTH );
// help text to display for the column
- Any aDescription; aDescription <<= ::rtl::OUString();
+ Any aDescription;
if ( xColPSI->hasPropertyByName( PROPERTY_HELPTEXT ) )
- aDescription <<= ::comphelper::getString( xColumn->getPropertyValue( PROPERTY_HELPTEXT ) );
+ aDescription = xColumn->getPropertyValue( PROPERTY_HELPTEXT );
+ if ( !aDescription.hasValue() )
+ aDescription <<= ::rtl::OUString();
aInitialValues.push_back( NamedValue( PROPERTY_HELPTEXT, aDescription ) );
// ... horizontal justify
- aInitialValues.push_back( NamedValue( PROPERTY_ALIGN, makeAny( sal_Int16( ::comphelper::getINT32( xColumn->getPropertyValue( PROPERTY_ALIGN ) ) ) ) ) );
+ Any aAlign; aAlign <<= sal_Int16( 0 );
+ Any aColAlign( xColumn->getPropertyValue( PROPERTY_ALIGN ) );
+ if ( aColAlign.hasValue() )
+ aAlign <<= sal_Int16( ::comphelper::getINT32( aColAlign ) );
+ aInitialValues.push_back( NamedValue( PROPERTY_ALIGN, aAlign ) );
+
+ // don't allow the mouse to scroll in the cells
+ if ( xGridColPSI->hasPropertyByName( PROPERTY_MOUSE_WHEEL_BEHAVIOR ) )
+ aInitialValues.push_back( NamedValue( PROPERTY_MOUSE_WHEEL_BEHAVIOR, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) ) );
// now set all those values
for ( ::std::vector< NamedValue >::const_iterator property = aInitialValues.begin();
@@ -1535,25 +1547,6 @@ void SbaTableQueryBrowser::LoadFinished(sal_Bool _bWasSynch)
// if the form has been loaded, this means that our "selection" has changed
EventObject aEvent( *this );
m_aSelectionListeners.notifyEach( &XSelectionChangeListener::selectionChanged, aEvent );
-
- // update our database document
- Reference< XModel > xDocument;
- try
- {
- Reference< XPropertySet > xCursorProps( getRowSet(), UNO_QUERY_THROW );
- Reference< XConnection > xConnection( xCursorProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ), UNO_QUERY );
- if ( xConnection.is() )
- {
- Reference< XChild > xChild( xConnection, UNO_QUERY_THROW );
- Reference< XDocumentDataSource > xDataSource( xChild->getParent(), UNO_QUERY_THROW );
- xDocument.set( xDataSource->getDatabaseDocument(), UNO_QUERY_THROW );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- m_xCurrentDatabaseDocument = xDocument;
}
//------------------------------------------------------------------------------
@@ -1746,7 +1739,13 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
if (getBrowserView() && getBrowserView()->getVclControl() && !getBrowserView()->getVclControl()->IsEditing())
{
SbaGridControl* pControl = getBrowserView()->getVclControl();
- aReturn.bEnabled = pControl->canCopyCellText(pControl->GetCurRow(), pControl->GetCurColumnId());
+ if ( pControl->GetSelectRowCount() )
+ {
+ aReturn.bEnabled = m_aCurrentFrame.isActive();
+ break;
+ } // if ( getBrowserView()->getVclControl()->GetSelectRowCount() )
+ else
+ aReturn.bEnabled = pControl->canCopyCellText(pControl->GetCurRow(), pControl->GetCurColumnId());
break;
}
// NO break here
@@ -1942,7 +1941,7 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
{
copyEntry(m_pTreeView->getListBox().GetCurEntry());
}
- else if (getBrowserView() && getBrowserView()->getVclControl() && !getBrowserView()->getVclControl()->IsEditing())
+ else if (getBrowserView() && getBrowserView()->getVclControl() && !getBrowserView()->getVclControl()->IsEditing() && getBrowserView()->getVclControl()->GetSelectRowCount() < 1)
{
SbaGridControl* pControl = getBrowserView()->getVclControl();
pControl->copyCellText(pControl->GetCurRow(), pControl->GetCurColumnId());
@@ -2346,31 +2345,34 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::rtl::OUString& _rDataSourceNam
SvLBoxEntry* pCommandType = NULL;
SvLBoxEntry* pCommand = getObjectEntry( _rDataSourceName, _rCommand, _nCommandType, &pDataSource, &pCommandType, sal_True, _rxConnection );
- // if (pDataSource) // OJ change for the new app
+ if (pCommand)
{
- if (pCommand)
+ bool bSuccess = true;
+ if ( _bSelectDirect )
{
- if ( _bSelectDirect )
- {
- implSelect( pCommand );
- }
- else
- m_pTreeView->getListBox().Select(pCommand);
+ bSuccess = implSelect( pCommand );
+ }
+ else
+ {
+ m_pTreeView->getListBox().Select( pCommand );
+ }
+ if ( bSuccess )
+ {
m_pTreeView->getListBox().MakeVisible(pCommand);
m_pTreeView->getListBox().SetCursor(pCommand);
}
- else if (!pCommandType)
- {
- if ( m_pCurrentlyDisplayed )
- { // tell the old entry (if any) it has been deselected
- selectPath(m_pCurrentlyDisplayed, sal_False);
- m_pCurrentlyDisplayed = NULL;
- }
-
- // we have a command and need to display this in the rowset
- return implLoadAnything(_rDataSourceName, _rCommand, _nCommandType, _bEscapeProcessing, _rxConnection);
+ }
+ else if (!pCommandType)
+ {
+ if ( m_pCurrentlyDisplayed )
+ { // tell the old entry (if any) it has been deselected
+ selectPath(m_pCurrentlyDisplayed, sal_False);
+ m_pCurrentlyDisplayed = NULL;
}
+
+ // we have a command and need to display this in the rowset
+ return implLoadAnything(_rDataSourceName, _rCommand, _nCommandType, _bEscapeProcessing, _rxConnection);
}
}
return sal_False;
@@ -2437,7 +2439,8 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
Reference< ::com::sun::star::form::XLoadable > xLoadable = getLoadable();
bRebuild |= !xLoadable->isLoaded();
- if(bRebuild)
+ bool bSuccess = true;
+ if ( bRebuild )
{
try
{
@@ -2458,7 +2461,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
if ( !pConData->xConnection.is() )
{
unloadAndCleanup( sal_False );
- return 0L;
+ return false;
}
Reference<XNameAccess> xNameAccess;
@@ -2532,6 +2535,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
}
catch (Exception&)
{
+ DBG_UNHANDLED_EXCEPTION();
}
}
}
@@ -2540,10 +2544,8 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
}
String sDataSourceName( getDataSourceAcessor( pConnection ) );
- if ( implLoadAnything( sDataSourceName, aName, nCommandType, sal_True, pConData->xConnection ) )
- // set the title of the beamer
- ;/*updateTitle();*/
- else
+ bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, sal_True, pConData->xConnection );
+ if ( !bSuccess )
{ // clean up
criticalFail();
}
@@ -2573,7 +2575,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
xRowSetProps->setPropertyValue(PROPERTY_ACTIVE_CONNECTION,Any());
}
}
- return true;
+ return bSuccess;
}
// -----------------------------------------------------------------------------
@@ -3698,8 +3700,25 @@ void SbaTableQueryBrowser::postReloadForm()
Reference< XEmbeddedScripts > SAL_CALL SbaTableQueryBrowser::getScriptContainer() throw (RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getScriptContainer" );
- Reference< XEmbeddedScripts > xScripts( m_xCurrentDatabaseDocument, UNO_QUERY );
- OSL_ENSURE( xScripts.is() || !m_xCurrentDatabaseDocument.is(),
+ // update our database document
+ Reference< XModel > xDocument;
+ try
+ {
+ Reference< XPropertySet > xCursorProps( getRowSet(), UNO_QUERY_THROW );
+ Reference< XConnection > xConnection( xCursorProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ), UNO_QUERY );
+ if ( xConnection.is() )
+ {
+ Reference< XChild > xChild( xConnection, UNO_QUERY_THROW );
+ Reference< XDocumentDataSource > xDataSource( xChild->getParent(), UNO_QUERY_THROW );
+ xDocument.set( xDataSource->getDatabaseDocument(), UNO_QUERY_THROW );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ Reference< XEmbeddedScripts > xScripts( xDocument, UNO_QUERY );
+ OSL_ENSURE( xScripts.is() || !xDocument.is(),
"SbaTableQueryBrowser::getScriptContainer: invalid database document!" );
return xScripts;
}
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index cc279ef65..cdad2f612 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -963,7 +963,8 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
{
const OTypeInfoMap* pTypeInfo = getTypeInfo();
OTypeInfoMap::const_iterator aIter = pTypeInfo->begin();
- for(;aIter != pTypeInfo->end();++aIter)
+ OTypeInfoMap::const_iterator aEnd = pTypeInfo->end();
+ for(;aIter != aEnd;++aIter)
m_pType->InsertEntry( aIter->second->aUIName );
}
m_pType->SelectEntryPos(0);
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index 1035203b0..4fb4dfb47 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -532,13 +532,14 @@ OTableListBoxControl::OTableListBoxControl( Window* _pParent
// -----------------------------------------------------------------------------
void OTableListBoxControl::fillListBoxes()
{
- DBG_ASSERT(m_pTableMap->size() >= 2, "OTableListBoxControl::OTableListBoxControl : brauche mindestens zwei TabWins !");
+ DBG_ASSERT( !m_pTableMap->empty(), "OTableListBoxControl::fillListBoxes: no table window!");
OTableWindow* pInitialLeft = NULL;
OTableWindow* pInitialRight = NULL;
// die Namen aller TabWins einsammeln
OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->begin();
- for(;aIter != m_pTableMap->end();++aIter)
+ OJoinTableView::OTableWindowMap::const_iterator aEnd = m_pTableMap->end();
+ for(;aIter != aEnd;++aIter)
{
m_lmbLeftTable.InsertEntry(aIter->first);
m_lmbRightTable.InsertEntry(aIter->first);
@@ -553,6 +554,12 @@ OTableListBoxControl::OTableListBoxControl( Window* _pParent
pInitialRight = aIter->second;
m_strCurrentRight = aIter->first;
}
+ } // for(;aIter != m_pTableMap->end();++aIter)
+
+ if ( !pInitialRight )
+ {
+ pInitialRight = pInitialLeft;
+ m_strCurrentRight = m_strCurrentLeft;
}
// die entsprechenden Defs an mein Controls
diff --git a/dbaccess/source/ui/control/curledit.cxx b/dbaccess/source/ui/control/curledit.cxx
index 38e11309c..bb9c97aac 100644
--- a/dbaccess/source/ui/control/curledit.cxx
+++ b/dbaccess/source/ui/control/curledit.cxx
@@ -48,6 +48,7 @@ namespace dbaui
//=========================================================================
OConnectionURLEdit::OConnectionURLEdit(Window* _pParent, const ResId& _rResId,BOOL _bShowPrefix)
:Edit(_pParent, _rResId)
+ ,m_pTypeCollection(NULL)
,m_pForcedPrefix(NULL)
,m_bShowPrefix(_bShowPrefix)
{
@@ -111,13 +112,7 @@ void OConnectionURLEdit::SetText(const String& _rStr, const Selection& /*_rNewSe
if (!bIsEmpty)
{
// determine the type of the new URL described by the new text
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(_rStr);
- // and the prefix belonging to this type
- if ( ::dbaccess::DST_UNKNOWN != eType)
- sPrefix = m_aTypeCollection.getDatasourcePrefix(eType);
- else {
- DBG_ERROR("OConnectionURLEdit::SetText : the new text is no valid connection URL!");
- }
+ sPrefix = m_pTypeCollection->getPrefix(_rStr);
}
// the fixed text gets the prefix
@@ -139,10 +134,10 @@ void OConnectionURLEdit::SetText(const String& _rStr, const Selection& /*_rNewSe
GetSubEdit()->Show();
// do the real SetTex
-// Edit::SetText(bIsEmpty ? _rStr : m_aTypeCollection.cutPrefix(_rStr), _rNewSelection);
+// Edit::SetText(bIsEmpty ? _rStr : m_pTypeCollection->cutPrefix(_rStr), _rNewSelection);
String sNewText( _rStr );
if ( !bIsEmpty )
- sNewText =m_aTypeCollection.cutPrefix( _rStr );
+ sNewText = m_pTypeCollection->cutPrefix( _rStr );
Edit::SetText( sNewText );
}
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 18fc3e287..52886cf3c 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -56,6 +56,7 @@
#ifndef _COM_SUN_STAR_UI_XCONTEXTMENUINTERCEPTOR_HPP_
#include <com/sun/star/ui/XContextMenuInterceptor.hpp>
#endif
+#include <com/sun/star/frame/XFrame.hpp>
#ifndef _COM_SUN_STAR_UTIL_URL_HPP_
#include <com/sun/star/util/URL.hpp>
#endif
@@ -80,7 +81,8 @@
#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/helper/vclunohelper.hxx>
#endif
-
+#include <framework/imageproducer.hxx>
+#include <vcl/svapp.hxx>
#include <memory>
// .........................................................................
@@ -88,6 +90,7 @@ namespace dbaui
{
// .........................................................................
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
@@ -546,9 +549,9 @@ namespace
{
lcl_adjustMenuItemIDs( *pPopup, _rCommandController );
continue;
- }
+ } // if ( pPopup )
- USHORT nCommandId = _rCommandController.registerCommandURL( aCommand );
+ const USHORT nCommandId = _rCommandController.registerCommandURL( aCommand );
_rMenu.InsertItem( nCommandId, _rMenu.GetItemText( nId ), _rMenu.GetItemImage( nId ),
_rMenu.GetItemBits( nId ), pos );
@@ -562,6 +565,34 @@ namespace
_rMenu.RemoveItem( pos+1 );
}
}
+ void lcl_insertMenuItemImages( Menu& _rMenu, IController& _rCommandController )
+ {
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ const BOOL bHiContrast = rSettings.GetMenuColor().IsDark();
+ uno::Reference< frame::XController > xController = _rCommandController.getXController();
+ uno::Reference< frame::XFrame> xFrame;
+ if ( xController.is() )
+ xFrame = xController->getFrame();
+ USHORT nCount = _rMenu.GetItemCount();
+ for ( USHORT pos = 0; pos < nCount; ++pos )
+ {
+ // do not adjust separators
+ if ( _rMenu.GetItemType( pos ) == MENUITEM_SEPARATOR )
+ continue;
+
+ USHORT nId = _rMenu.GetItemId(pos);
+ String aCommand = _rMenu.GetItemCommand( nId );
+ PopupMenu* pPopup = _rMenu.GetPopupMenu( nId );
+ if ( pPopup )
+ {
+ lcl_insertMenuItemImages( *pPopup, _rCommandController );
+ continue;
+ } // if ( pPopup )
+
+ if ( xFrame.is() )
+ _rMenu.SetItemImage(nId,framework::GetImageFromURL(xFrame,aCommand,FALSE,bHiContrast));
+ }
+ }
// =========================================================================
// = SelectionSupplier
// =========================================================================
@@ -629,6 +660,8 @@ PopupMenu* DBTreeListBox::CreateContextMenu( void )
pContextMenu.reset( m_pContextMenuProvider->getContextMenu( *this ) );
// disable what is not available currently
lcl_enableEntries( pContextMenu.get(), m_pContextMenuProvider->getCommandController() );
+ // set images
+ lcl_insertMenuItemImages( *pContextMenu, m_pContextMenuProvider->getCommandController() );
// allow context menu interception
::cppu::OInterfaceContainerHelper* pInterceptors = m_pContextMenuProvider->getContextMenuInterceptors();
if ( !pInterceptors || !pInterceptors->getLength() )
@@ -695,7 +728,7 @@ PopupMenu* DBTreeListBox::CreateContextMenu( void )
// the interceptors only know command URLs, but our menus primarily work
// with IDs -> we need to translate the commands to IDs
lcl_adjustMenuItemIDs( *pModifiedMenu, m_pContextMenuProvider->getCommandController() );
- }
+ } // if ( bModifiedMenu )
return pContextMenu.release();
}
diff --git a/dbaccess/source/ui/control/toolboxcontroller.cxx b/dbaccess/source/ui/control/toolboxcontroller.cxx
index d87511346..a7e19d70c 100644
--- a/dbaccess/source/ui/control/toolboxcontroller.cxx
+++ b/dbaccess/source/ui/control/toolboxcontroller.cxx
@@ -175,7 +175,8 @@ namespace dbaui
}
TCommandState::iterator aIter = m_aStates.begin();
- for (; aIter != m_aStates.end(); ++aIter)
+ TCommandState::iterator aEnd = m_aStates.end();
+ for (; aIter != aEnd; ++aIter)
addStatusListener(aIter->first);
ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
diff --git a/dbaccess/source/ui/dlg/AdabasStatDlg.cxx b/dbaccess/source/ui/dlg/AdabasStatDlg.cxx
deleted file mode 100644
index 225ef4135..000000000
--- a/dbaccess/source/ui/dlg/AdabasStatDlg.cxx
+++ /dev/null
@@ -1,208 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: AdabasStatDlg.cxx,v $
- * $Revision: 1.15.68.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-
-#ifndef DBAUI_ADABASSTATDLG_HXX
-#include "AdabasStatDlg.hxx"
-#endif
-#ifndef DBAUI_ADABASSTATDLG_HRC
-#include "AdabasStatDlg.hrc"
-#endif
-#ifndef _DBU_DLG_HRC_
-#include "dbu_dlg.hrc"
-#endif
-#ifndef _DBAUI_DATASOURCEITEMS_HXX_
-#include "dsitems.hxx"
-#endif
-#ifndef _SFXSTRITEM_HXX
-#include <svtools/stritem.hxx>
-#endif
-#ifndef _SFXENUMITEM_HXX
-#include <svtools/eitem.hxx>
-#endif
-#ifndef _SFXINTITEM_HXX
-#include <svtools/intitem.hxx>
-#endif
-#ifndef _VCL_STDTEXT_HXX
-#include <vcl/stdtext.hxx>
-#endif
-#ifndef _SV_MSGBOX_HXX
-#include <vcl/msgbox.hxx>
-#endif
-#ifndef _DBAUI_DATASOURCEITEMS_HXX_
-#include "dsitems.hxx"
-#endif
-#ifndef DBAUI_DRIVERSETTINGS_HXX
-#include "DriverSettings.hxx"
-#endif
-#ifndef _DBAUI_DBADMINIMPL_HXX_
-#include "DbAdminImpl.hxx"
-#endif
-#ifndef _DBAUI_PROPERTYSETITEM_HXX_
-#include "propertysetitem.hxx"
-#endif
-#ifndef _DBAUI_ADMINPAGES_HXX_
-#include "adminpages.hxx"
-#endif
-//.........................................................................
-namespace dbaui
-{
-//.........................................................................
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::sdbc;
-
- //========================================================================
- //= OAdabasStatPageDlg
-DBG_NAME(OAdabasStatPageDlg)
-//========================================================================
- OAdabasStatPageDlg::OAdabasStatPageDlg(Window* _pParent
- , SfxItemSet* _pItems
- ,const Reference< XMultiServiceFactory >& _rxORB
- ,const ::com::sun::star::uno::Any& _aDataSourceName)
- :SfxTabDialog(_pParent, ModuleRes(DLG_DATABASE_ADABASADMIN), _pItems)
- {
- DBG_CTOR(OAdabasStatPageDlg,NULL);
-
- m_pImpl = ::std::auto_ptr<ODbDataSourceAdministrationHelper>(new ODbDataSourceAdministrationHelper(_rxORB,_pParent,this));
- m_pImpl->setDataSourceOrName(_aDataSourceName);
- Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
- m_pImpl->translateProperties(xDatasource, *GetInputSetImpl());
- SetInputSet(GetInputSetImpl());
- // propagate this set as our new input set and reset the example set
- delete pExampleSet;
- pExampleSet = new SfxItemSet(*GetInputSetImpl());
-
- ::dbaccess::DATASOURCE_TYPE eType = m_pImpl->getDatasourceType(*GetInputSetImpl());
-
- switch ( eType )
- {
- case ::dbaccess::DST_ADABAS:
- AddTabPage(TAB_PAG_ADABAS_SETTINGS, String(ModuleRes(STR_PAGETITLE_ADABAS_STATISTIC)), ODriversSettings::CreateAdabas,0, sal_False, 1);
- break;
- default:
- OSL_ENSURE(0,"Not supported for other types thasn adabas!");
- break;
- }
-
- // remove the reset button - it's meaning is much too ambiguous in this dialog
- RemoveResetButton();
- FreeResource();
- }
-
- // -----------------------------------------------------------------------
- OAdabasStatPageDlg::~OAdabasStatPageDlg()
- {
- SetInputSet(NULL);
- DELETEZ(pExampleSet);
-
- DBG_DTOR(OAdabasStatPageDlg,NULL);
- }
- // -----------------------------------------------------------------------
- short OAdabasStatPageDlg::Execute()
- {
- short nRet = SfxTabDialog::Execute();
- if ( nRet == RET_OK )
- {
- pExampleSet->Put(*GetOutputItemSet());
- m_pImpl->saveChanges(*pExampleSet);
- }
- return nRet;
- }
- //-------------------------------------------------------------------------
- void OAdabasStatPageDlg::PageCreated(USHORT _nId, SfxTabPage& _rPage)
- {
- // register ourself as modified listener
- static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory(m_pImpl->getORB());
- static_cast<OGenericAdministrationPage&>(_rPage).SetAdminDialog(this,this);
-
- AdjustLayout();
- Window *pWin = GetViewWindow();
- if(pWin)
- pWin->Invalidate();
-
- SfxTabDialog::PageCreated(_nId, _rPage);
- }
- // -----------------------------------------------------------------------------
- const SfxItemSet* OAdabasStatPageDlg::getOutputSet() const
- {
- return GetExampleSet();
- }
- // -----------------------------------------------------------------------------
- SfxItemSet* OAdabasStatPageDlg::getWriteOutputSet()
- {
- return pExampleSet;
- }
- // -----------------------------------------------------------------------------
- ::std::pair< Reference<XConnection>,sal_Bool> OAdabasStatPageDlg::createConnection()
- {
- return m_pImpl->createConnection();
- }
- // -----------------------------------------------------------------------------
- Reference< XMultiServiceFactory > OAdabasStatPageDlg::getORB() const
- {
- return m_pImpl->getORB();
- }
- // -----------------------------------------------------------------------------
- Reference< XDriver > OAdabasStatPageDlg::getDriver()
- {
- return m_pImpl->getDriver();
- }
- // -----------------------------------------------------------------------------
- ::dbaccess::DATASOURCE_TYPE OAdabasStatPageDlg::getDatasourceType(const SfxItemSet& _rSet) const
- {
- return m_pImpl->getDatasourceType(_rSet);
- }
- // -----------------------------------------------------------------------------
- void OAdabasStatPageDlg::clearPassword()
- {
- m_pImpl->clearPassword();
- }
- // -----------------------------------------------------------------------------
- void OAdabasStatPageDlg::setTitle(const ::rtl::OUString& _sTitle)
- {
- SetText(_sTitle);
- }
- //-------------------------------------------------------------------------
- void OAdabasStatPageDlg::enableConfirmSettings( bool _bEnable )
- {
- (void)_bEnable;
- }
- //-------------------------------------------------------------------------
- sal_Bool OAdabasStatPageDlg::saveDatasource()
- {
- return PrepareLeaveCurrentPage();
- }
-//.........................................................................
-} // namespace dbaui
-//.........................................................................
diff --git a/dbaccess/source/ui/dlg/AdabasStatDlg.hrc b/dbaccess/source/ui/dlg/AdabasStatDlg.hrc
deleted file mode 100644
index d84d6b4f3..000000000
--- a/dbaccess/source/ui/dlg/AdabasStatDlg.hrc
+++ /dev/null
@@ -1,36 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: AdabasStatDlg.hrc,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef DBAUI_ADABASSTATDLG_HRC
-#define DBAUI_ADABASSTATDLG_HRC
-
-#define STR_PAGETITLE_ADABAS_STATISTIC 1
-
-
-#endif // DBAUI_ADABASSTATDLG_HRC
diff --git a/dbaccess/source/ui/dlg/AdabasStatDlg.src b/dbaccess/source/ui/dlg/AdabasStatDlg.src
deleted file mode 100644
index 9b14703fc..000000000
--- a/dbaccess/source/ui/dlg/AdabasStatDlg.src
+++ /dev/null
@@ -1,64 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: AdabasStatDlg.src,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _DBA_DBACCESS_HELPID_HRC_
-#include "dbaccess_helpid.hrc"
-#endif
-#ifndef DBAUI_ADABASSTATDLG_HRC
-#include "AdabasStatDlg.hrc"
-#endif
-#ifndef _DBU_DLG_HRC_
-#include "dbu_dlg.hrc"
-#endif
-
-
-TabDialog DLG_DATABASE_ADABASADMIN
-{
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Hide = TRUE;
- HelpId = HID_DSADMIN_ADABASADMIN;
-
- TabControl 1
- {
- OutputSize = TRUE ;
- HelpId = HID_DSADMIN_TABCONTROL;
- SingleLine=TRUE;
- };
- String STR_PAGETITLE_ADABAS_STATISTIC
- {
- Text [ en-US ] = "Adabas D Statistics";
- };
-
- Text [ en-US ] = "Advanced Properties" ;
-};
-
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 0c17b0627..cdc8566f6 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -207,6 +207,7 @@ DBG_NAME(OConnectionHelper)
m_pCollection = pCollectionItem->getCollection();
m_aPB_Connection.SetClickHdl(LINK(this, OConnectionHelper, OnBrowseConnections));
DBG_ASSERT(m_pCollection, "OConnectionHelper::OConnectionHelper : really need a DSN type collection !");
+ m_aConnectionURL.SetTypeCollection(m_pCollection);
}
@@ -226,7 +227,7 @@ DBG_NAME(OConnectionHelper)
m_aFT_Connection.Show();
m_aConnectionURL.Show();
- m_aConnectionURL.ShowPrefix( ::dbaccess::DST_JDBC == m_eType );
+ m_aConnectionURL.ShowPrefix( ::dbaccess::DST_JDBC == m_pCollection->determineType(m_eType) );
BOOL bEnableBrowseButton = m_pCollection->supportsBrowsing( m_eType );
m_aPB_Connection.Show( bEnableBrowseButton );
@@ -253,21 +254,16 @@ DBG_NAME(OConnectionHelper)
if ( !m_pAdminDialog )
return;
- switch ( m_eType )
- {
- case ::dbaccess::DST_CALC:
+ if ( m_pCollection->isFileSystemBased(m_eType) )
m_pAdminDialog->enableConfirmSettings( getURLNoPrefix().Len() > 0 );
- break;
- default:
- break;
- }
}
// -----------------------------------------------------------------------
IMPL_LINK(OConnectionHelper, OnBrowseConnections, PushButton*, /*_pButton*/)
{
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
- switch ( m_eType )
+ const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
+ switch ( eType )
{
case ::dbaccess::DST_DBASE:
case ::dbaccess::DST_FLAT:
@@ -324,15 +320,16 @@ DBG_NAME(OConnectionHelper)
break;
case ::dbaccess::DST_CALC:
{
+ SvtModuleOptions aModule;
::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN
- ,SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC)
+ ,aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC)
,SFX_FILTER_IMPORT);
askForFileName(aFileDlg);
}
break;
case ::dbaccess::DST_MSACCESS:
{
- ::rtl::OUString sExt(RTL_CONSTASCII_USTRINGPARAM("*.mdb"));
+ const ::rtl::OUString sExt(RTL_CONSTASCII_USTRINGPARAM("*.mdb"));
String sFilterName(ModuleRes (STR_MSACCESS_FILTERNAME));
::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN);
aFileDlg.AddFilter(sFilterName,sExt);
@@ -342,7 +339,7 @@ DBG_NAME(OConnectionHelper)
break;
case ::dbaccess::DST_MSACCESS_2007:
{
- ::rtl::OUString sAccdb(RTL_CONSTASCII_USTRINGPARAM("*.accdb"));
+ const ::rtl::OUString sAccdb(RTL_CONSTASCII_USTRINGPARAM("*.accdb"));
String sFilterName2(ModuleRes (STR_MSACCESS_2007_FILTERNAME));
::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN);
aFileDlg.AddFilter(sFilterName2,sAccdb);
@@ -413,7 +410,7 @@ DBG_NAME(OConnectionHelper)
aInstalledDBs = getInstalledAdabasDBs(sAdabasConfigDir,sAdabasWorkDir);
}
- ODatasourceSelectDialog aSelector(GetParent(), aInstalledDBs, m_eType,m_pItemSetHelper->getWriteOutputSet());
+ ODatasourceSelectDialog aSelector(GetParent(), aInstalledDBs, true,m_pItemSetHelper->getWriteOutputSet());
if (RET_OK == aSelector.Execute())
{
setURLNoPrefix(aSelector.GetSelected());
@@ -435,9 +432,9 @@ DBG_NAME(OConnectionHelper)
case ::dbaccess::DST_ODBC:
{
// collect all ODBC data source names
- ::rtl::OUString sCurrDatasource=getURLNoPrefix();
+ ::rtl::OUString sCurrDatasource = getURLNoPrefix();
::rtl::OUString sDataSource;
- if ( getSelectedDataSource(m_eType,sDataSource,sCurrDatasource) && sDataSource.getLength() )
+ if ( getSelectedDataSource(sDataSource,sCurrDatasource) && sDataSource.getLength() )
{
setURLNoPrefix(sDataSource);
SetRoadmapStateValue(sal_True);
@@ -469,7 +466,7 @@ DBG_NAME(OConnectionHelper)
case ::dbaccess::DST_THUNDERBIRD:
{
MozillaProductType profileType = MozillaProductType_Mozilla;
- if (m_eType == ::dbaccess::DST_THUNDERBIRD)
+ if (eType == ::dbaccess::DST_THUNDERBIRD)
profileType = MozillaProductType_Thunderbird;
Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
@@ -496,7 +493,7 @@ DBG_NAME(OConnectionHelper)
// excute the select dialog
- ODatasourceSelectDialog aSelector(GetParent(), aProfiles, m_eType);
+ ODatasourceSelectDialog aSelector(GetParent(), aProfiles, eType);
::rtl::OUString sOldProfile=getURLNoPrefix();
if (sOldProfile.getLength())
@@ -539,7 +536,7 @@ DBG_NAME(OConnectionHelper)
String sTypePrefix, sFileURLEncoded;
if ( _bPrefix )
{
- sTypePrefix = m_pCollection->getDatasourcePrefix( m_eType );
+ sTypePrefix = m_pCollection->getPrefix( m_eType );
sFileURLEncoded = m_pCollection->cutPrefix( sURL );
}
else
@@ -585,7 +582,7 @@ DBG_NAME(OConnectionHelper)
String sTypePrefix, sFileURLDecoded;
if ( _bPrefix )
{
- sTypePrefix = m_pCollection->getDatasourcePrefix( m_eType );
+ sTypePrefix = m_pCollection->getPrefix( m_eType );
sFileURLDecoded = m_pCollection->cutPrefix( sURL );
}
else
@@ -770,10 +767,12 @@ DBG_NAME(OConnectionHelper)
aConfigDBs = getInstalledAdabasDBDirs(sAdabasConfigDir,::ucbhelper::INCLUDE_DOCUMENTS_ONLY);
aWrkDBs = getInstalledAdabasDBDirs(sAdabasWorkDir,::ucbhelper::INCLUDE_FOLDERS_ONLY);
ConstStringBagIterator aOuter = aConfigDBs.begin();
- for(;aOuter != aConfigDBs.end();++aOuter)
+ ConstStringBagIterator aOuterEnd = aConfigDBs.end();
+ for(;aOuter != aOuterEnd;++aOuter)
{
ConstStringBagIterator aInner = aWrkDBs.begin();
- for (;aInner != aWrkDBs.end(); ++aInner)
+ ConstStringBagIterator aInnerEnd = aWrkDBs.end();
+ for (;aInner != aInnerEnd; ++aInner)
{
if (aInner->equalsIgnoreAsciiCase(*aOuter))
{
@@ -811,11 +810,8 @@ DBG_NAME(OConnectionHelper)
//-------------------------------------------------------------------------
long OConnectionHelper::PreNotify( NotifyEvent& _rNEvt )
{
- if ( ( ::dbaccess::DST_DBASE == m_eType)
- || ( ::dbaccess::DST_FLAT == m_eType)
- || ( ::dbaccess::DST_MSACCESS == m_eType)
- || ( ::dbaccess::DST_MSACCESS_2007 == m_eType)
- || ( ::dbaccess::DST_CALC == m_eType) )
+ if ( m_pCollection->isFileSystemBased(m_eType) )
+ {
switch (_rNEvt.GetType())
{
case EVENT_GETFOCUS:
@@ -832,7 +828,8 @@ DBG_NAME(OConnectionHelper)
return 1L; // handled
}
break;
- }
+ } // switch (_rNEvt.GetType())
+ }
return OGenericAdministrationPage::PreNotify( _rNEvt );
}
@@ -933,13 +930,7 @@ DBG_NAME(OConnectionHelper)
sOldPath = m_aConnectionURL.GetSavedValueNoPrefix();
sURL = m_aConnectionURL.GetTextNoPrefix();
- switch ( m_eType )
- {
- case ::dbaccess::DST_DBASE:
- case ::dbaccess::DST_FLAT:
- case ::dbaccess::DST_MSACCESS:
- case ::dbaccess::DST_MSACCESS_2007:
- case ::dbaccess::DST_CALC:
+ if ( m_pCollection->isFileSystemBased(m_eType) )
{
if ( ( sURL != sOldPath ) && ( 0 != sURL.Len() ) )
{ // the text changed since entering the control
@@ -948,7 +939,9 @@ DBG_NAME(OConnectionHelper)
OFileNotation aTransformer(sURL);
sURL = aTransformer.get(OFileNotation::N_URL);
- if ( ( ::dbaccess::DST_CALC == m_eType) || ( ::dbaccess::DST_MSACCESS == m_eType) || ( ::dbaccess::DST_MSACCESS_2007 == m_eType) )
+ const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
+
+ if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_MSACCESS == eType) || ( ::dbaccess::DST_MSACCESS_2007 == eType) )
{ // #106016# --------------------------
if( pathExists(sURL, sal_True) == PATH_NOT_EXIST )
{
@@ -978,10 +971,6 @@ DBG_NAME(OConnectionHelper)
}
}
}
- break;
- default:
- break;
- }
setURLNoPrefix(sURL);
m_aConnectionURL.SaveValueNoPrefix();
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.hxx b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
index d43933858..4cccc270f 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
@@ -77,8 +77,7 @@ namespace dbaui
FixedText m_aFT_Connection;
OConnectionURLEdit m_aConnectionURL;
PushButton m_aPB_Connection;
- ::dbaccess::DATASOURCE_TYPE
- m_eType; // the type can't be changed in this class, so we hold it as member.
+ ::rtl::OUString m_eType; // the type can't be changed in this class, so we hold it as member.
public:
@@ -122,7 +121,6 @@ namespace dbaui
virtual void SetServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB)
{
OGenericAdministrationPage::SetServiceFactory(_rxORB);
- m_aConnectionURL.initializeTypeCollection(m_xORB);
}
protected:
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index 385912f62..0fd8ebc13 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -200,7 +200,6 @@ namespace dbaui
DBG_NAME(OConnectionTabPage)
OConnectionTabPage::OConnectionTabPage(Window* pParent, const SfxItemSet& _rCoreAttrs)
:OConnectionHelper(pParent, ModuleRes(PAGE_CONNECTION), _rCoreAttrs)
- ,m_pCollection(NULL)
,m_bUserGrabFocus(sal_True)
,m_aFL1(this, ModuleRes(FL_SEPARATOR1))
,m_aFL2(this, ModuleRes(FL_SEPARATOR2))
@@ -223,12 +222,6 @@ namespace dbaui
m_aTestConnection.SetClickHdl(LINK(this,OGenericAdministrationPage,OnTestConnectionClickHdl));
m_aTestJavaDriver.SetClickHdl(LINK(this,OConnectionTabPage,OnTestJavaClickHdl));
- // extract the datasource type collection from the item set
- DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rCoreAttrs.GetItem(DSID_TYPECOLLECTION));
- if (pCollectionItem)
- m_pCollection = pCollectionItem->getCollection();
- DBG_ASSERT(m_pCollection, "OConnectionTabPage::OConnectionTabPage : really need a DSN type collection !");
-
FreeResource();
}
@@ -249,7 +242,8 @@ namespace dbaui
OConnectionHelper::implInitControls( _rSet, _bSaveValue);
LocalResourceAccess aLocRes( PAGE_CONNECTION, RSC_TABPAGE );
- switch( m_eType )
+ ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
+ switch( eType )
{
case ::dbaccess::DST_DBASE:
m_aFT_Connection.SetText(String(ModuleRes(STR_DBASE_PATH_OR_FILE)));
@@ -287,7 +281,7 @@ namespace dbaui
case ::dbaccess::DST_MYSQL_ODBC:
case ::dbaccess::DST_ODBC:
m_aFT_Connection.SetText(String(ModuleRes(STR_NAME_OF_ODBC_DATASOURCE)));
- m_aConnectionURL.SetHelpId( m_eType == ::dbaccess::DST_MYSQL_ODBC ? HID_DSADMIN_MYSQL_ODBC_DATASOURCE : HID_DSADMIN_ODBC_DATASOURCE);
+ m_aConnectionURL.SetHelpId( eType == ::dbaccess::DST_MYSQL_ODBC ? HID_DSADMIN_MYSQL_ODBC_DATASOURCE : HID_DSADMIN_ODBC_DATASOURCE);
break;
case ::dbaccess::DST_LDAP:
m_aFT_Connection.SetText(String(ModuleRes(STR_HOSTNAME)));
@@ -319,8 +313,6 @@ namespace dbaui
m_aConnectionURL.Hide();
break;
case ::dbaccess::DST_JDBC:
- m_aFT_Connection.SetText(String(ModuleRes(STR_COMMONURL)));
- // run through
default:
m_aFT_Connection.SetText(String(ModuleRes(STR_COMMONURL)));
break;
@@ -355,8 +347,18 @@ namespace dbaui
String sUrl = pUrlItem->GetValue();
setURL( sUrl );
- BOOL bEnableJDBC = m_eType == ::dbaccess::DST_JDBC;
- m_aJavaDriver.SetText(pJdbcDrvItem->GetValue());
+ const BOOL bEnableJDBC = m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC;
+ if ( !pJdbcDrvItem->GetValue().Len() )
+ {
+ String sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
+ if ( sDefaultJdbcDriverName.Len() )
+ {
+ m_aJavaDriver.SetText(sDefaultJdbcDriverName);
+ m_aJavaDriver.SetModifyFlag();
+ }
+ } // if ( !pJdbcDrvItem->GetValue().Len() )
+ else
+ m_aJavaDriver.SetText(pJdbcDrvItem->GetValue());
m_aJavaDriverLabel.Show(bEnableJDBC);
m_aJavaDriver.Show(bEnableJDBC);
@@ -409,7 +411,7 @@ namespace dbaui
fillBool(_rSet,&m_aPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
- if ( m_eType == ::dbaccess::DST_JDBC )
+ if ( m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC )
{
fillString(_rSet,&m_aJavaDriver, DSID_JDBCDRIVERCLASS, bChangedSomething);
}
@@ -445,7 +447,7 @@ namespace dbaui
{
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
BOOL bEnableTestConnection = !m_aConnectionURL.IsVisible() || (m_aConnectionURL.GetTextNoPrefix().Len() != 0);
- if ( m_eType == ::dbaccess::DST_JDBC )
+ if ( m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC )
bEnableTestConnection = bEnableTestConnection && (m_aJavaDriver.GetText().Len() != 0);
m_aTestConnection.Enable(bEnableTestConnection);
return true;
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.hxx b/dbaccess/source/ui/dlg/ConnectionPage.hxx
index 3a22f5435..340be1fa0 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.hxx
@@ -58,8 +58,6 @@ namespace dbaui
*/
class OConnectionTabPage : public OConnectionHelper
{
- ::dbaccess::ODsnTypeCollection*
- m_pCollection; /// the DSN type collection instance
sal_Bool m_bUserGrabFocus : 1;
protected:
// connection
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
index 56474f6c1..f38e794ed 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
@@ -272,20 +272,22 @@ namespace dbaui
m_eType = m_pAdminDialog->getDatasourceType(_rSet);
// special handling for oracle, this can only happen
// if the user enters the same url as used for Oracle and we are on the JDBC path
- if ( ::dbaccess::DST_ORACLE_JDBC == m_eType )
- m_eType = ::dbaccess::DST_JDBC;
+ //! TODO
+ //if ( ::dbaccess::DST_ORACLE_JDBC == m_eType )
+ // m_eType = ::dbaccess::DST_JDBC;
OConnectionHelper::implInitControls(_rSet, _bSaveValue);
-
- if ( m_eType >= ::dbaccess::DST_USERDEFINE1 )
- {
- String sDisplayName = m_pCollection->getTypeDisplayName(m_eType);
- FixedText* ppTextControls[] ={&m_aFT_Connection};
- for (size_t i = 0; i < sizeof(ppTextControls)/sizeof(ppTextControls[0]); ++i)
- {
- ppTextControls[i]->SetText(sDisplayName);
- }
- }
+
+ //! TODO
+ //if ( m_eType >= ::dbaccess::DST_USERDEFINE1 )
+ //{
+ // String sDisplayName = m_pCollection->getTypeDisplayName(m_eType);
+ // FixedText* ppTextControls[] ={&m_aFT_Connection};
+ // for (size_t i = 0; i < sizeof(ppTextControls)/sizeof(ppTextControls[0]); ++i)
+ // {
+ // ppTextControls[i]->SetText(sDisplayName);
+ // }
+ //}
callModifiedHdl();
}
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index bc5fc91a1..3b649c6f7 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -103,37 +103,16 @@
#include <svtools/filenotation.hxx>
#endif
-#ifndef _UNOTOOLS_LOCALFILEHELPER_HXX
#include <unotools/localfilehelper.hxx>
-#endif
-#ifndef _UNOTOOLS_UCBHELPER_HXX
#include <unotools/ucbhelper.hxx>
-#endif
-#ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
#include <ucbhelper/commandenvironment.hxx>
-#endif
-#ifndef DBAUI_FILEPICKER_INTERACTION_HXX
#include "finteraction.hxx"
-#endif
-#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
#include <connectivity/CommonTools.hxx>
-#endif
-
-#ifndef _DBA_DBACCESS_HELPID_HRC_
+#include <connectivity/DriversConfig.hxx>
#include "dbaccess_helpid.hrc"
-#endif
-
-#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX
#include <svtools/pathoptions.hxx>
-#endif
-
-#ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX
#include <svtools/roadmapwizard.hxx>
-#endif
-
-#ifndef DBAUI_TEXTCONNECTIONHELPER_HXX
#include "TextConnectionHelper.hxx"
-#endif
//.........................................................................
@@ -288,7 +267,7 @@ DBG_NAME(OTextConnectionPageSetup)
pCollection = pCollectionItem->getCollection();
DBG_ASSERT(pCollection, "OLDAPConnectionPageSetup::FillItemSet : really need a DSN type collection !");
- String sUrl = pCollection->getDatasourcePrefix( ::dbaccess::DST_LDAP);
+ String sUrl = pCollection->getPrefix( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:ldap:")));
sUrl += m_aETHostServer.GetText();
_rSet.Put(SfxStringItem(DSID_CONNECTURL, sUrl));
bChangedSomething = sal_True;
@@ -389,13 +368,10 @@ DBG_NAME(OMySQLIntroPageSetup)
void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/)
{
DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
- ::dbaccess::ODsnTypeCollection* pCollection = NULL;
if (pCollectionItem)
{
- pCollection = pCollectionItem->getCollection();
- String sUrl = pCollection->getDatasourcePrefix( ::dbaccess::DST_MYSQL_NATIVE);
- uno::Reference< sdbc::XDriverAccess > xDriverManager( m_xORB->createInstance( SERVICE_SDBC_DRIVERMANAGER ), uno::UNO_QUERY );
- if ( xDriverManager.is() && xDriverManager->getDriverByURL( sUrl ).is() )
+ ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
+ if ( pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:"))).Len() )
{
m_aRB_NATIVEDatabase.Show();
m_aRB_JDBCDatabase.SetState(sal_False);
@@ -443,7 +419,6 @@ DBG_NAME(OMySQLIntroPageSetup)
_rAttrSet,
DSID_MYSQL_PORTNUMBER ,
STR_MYSQL_DEFAULT,
- "com.mysql.jdbc.Driver",
STR_MYSQLJDBC_HELPTEXT,
STR_MYSQLJDBC_HEADERTEXT,
STR_MYSQL_DRIVERCLASSTEXT) );
@@ -457,7 +432,6 @@ DBG_NAME(OMySQLIntroPageSetup)
_rAttrSet,
DSID_MYSQL_PORTNUMBER ,
STR_MYSQL_DEFAULT,
- NULL,
STR_MYSQLJDBC_HELPTEXT,
STR_MYSQLJDBC_HEADERTEXT,
0) );
@@ -472,7 +446,6 @@ DBG_NAME(OMySQLIntroPageSetup)
_rAttrSet,
DSID_ORACLE_PORTNUMBER,
STR_ORACLE_DEFAULT,
- "oracle.jdbc.driver.OracleDriver",
STR_ORACLE_HELPTEXT,
STR_ORACLE_HEADERTEXT,
STR_ORACLE_DRIVERCLASSTEXT) );
@@ -482,7 +455,7 @@ DBG_NAME(OMySQLIntroPageSetup)
//========================================================================
//= OMySQLJDBCConnectionPageSetup
//========================================================================
- OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId, USHORT _nDefaultPortResId, const sal_Char* _pDriverName, USHORT _nHelpTextResId, USHORT _nHeaderTextResId, USHORT _nDriverClassId)
+ OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId, USHORT _nDefaultPortResId, USHORT _nHelpTextResId, USHORT _nHeaderTextResId, USHORT _nDriverClassId)
:OGenericAdministrationPage(pParent, ModuleRes(_nResId), _rCoreAttrs)
,m_pFTHeaderText (NULL)
,m_aFTHelpText (this, ModuleRes(FT_AUTOWIZARDHELPTEXT))
@@ -533,7 +506,15 @@ DBG_NAME(OMySQLIntroPageSetup)
m_aNFPortNumber.SetUseThousandSep(sal_False);
if ( m_bUseClass )
- m_sDefaultJdbcDriverName = String::CreateFromAscii(_pDriverName);
+ {
+ SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
+ SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
+ ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
+ if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
+ {
+ m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
+ }
+ }
SetRoadmapStateValue(sal_False);
FreeResource();
}
@@ -710,8 +691,20 @@ DBG_NAME(OMySQLIntroPageSetup)
if ( bValid )
{
- m_aETDriverClass.SetText(pDrvItem->GetValue());
- m_aETDriverClass.ClearModifyFlag();
+ if ( !pDrvItem->GetValue().Len() )
+ {
+ String sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
+ if ( sDefaultJdbcDriverName.Len() )
+ {
+ m_aETDriverClass.SetText(sDefaultJdbcDriverName);
+ m_aETDriverClass.SetModifyFlag();
+ } // if ( sDefaultJdbcDriverName.Len() )
+ } // if ( !pJdbcDrvItem->GetValue().Len() )
+ else
+ {
+ m_aETDriverClass.SetText(pDrvItem->GetValue());
+ m_aETDriverClass.ClearModifyFlag();
+ }
}
sal_Bool bEnable = pDrvItem->GetValue().Len() != 0;
m_aPBTestJavaDriver.Enable(bEnable);
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index 504d01176..5813af68c 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -152,7 +152,6 @@ namespace dbaui
, const SfxItemSet& _rCoreAttrs
, USHORT _nPortId
, USHORT _nDefaultPortResId
- , const sal_Char* _pDriverName
, USHORT _nHelpTextResId
, USHORT _nHeaderTextResId
, USHORT _nDriverClassId );
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 32fd516c9..d205a12bb 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -61,6 +61,7 @@
#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
#endif
+#include <connectivity/DriversConfig.hxx>
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
@@ -472,21 +473,14 @@ Reference< XPropertySet > ODbDataSourceAdministrationHelper::getCurrentDataSourc
return m_xDatasource;
}
//-------------------------------------------------------------------------
-::dbaccess::DATASOURCE_TYPE ODbDataSourceAdministrationHelper::getDatasourceType( const SfxItemSet& _rSet )
+::rtl::OUString ODbDataSourceAdministrationHelper::getDatasourceType( const SfxItemSet& _rSet )
{
SFX_ITEMSET_GET( _rSet, pConnectURL, SfxStringItem, DSID_CONNECTURL, sal_True );
- SFX_ITEMSET_GET( _rSet, pTypeCollection, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True );
- DBG_ASSERT( pConnectURL && pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!" );
- if ( !pConnectURL || !pTypeCollection )
- return ::dbaccess::DST_UNKNOWN;
-
- String sConnectURL = pConnectURL->GetValue();
+ DBG_ASSERT( pConnectURL , "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!" );
+ SFX_ITEMSET_GET(_rSet, pTypeCollection, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
+ DBG_ASSERT(pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
- DBG_ASSERT( pCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid type collection!" );
- if ( !pCollection )
- return ::dbaccess::DST_UNKNOWN;
-
- return pCollection->getType( sConnectURL );
+ return pCollection->getType(pConnectURL->GetValue());
}
//-------------------------------------------------------------------------
@@ -499,7 +493,7 @@ String ODbDataSourceAdministrationHelper::getConnectionURL() const
{
String sNewUrl;
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(*m_pItemSetHelper->getOutputSet());
+ ::rtl::OUString eType = getDatasourceType(*m_pItemSetHelper->getOutputSet());
SFX_ITEMSET_GET(*m_pItemSetHelper->getOutputSet(), pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
SFX_ITEMSET_GET(*m_pItemSetHelper->getOutputSet(), pTypeCollection, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
@@ -509,9 +503,7 @@ String ODbDataSourceAdministrationHelper::getConnectionURL() const
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
DBG_ASSERT(pCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid type collection!");
-
-
- switch( eType )
+ switch( pCollection->determineType(eType) )
{
case ::dbaccess::DST_DBASE:
case ::dbaccess::DST_FLAT:
@@ -599,7 +591,7 @@ String ODbDataSourceAdministrationHelper::getConnectionURL() const
}
if ( sNewUrl.Len() )
{
- String sUrl = pCollection->getDatasourcePrefix(eType);
+ String sUrl = pCollection->getPrefix(eType);
sUrl += sNewUrl;
sNewUrl = sUrl;
}
@@ -672,18 +664,21 @@ void ODbDataSourceAdministrationHelper::translateProperties(const Reference< XPr
}
// go through all known translations and check if we have such a setting
- PropertyValue aSearchFor;
- for ( ConstMapInt2StringIterator aIndirect = m_aIndirectPropTranslator.begin();
- aIndirect != m_aIndirectPropTranslator.end();
- ++aIndirect
- )
+ if ( !aInfos.empty() )
{
- aSearchFor.Name = aIndirect->second;
- ConstPropertyValueSetIterator aInfoPos = aInfos.find(aSearchFor);
- if (aInfos.end() != aInfoPos)
- // the property is contained in the info sequence
- // -> transfer it into an item
- implTranslateProperty(_rDest, aIndirect->first, aInfoPos->Value);
+ PropertyValue aSearchFor;
+ ConstMapInt2StringIterator aEnd = m_aIndirectPropTranslator.end();
+ for ( ConstMapInt2StringIterator aIndirect = m_aIndirectPropTranslator.begin();
+ aIndirect != aEnd;
+ ++aIndirect)
+ {
+ aSearchFor.Name = aIndirect->second;
+ ConstPropertyValueSetIterator aInfoPos = aInfos.find(aSearchFor);
+ if (aInfos.end() != aInfoPos)
+ // the property is contained in the info sequence
+ // -> transfer it into an item
+ implTranslateProperty(_rDest, aIndirect->first, aInfoPos->Value);
+ }
}
convertUrl(_rDest);
@@ -770,9 +765,9 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
// us)
// first determine which of all the items are relevant for the data source (depends on the connection url)
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(_rSource);
+ ::rtl::OUString eType = getDatasourceType(_rSource);
::std::vector< sal_Int32> aDetailIds;
- ODriversSettings::getSupportedIndirectSettings(eType,aDetailIds);
+ ODriversSettings::getSupportedIndirectSettings(eType,getORB(),aDetailIds);
// collect the translated property values for the relevant items
PropertyValueSet aRelevantSettings;
@@ -874,22 +869,13 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
#endif
}
+ ::connectivity::DriversConfig aDriverConfig(getORB());
+ const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(eType);
+ Sequence< Any> aTypeSettings;
+ aTypeSettings = aProperties.getOrDefault("TypeInfoSettings",aTypeSettings);
// here we have a special entry for types from oracle
- if ( eType == ::dbaccess::DST_ORACLE_JDBC )
+ if ( aTypeSettings.getLength() )
{
- Sequence< Any > aTypeSettings;
- static const ::rtl::OUString s_sCondition(RTL_CONSTASCII_USTRINGPARAM("Column(2) = "));
- static const ::rtl::OUString s_sValue(RTL_CONSTASCII_USTRINGPARAM("Column(6) = PRECISION"));
- static const sal_Int32 pTypes[] = { -5, -4, -3, -2, -1, 1, 2, 12};
- aTypeSettings.realloc((sizeof(pTypes)/sizeof(pTypes[0])) * 2);
- Any* pCondIter = aTypeSettings.getArray();
- const Any* pCondEnd = pCondIter + aTypeSettings.getLength();
- for(const sal_Int32* pType = pTypes;pCondIter != pCondEnd;++pCondIter,++pType)
- {
- *pCondIter <<= (s_sCondition + ::rtl::OUString::valueOf(*pType));
- ++pCondIter;
- *pCondIter <<= s_sValue;
- }
aRelevantSettings.insert(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeInfoSettings")), 0, makeAny(aTypeSettings), PropertyState_DIRECT_VALUE));
}
@@ -1078,7 +1064,7 @@ String ODbDataSourceAdministrationHelper::getDocumentUrl(SfxItemSet& _rDest)
// -----------------------------------------------------------------------------
void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
{
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(_rDest);
+ ::rtl::OUString eType = getDatasourceType(_rDest);
SFX_ITEMSET_GET(_rDest, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
SFX_ITEMSET_GET(_rDest, pTypeCollection, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
@@ -1091,12 +1077,13 @@ void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
USHORT nPortNumberId = 0;
sal_Int32 nPortNumber = -1;
String sNewHostName;
- String sUrl = pCollection->cutPrefix(pUrlItem->GetValue());
+ //String sUrl = pCollection->cutPrefix(pUrlItem->GetValue());
String sUrlPart;
pCollection->extractHostNamePort(pUrlItem->GetValue(),sUrlPart,sNewHostName,nPortNumber);
+ const ::dbaccess::DATASOURCE_TYPE eTy = pCollection->determineType(eType);
- switch( eType )
+ switch( eTy )
{
case ::dbaccess::DST_MYSQL_NATIVE:
case ::dbaccess::DST_MYSQL_JDBC:
@@ -1114,13 +1101,13 @@ void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
if ( sUrlPart.Len() )
{
- if ( eType == ::dbaccess::DST_MYSQL_NATIVE )
+ if ( eTy == ::dbaccess::DST_MYSQL_NATIVE )
{
_rDest.Put( SfxStringItem( DSID_DATABASENAME, sUrlPart ) );
}
else
{
- String sNewUrl = pCollection->getDatasourcePrefix(eType);
+ String sNewUrl = pCollection->getPrefix(eType);
sNewUrl += sUrlPart;
_rDest.Put( SfxStringItem( DSID_CONNECTURL, sNewUrl ) );
}
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.hxx b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
index fa1990e53..a8517c86c 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.hxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
@@ -71,6 +71,16 @@ class Window;
namespace dbaui
{
//.........................................................................
+ class DataSourceInfoConverter
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ public:
+ DataSourceInfoConverter(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory)
+ :m_xFactory(_xFactory)
+ {
+ }
+ void convert(const ::dbaccess::ODsnTypeCollection* _pCollection,const ::rtl::OUString& _sOldURLPrefix,const ::rtl::OUString& _sNewURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDatasource);
+ };
class IItemSetHelper;
//========================================================================
//= ODbDataSourceAdministrationHelper
@@ -142,7 +152,7 @@ namespace dbaui
/** extracts the connection type from the given set<p/>
The connection type is determined by the value of the DSN item, analyzed by the TypeCollection item.
*/
- static ::dbaccess::DATASOURCE_TYPE getDatasourceType( const SfxItemSet& _rSet );
+ static ::rtl::OUString getDatasourceType( const SfxItemSet& _rSet );
/** returns the connection URL
@return
diff --git a/dbaccess/source/ui/dlg/DriverSettings.cxx b/dbaccess/source/ui/dlg/DriverSettings.cxx
index 2deb86d91..8c5b6f8d5 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.cxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.cxx
@@ -34,14 +34,15 @@
#include "DriverSettings.hxx"
#include "dsitems.hxx"
#include "datasourceui.hxx"
-
+#include <connectivity/DriversConfig.hxx>
using namespace dbaui;
-void ODriversSettings::getSupportedIndirectSettings( ::dbaccess::DATASOURCE_TYPE _eType, ::std::vector< sal_Int32>& _out_rDetailsIds )
+void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory, ::std::vector< sal_Int32>& _out_rDetailsIds )
{
// for a number of settings, we do not need to use hard-coded here, but can ask a
// central DataSourceUI instance.
- DataSourceUI aDSUI( _eType );
+ DataSourceMetaData aMeta(_sURLPrefix);
+ DataSourceUI aDSUI( aMeta );
const USHORT nGenericKnownSettings[] =
{
DSID_SQL92CHECK,
@@ -67,71 +68,35 @@ void ODriversSettings::getSupportedIndirectSettings( ::dbaccess::DATASOURCE_TYPE
_out_rDetailsIds.push_back( *pGenericKnowSetting );
// the rest is hard-coded. On the long run, all of this should be done via DataSourceUI::hasSetting
- switch ( _eType )
+ ::connectivity::DriversConfig aDriverConfig(_xFactory);
+ const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix);
+ typedef ::std::pair<USHORT, ::rtl::OUString> TProperties;
+ TProperties aProps[] = { TProperties(DSID_SHOWDELETEDROWS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowDeleted")))
+ ,TProperties(DSID_CHARSET,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet")))
+ ,TProperties(DSID_FIELDDELIMITER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldDelimiter")))
+ ,TProperties(DSID_TEXTDELIMITER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StringDelimiter")))
+ ,TProperties(DSID_DECIMALDELIMITER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalDelimiter")))
+ ,TProperties(DSID_THOUSANDSDELIMITER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ThousandDelimiter")))
+ ,TProperties(DSID_TEXTFILEEXTENSION,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extension")))
+ ,TProperties(DSID_TEXTFILEHEADER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderLine")))
+ ,TProperties(DSID_ADDITIONALOPTIONS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SystemDriverSettings")))
+ ,TProperties(DSID_CONN_SHUTSERVICE,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase")))
+ ,TProperties(DSID_CONN_DATAINC,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSizeIncrement")))
+ ,TProperties(DSID_CONN_CACHESIZE,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSize")))
+ ,TProperties(DSID_CONN_CTRLUSER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlUser")))
+ ,TProperties(DSID_CONN_CTRLPWD,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword")))
+ ,TProperties(DSID_USECATALOG,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCatalog")))
+ ,TProperties(DSID_CONN_SOCKET,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LocalSocket")))
+ ,TProperties(DSID_JDBCDRIVERCLASS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass")))
+ ,TProperties(DSID_CONN_LDAP_BASEDN,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseDN")))
+ ,TProperties(DSID_CONN_LDAP_ROWCOUNT,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRowCount")))
+ ,TProperties(DSID_CONN_LDAP_USESSL,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseSSL")))
+ ,TProperties(DSID_IGNORECURRENCY,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreCurrency")))
+ ,TProperties(0,::rtl::OUString())
+ };
+ for ( TProperties* pProps = aProps; pProps->first; ++pProps )
{
- case ::dbaccess::DST_DBASE:
- _out_rDetailsIds.push_back(DSID_SHOWDELETEDROWS);
- _out_rDetailsIds.push_back(DSID_CHARSET);
- break;
-
- case ::dbaccess::DST_FLAT:
- _out_rDetailsIds.push_back(DSID_FIELDDELIMITER);
- _out_rDetailsIds.push_back(DSID_TEXTDELIMITER);
- _out_rDetailsIds.push_back(DSID_DECIMALDELIMITER);
- _out_rDetailsIds.push_back(DSID_THOUSANDSDELIMITER);
- _out_rDetailsIds.push_back(DSID_TEXTFILEEXTENSION);
- _out_rDetailsIds.push_back(DSID_TEXTFILEHEADER);
- _out_rDetailsIds.push_back(DSID_CHARSET);
- break;
-
- case ::dbaccess::DST_ADABAS:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- _out_rDetailsIds.push_back(DSID_CONN_SHUTSERVICE);
- _out_rDetailsIds.push_back(DSID_CONN_DATAINC);
- _out_rDetailsIds.push_back(DSID_CONN_CACHESIZE);
- _out_rDetailsIds.push_back(DSID_CONN_CTRLUSER);
- _out_rDetailsIds.push_back(DSID_CONN_CTRLPWD);
- break;
-
- case ::dbaccess::DST_ADO:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- break;
-
- case ::dbaccess::DST_ODBC:
- _out_rDetailsIds.push_back(DSID_ADDITIONALOPTIONS);
- _out_rDetailsIds.push_back(DSID_CHARSET);
- _out_rDetailsIds.push_back(DSID_USECATALOG);
- break;
-
- case ::dbaccess::DST_MYSQL_NATIVE:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- _out_rDetailsIds.push_back(DSID_CONN_SOCKET);
- break;
- case ::dbaccess::DST_MYSQL_JDBC:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- _out_rDetailsIds.push_back(DSID_JDBCDRIVERCLASS);
- break;
-
- case ::dbaccess::DST_MYSQL_ODBC:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- break;
-
- case ::dbaccess::DST_LDAP:
- _out_rDetailsIds.push_back(DSID_CONN_LDAP_BASEDN);
- _out_rDetailsIds.push_back(DSID_CONN_LDAP_ROWCOUNT);
- _out_rDetailsIds.push_back(DSID_CONN_LDAP_USESSL);
- break;
-
- case ::dbaccess::DST_JDBC:
- _out_rDetailsIds.push_back(DSID_JDBCDRIVERCLASS);
- break;
-
- case ::dbaccess::DST_ORACLE_JDBC:
- _out_rDetailsIds.push_back(DSID_JDBCDRIVERCLASS);
- _out_rDetailsIds.push_back(DSID_IGNORECURRENCY);
- break;
-
- default:
- break;
+ if ( aProperties.has(pProps->second) )
+ _out_rDetailsIds.push_back(pProps->first);
}
}
diff --git a/dbaccess/source/ui/dlg/DriverSettings.hxx b/dbaccess/source/ui/dlg/DriverSettings.hxx
index b4147368f..5a275ac54 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.hxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.hxx
@@ -53,7 +53,7 @@ namespace dbaui
@param _out_rDetailsIds
Will be filled.
*/
- static void getSupportedIndirectSettings( ::dbaccess::DATASOURCE_TYPE _eType,::std::vector< sal_Int32>& _out_rDetailsIds );
+ static void getSupportedIndirectSettings( const ::rtl::OUString& _sURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory,::std::vector< sal_Int32>& _out_rDetailsIds );
/** Creates the detail page for Dbase
*/
diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.cxx b/dbaccess/source/ui/dlg/UserAdminDlg.cxx
index 20ff12362..642b431bc 100644
--- a/dbaccess/source/ui/dlg/UserAdminDlg.cxx
+++ b/dbaccess/source/ui/dlg/UserAdminDlg.cxx
@@ -180,7 +180,7 @@ DBG_NAME(OUserAdminDlg)
return m_pImpl->getDriver();
}
// -----------------------------------------------------------------------------
- ::dbaccess::DATASOURCE_TYPE OUserAdminDlg::getDatasourceType(const SfxItemSet& _rSet) const
+ ::rtl::OUString OUserAdminDlg::getDatasourceType(const SfxItemSet& _rSet) const
{
return m_pImpl->getDatasourceType(_rSet);
}
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index 650d54d9d..c05de9fa5 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -183,7 +183,7 @@ namespace dbaui
return 0L;
}
// -----------------------------------------------------------------------
- sal_Bool OGenericAdministrationPage::getSelectedDataSource(::dbaccess::DATASOURCE_TYPE _eType,::rtl::OUString& _sReturn,::rtl::OUString& _sCurr)
+ sal_Bool OGenericAdministrationPage::getSelectedDataSource(::rtl::OUString& _sReturn,::rtl::OUString& _sCurr)
{
// collect all ODBC data source names
StringBag aOdbcDatasources;
@@ -202,7 +202,7 @@ namespace dbaui
{
aEnumeration.getDatasourceNames(aOdbcDatasources);
// excute the select dialog
- ODatasourceSelectDialog aSelector(GetParent(), aOdbcDatasources, _eType);
+ ODatasourceSelectDialog aSelector(GetParent(), aOdbcDatasources, false);
if (_sCurr.getLength())
aSelector.Select(_sCurr);
if ( RET_OK == aSelector.Execute() )
diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx
index 5b911a1e8..78bdce259 100644
--- a/dbaccess/source/ui/dlg/adminpages.hxx
+++ b/dbaccess/source/ui/dlg/adminpages.hxx
@@ -166,7 +166,7 @@ namespace dbaui
@return
<FALSE/> if an error occured, otherwise <TRUE/>
*/
- sal_Bool getSelectedDataSource(::dbaccess::DATASOURCE_TYPE _eType,::rtl::OUString& _sReturn,::rtl::OUString& _sCurr);
+ sal_Bool getSelectedDataSource(::rtl::OUString& _sReturn,::rtl::OUString& _sCurr);
// svt::IWizardPage
virtual void initializePage();
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 6f012940d..825e5f66b 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -417,7 +417,7 @@ namespace dbaui
delete pExampleSet;
pExampleSet = new SfxItemSet(*GetInputSetImpl());
- ::dbaccess::DATASOURCE_TYPE eType = m_pImpl->getDatasourceType(*_pItems);
+ const ::rtl::OUString eType = m_pImpl->getDatasourceType(*_pItems);
DataSourceMetaData aMeta( eType );
const AdvancedSettingsSupport& rAdvancedSupport( aMeta.getAdvancedSettingsSupport() );
@@ -443,9 +443,9 @@ namespace dbaui
}
// -----------------------------------------------------------------------
- bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( ::dbaccess::DATASOURCE_TYPE _eType )
+ bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( const ::rtl::OUString& _sURL )
{
- DataSourceMetaData aMeta( _eType );
+ DataSourceMetaData aMeta( _sURL );
const AdvancedSettingsSupport& rSupport( aMeta.getAdvancedSettingsSupport() );
if ( rSupport.bGeneratedValues || rSupport.supportsAnySpecialSetting() )
return true;
@@ -510,7 +510,7 @@ namespace dbaui
}
// -----------------------------------------------------------------------------
- ::dbaccess::DATASOURCE_TYPE AdvancedSettingsDialog::getDatasourceType(const SfxItemSet& _rSet) const
+ ::rtl::OUString AdvancedSettingsDialog::getDatasourceType(const SfxItemSet& _rSet) const
{
return m_pImpl->getDatasourceType(_rSet);
}
diff --git a/dbaccess/source/ui/dlg/datasourceui.cxx b/dbaccess/source/ui/dlg/datasourceui.cxx
index fd763c13a..0225f845b 100644
--- a/dbaccess/source/ui/dlg/datasourceui.cxx
+++ b/dbaccess/source/ui/dlg/datasourceui.cxx
@@ -52,12 +52,6 @@ namespace dbaui
//= DataSourceUI
//====================================================================
//--------------------------------------------------------------------
- DataSourceUI::DataSourceUI( ::dbaccess::DATASOURCE_TYPE _eType )
- :m_aDSMeta( DataSourceMetaData( _eType ) )
- {
- }
-
- //--------------------------------------------------------------------
DataSourceUI::DataSourceUI( const DataSourceMetaData& _rDSMeta )
:m_aDSMeta( _rDSMeta )
{
@@ -65,7 +59,7 @@ namespace dbaui
//--------------------------------------------------------------------
DataSourceUI::~DataSourceUI()
- {
+ {
}
//--------------------------------------------------------------------
diff --git a/dbaccess/source/ui/dlg/datasourceui.hxx b/dbaccess/source/ui/dlg/datasourceui.hxx
index cb88f3d90..b18e3e725 100644
--- a/dbaccess/source/ui/dlg/datasourceui.hxx
+++ b/dbaccess/source/ui/dlg/datasourceui.hxx
@@ -52,7 +52,6 @@ namespace dbaui
class DataSourceUI
{
public:
- DataSourceUI( ::dbaccess::DATASOURCE_TYPE _eType );
DataSourceUI( const DataSourceMetaData& _rDSMeta );
~DataSourceUI();
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 6f1807eff..6dd20a91a 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -181,7 +181,9 @@ void ODbAdminDialog::impl_selectDataSource(const ::com::sun::star::uno::Any& _aD
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
impl_resetPages( xDatasource );
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(*getOutputSet());
+ DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
+ ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
+ ::dbaccess::DATASOURCE_TYPE eType = pCollection->determineType(getDatasourceType(*getOutputSet()));
// and insert the new ones
switch ( eType )
@@ -282,8 +284,10 @@ void ODbAdminDialog::impl_resetPages(const Reference< XPropertySet >& _rxDatasou
pExampleSet = new SfxItemSet(*GetInputSetImpl());
// special case: MySQL Native does not have the generic PAGE_CONNECTION page
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType( *pExampleSet );
- if ( eType == ::dbaccess::DST_MYSQL_NATIVE )
+
+ DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
+ ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
+ if ( pCollection->determineType(getDatasourceType( *pExampleSet )) == ::dbaccess::DST_MYSQL_NATIVE )
{
LocalResourceAccess aDummy(DLG_DATABASE_ADMINISTRATION, RSC_TABDIALOG);
AddTabPage( PAGE_MYSQL_NATIVE, String( ModuleRes( STR_PAGETITLE_CONNECTION ) ), ODriversSettings::CreateMySQLNATIVE, NULL );
@@ -368,7 +372,7 @@ Reference< XDriver > ODbAdminDialog::getDriver()
return m_pImpl->getDriver();
}
// -----------------------------------------------------------------------------
-::dbaccess::DATASOURCE_TYPE ODbAdminDialog::getDatasourceType(const SfxItemSet& _rSet) const
+::rtl::OUString ODbAdminDialog::getDatasourceType(const SfxItemSet& _rSet) const
{
return m_pImpl->getDatasourceType(_rSet);
}
@@ -391,7 +395,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
SfxPoolItem** pCounter = _rppDefaults; // want to modify this without affecting the out param _rppDefaults
*pCounter++ = new SfxStringItem(DSID_NAME, String());
*pCounter++ = new SfxStringItem(DSID_ORIGINALNAME, String());
- *pCounter++ = new SfxStringItem(DSID_CONNECTURL, _pTypeCollection ? _pTypeCollection->getDatasourcePrefix( ::dbaccess::DST_ADABAS ) : String());
+ *pCounter++ = new SfxStringItem(DSID_CONNECTURL, String());
*pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< ::rtl::OUString >(&sFilterAll, 1));
*pCounter++ = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection);
*pCounter++ = new SfxBoolItem(DSID_INVALID_SELECTION, sal_False);
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index f00e483d9..faa752820 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -43,6 +43,7 @@
#ifndef _DBAUI_DATASOURCEITEMS_HXX_
#include "dsitems.hxx"
#endif
+#include "dsnItem.hxx"
#ifndef _SFXSTRITEM_HXX
#include <svtools/stritem.hxx>
#endif
@@ -153,6 +154,10 @@ ODbTypeWizDialog::ODbTypeWizDialog(Window* _pParent
m_pFinish->SetHelpId(HID_DBWIZ_FINISH);
m_pHelp->SetUniqueId(UID_DBWIZ_HELP);
// no local resources needed anymore
+
+ DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _pItems->GetItem(DSID_TYPECOLLECTION));
+ m_pCollection = pCollectionItem->getCollection();
+
FreeResource();
ActivatePage();
}
@@ -167,24 +172,9 @@ ODbTypeWizDialog::~ODbTypeWizDialog()
IMPL_LINK(ODbTypeWizDialog, OnTypeSelected, OGeneralPage*, _pTabPage)
{
m_eType = _pTabPage->GetSelectedType();
- switch(m_eType)
- {
- case ::dbaccess::DST_MOZILLA:
- case ::dbaccess::DST_OUTLOOK:
- case ::dbaccess::DST_OUTLOOKEXP:
- case ::dbaccess::DST_EVOLUTION:
- case ::dbaccess::DST_EVOLUTION_GROUPWISE:
- case ::dbaccess::DST_EVOLUTION_LDAP:
- case ::dbaccess::DST_KAB:
- case ::dbaccess::DST_MACAB:
- enableButtons(WZB_NEXT,sal_False);
- enableButtons(WZB_FINISH,sal_True);
- break;
- default:
- enableButtons(WZB_NEXT,sal_True);
- enableButtons(WZB_FINISH,sal_False);
- break;
- }
+ const bool bURLRequired = m_pCollection->isConnectionUrlRequired(m_eType);
+ enableButtons(WZB_NEXT,bURLRequired);
+ enableButtons(WZB_FINISH,!bURLRequired);
return 1L;
}
//-------------------------------------------------------------------------
@@ -194,7 +184,7 @@ WizardTypes::WizardState ODbTypeWizDialog::determineNextState( WizardState _nCur
switch(_nCurrentState)
{
case START_PAGE:
- switch(m_eType)
+ switch(m_pCollection->determineType(m_eType))
{
case ::dbaccess::DST_MOZILLA:
case ::dbaccess::DST_OUTLOOK:
@@ -215,7 +205,7 @@ WizardTypes::WizardState ODbTypeWizDialog::determineNextState( WizardState _nCur
}
break;
case CONNECTION_PAGE:
- switch(m_eType)
+ switch(m_pCollection->determineType(m_eType))
{
case ::dbaccess::DST_MOZILLA:
case ::dbaccess::DST_THUNDERBIRD:
@@ -295,7 +285,7 @@ Reference< XDriver > ODbTypeWizDialog::getDriver()
return m_pImpl->getDriver();
}
// -----------------------------------------------------------------------------
-::dbaccess::DATASOURCE_TYPE ODbTypeWizDialog::getDatasourceType(const SfxItemSet& _rSet) const
+::rtl::OUString ODbTypeWizDialog::getDatasourceType(const SfxItemSet& _rSet) const
{
return m_pImpl->getDatasourceType(_rSet);
}
@@ -409,6 +399,12 @@ sal_Bool ODbTypeWizDialog::saveDatasource()
SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(getCurrentState()));
if ( pPage )
pPage->FillItemSet(*m_pOutSet);
+
+ DataSourceInfoConverter aConverter(getORB());
+ ::rtl::OUString sOldURL;
+ if ( m_pImpl->getCurrentDataSource().is() )
+ m_pImpl->getCurrentDataSource()->getPropertyValue(PROPERTY_URL) >>= sOldURL;
+ aConverter.convert(m_pCollection,sOldURL,m_eType,m_pImpl->getCurrentDataSource());
return sal_True;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 1f945d43f..8ee9f2c67 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -161,32 +161,19 @@
#ifndef _COM_SUN_STAR_DOCUMENT_MACROEXECMODE_HPP_
#include <com/sun/star/document/MacroExecMode.hpp>
#endif
+#include <com/sun/star/ucb/IOErrorCode.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+
/** === end UNO includes === **/
-#ifndef SVTOOLS_FILENOTATION_HXX_
#include <svtools/filenotation.hxx>
-#endif
-#ifndef _COMPHELPER_INTERACTION_HXX_
#include <comphelper/interaction.hxx>
-#endif
-#ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX
#include <comphelper/namedvaluecollection.hxx>
-#endif
-#ifndef _COMPHELPER_SEQUENCEASHASHMAP_HXX_
#include <comphelper/sequenceashashmap.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
#include <tools/diagnose_ex.h>
-#endif
-
-#ifndef _COM_SUN_STAR_UCB_IOERRORCODE_HPP_
-#include <com/sun/star/ucb/IOErrorCode.hpp>
-#endif
-#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#endif
-#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
-
+#include <connectivity/DriversConfig.hxx>
#include <memory>
@@ -197,6 +184,7 @@ namespace dbaui
//.........................................................................
using namespace dbtools;
using namespace svt;
+using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
@@ -217,53 +205,34 @@ using namespace ::cppu;
#define CONNECTION_PAGE 1
-#define PAGE_DBSETUPWIZARD_INTRO 0
-#define PAGE_DBSETUPWIZARD_DBASE 1
-#define PAGE_DBSETUPWIZARD_TEXT 2
-#define PAGE_DBSETUPWIZARD_MSACCESS 3
-#define PAGE_DBSETUPWIZARD_LDAP 4
-#define PAGE_DBSETUPWIZARD_ADABAS 5
-#define PAGE_DBSETUPWIZARD_MYSQL_INTRO 6
-#define PAGE_DBSETUPWIZARD_MYSQL_JDBC 7
-#define PAGE_DBSETUPWIZARD_MYSQL_ODBC 8
-#define PAGE_DBSETUPWIZARD_ORACLE 9
-#define PAGE_DBSETUPWIZARD_JDBC 10
-#define PAGE_DBSETUPWIZARD_ADO 11
-#define PAGE_DBSETUPWIZARD_ODBC 12
-#define PAGE_DBSETUPWIZARD_SPREADSHEET 13
-#define PAGE_DBSETUPWIZARD_AUTHENTIFICATION 14
-#define PAGE_DBSETUPWIZARD_MOZILLA 15
-#define PAGE_DBSETUPWIZARD_FINAL 16
-#define PAGE_DBSETUPWIZARD_USERDEFINED 17
-#define PAGE_DBSETUPWIZARD_MYSQL_NATIVE 18
-
-
-#define DBASE_PATH 1
-#define TEXT_PATH 2
-#define MSACCESS_PATH 3
-#define LDAP_PATH 4
-#define ADABAS_PATH 5
-#define ADO_PATH 6
-#define JDBC_PATH 7
-#define ORACLE_PATH 8
-#define MYSQL_JDBC_PATH 9
-#define MYSQL_ODBC_PATH 10
-#define ODBC_PATH 11
-#define SPREADSHEET_PATH 12
-#define OUTLOOKEXP_PATH 13
-#define OUTLOOK_PATH 14
-#define MOZILLA_PATH 15
-#define EVOLUTION_PATH 16
-#define EVOLUTION_PATH_GROUPWISE 17
-#define EVOLUTION_PATH_LDAP 18
-#define KAB_PATH 19
-#define MACAB_PATH 20
-#define THUNDERBIRD_PATH 21
-#define CREATENEW_PATH 22
-#define USERDEFINED_PATH 23
-#define OPEN_DOC_PATH 24
-#define MSACCESS2007_PATH 25
-#define MYSQL_NATIVE_PATH 26
+
+
+//#define DBASE_PATH 1
+//#define TEXT_PATH 2
+//#define MSACCESS_PATH 3
+//#define LDAP_PATH 4
+//#define ADABAS_PATH 5
+//#define ADO_PATH 6
+//#define JDBC_PATH 7
+//#define ORACLE_PATH 8
+//#define MYSQL_JDBC_PATH 9
+//#define MYSQL_ODBC_PATH 10
+//#define ODBC_PATH 11
+//#define SPREADSHEET_PATH 12
+//#define OUTLOOKEXP_PATH 13
+//#define OUTLOOK_PATH 14
+//#define MOZILLA_PATH 15
+//#define EVOLUTION_PATH 16
+//#define EVOLUTION_PATH_GROUPWISE 17
+//#define EVOLUTION_PATH_LDAP 18
+//#define KAB_PATH 19
+//#define MACAB_PATH 20
+//#define THUNDERBIRD_PATH 21
+//#define CREATENEW_PATH 22
+//#define USERDEFINED_PATH 23
+//#define OPEN_DOC_PATH 24
+//#define MSACCESS2007_PATH 25
+//#define MYSQL_NATIVE_PATH 26
OFinalDBPageSetup* pFinalPage;
@@ -283,8 +252,6 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent
WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP )
, m_pOutSet(NULL)
- , m_eType( ::dbaccess::DST_UNKNOWN )
- , m_eOldType( ::dbaccess::DST_UNKNOWN )
, m_bResetting(sal_False)
, m_bApplied(sal_False)
, m_bUIEnabled( sal_True )
@@ -326,7 +293,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent
m_pOutSet = new SfxItemSet( *_pItems->GetPool(), _pItems->GetRanges() );
m_pImpl->translateProperties(xDatasource, *m_pOutSet);
- m_eType = m_pImpl->getDatasourceType(*m_pOutSet);
+// eType = m_pImpl->getDatasourceType(*m_pOutSet);
SetPageSizePixel(LogicToPixel(::Size(WIZARD_PAGE_X, WIZARD_PAGE_Y), MAP_APPFONT));
ShowButtonFixedLine(sal_True);
@@ -334,32 +301,23 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent
enableButtons(WZB_FINISH, sal_True);
enableAutomaticNextButtonState();
- declareAuthDepPath( ::dbaccess::DST_ADO, ADO_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_ADO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_DBASE, DBASE_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_DBASE, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_FLAT, TEXT_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_TEXT, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declarePath ( SPREADSHEET_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_SPREADSHEET, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_ODBC, ODBC_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_ODBC, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_JDBC, JDBC_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_JDBC, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MYSQL_ODBC, MYSQL_ODBC_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MYSQL_INTRO, PAGE_DBSETUPWIZARD_MYSQL_ODBC, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MYSQL_JDBC, MYSQL_JDBC_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MYSQL_INTRO, PAGE_DBSETUPWIZARD_MYSQL_JDBC, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MYSQL_NATIVE, MYSQL_NATIVE_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MYSQL_INTRO, PAGE_DBSETUPWIZARD_MYSQL_NATIVE, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_ORACLE_JDBC, ORACLE_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_ORACLE, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_ADABAS, ADABAS_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_ADABAS, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_LDAP, LDAP_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_LDAP, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MSACCESS, MSACCESS_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MSACCESS, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MSACCESS_2007, MSACCESS2007_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MSACCESS, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_OUTLOOKEXP, OUTLOOKEXP_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_OUTLOOK, OUTLOOK_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MOZILLA, MOZILLA_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_THUNDERBIRD, THUNDERBIRD_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_EVOLUTION, EVOLUTION_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_EVOLUTION_GROUPWISE,EVOLUTION_PATH_GROUPWISE, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_EVOLUTION_LDAP, EVOLUTION_PATH_LDAP, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_KAB, KAB_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MACAB, MACAB_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1);
- declareAuthDepPath( getDefaultDatabaseType(),CREATENEW_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_USERDEFINE1, USERDEFINED_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_USERDEFINED,PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declarePath ( OPEN_DOC_PATH, PAGE_DBSETUPWIZARD_INTRO, -1 );
+ ::dbaccess::ODsnTypeCollection::TypeIterator aIter = m_pCollection->begin();
+ ::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
+ for(PathId i = 1;aIter != aEnd;++aIter,++i)
+ {
+ const ::rtl::OUString sURLPrefix = aIter.getURLPrefix();
+ svt::RoadmapWizardTypes::WizardPath aPath;
+ aPath.push_back(PAGE_DBSETUPWIZARD_INTRO);
+ m_pCollection->fillPageIds(sURLPrefix,aPath);
+ aPath.push_back(PAGE_DBSETUPWIZARD_AUTHENTIFICATION);
+ aPath.push_back(PAGE_DBSETUPWIZARD_FINAL);
+
+ declareAuthDepPath(sURLPrefix,i,aPath);
+ }
+
+ svt::RoadmapWizardTypes::WizardPath aPath;
+ aPath.push_back(PAGE_DBSETUPWIZARD_INTRO);
+ declarePath( static_cast<PathId>(m_pCollection->size()+1), aPath);
m_pPrevPage->SetHelpId(HID_DBWIZ_PREVIOUS);
m_pNextPage->SetHelpId(HID_DBWIZ_NEXT);
@@ -370,25 +328,20 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent
ActivatePage();
}
-void ODbTypeWizDialogSetup::declareAuthDepPath( ::dbaccess::DATASOURCE_TYPE _eType, PathId _nPathId, WizardState _nFirstState, ... )
+void ODbTypeWizDialogSetup::declareAuthDepPath( const ::rtl::OUString& _sURL, PathId _nPathId, const svt::RoadmapWizardTypes::WizardPath& _rPaths)
{
- bool bHasAuthentication = DataSourceMetaData::getAuthentication( _eType ) != AuthNone;
+ bool bHasAuthentication = DataSourceMetaData::getAuthentication( _sURL ) != AuthNone;
// collect the elements of the path
WizardPath aPath;
- va_list aStateList;
- va_start( aStateList, _nFirstState );
-
- WizardState nState = _nFirstState;
- while ( nState != WZS_INVALID_STATE )
+ svt::RoadmapWizardTypes::WizardPath::const_iterator aIter = _rPaths.begin();
+ svt::RoadmapWizardTypes::WizardPath::const_iterator aEnd = _rPaths.end();
+ for(;aIter != aEnd;++aIter)
{
- if ( bHasAuthentication || ( nState != PAGE_DBSETUPWIZARD_AUTHENTIFICATION ) )
- aPath.push_back( nState );
-
- nState = ::sal::static_int_cast< WizardState >( va_arg( aStateList, int ) );
- }
- va_end( aStateList );
+ if ( bHasAuthentication || ( *aIter != PAGE_DBSETUPWIZARD_AUTHENTIFICATION ) )
+ aPath.push_back( *aIter );
+ } // for(;aIter != aEnd;++aIter)
// call base method
::svt::RoadmapWizard::declarePath( _nPathId, aPath );
@@ -477,6 +430,41 @@ IMPL_LINK(ODbTypeWizDialogSetup, OnTypeSelected, OGeneralPage*, /*_pTabPage*/)
return 1L;
}
+void lcl_removeUnused(const ::comphelper::NamedValueCollection& _aOld,const ::comphelper::NamedValueCollection& _aNew,::comphelper::NamedValueCollection& _rDSInfo)
+{
+ _rDSInfo.merge(_aNew,true);
+ uno::Sequence< beans::NamedValue > aOldValues = _aOld.getNamedValues();
+ const beans::NamedValue* pIter = aOldValues.getConstArray();
+ const beans::NamedValue* pEnd = pIter + aOldValues.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ if ( !_aNew.has(pIter->Name) )
+ {
+ _rDSInfo.remove(pIter->Name);
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void DataSourceInfoConverter::convert(const ::dbaccess::ODsnTypeCollection* _pCollection,const ::rtl::OUString& _sOldURLPrefix,const ::rtl::OUString& _sNewURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDatasource)
+{
+ if ( _pCollection->getPrefix(_sOldURLPrefix) == _pCollection->getPrefix(_sNewURLPrefix) )
+ return ;
+ uno::Sequence< beans::PropertyValue> aInfo;
+ _xDatasource->getPropertyValue(PROPERTY_INFO) >>= aInfo;
+ ::comphelper::NamedValueCollection aDS(aInfo);
+
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aOldMetaData = aDriverConfig.getMetaData(_sOldURLPrefix);
+ const ::comphelper::NamedValueCollection& aOldProperties = aDriverConfig.getProperties(_sOldURLPrefix);
+
+ const ::comphelper::NamedValueCollection& aNewMetaData = aDriverConfig.getMetaData(_sNewURLPrefix);
+ const ::comphelper::NamedValueCollection& aNewProperties = aDriverConfig.getProperties(_sNewURLPrefix);
+
+ lcl_removeUnused(aOldMetaData,aNewMetaData,aDS);
+ lcl_removeUnused(aOldProperties,aNewProperties,aDS);
+ aDS >>= aInfo;
+ _xDatasource->setPropertyValue(PROPERTY_INFO,uno::makeAny(aInfo));
+}
//-------------------------------------------------------------------------
void ODbTypeWizDialogSetup::activateDatabasePath()
{
@@ -484,74 +472,28 @@ void ODbTypeWizDialogSetup::activateDatabasePath()
{
case OGeneralPage::eCreateNew:
{
- activatePath( CREATENEW_PATH, sal_True);
+ activatePath( static_cast<PathId>(m_pCollection->getIndexOf(m_pCollection->getEmbeddedDatabase()) + 1), sal_True);
enableState(PAGE_DBSETUPWIZARD_FINAL, sal_True );
enableButtons( WZB_FINISH, sal_True);
}
break;
case OGeneralPage::eConnectExternal:
{
- m_eType = VerifyDataSourceType(m_pGeneralPage->GetSelectedType());
- if (m_eType == ::dbaccess::DST_UNKNOWN)
- m_eType = m_eOldType;
-
- struct _map_type_to_path
- {
- ::dbaccess::DATASOURCE_TYPE eType;
- RoadmapWizardTypes::PathId nPathId;
- } aKnownTypesAndPaths[] = {
- { ::dbaccess::DST_DBASE, DBASE_PATH },
- { ::dbaccess::DST_ADO, ADO_PATH },
- { ::dbaccess::DST_FLAT, TEXT_PATH },
- { ::dbaccess::DST_CALC, SPREADSHEET_PATH },
- { ::dbaccess::DST_ODBC, ODBC_PATH },
- { ::dbaccess::DST_JDBC, JDBC_PATH },
- { ::dbaccess::DST_MYSQL_JDBC, MYSQL_JDBC_PATH },
- { ::dbaccess::DST_MYSQL_NATIVE, MYSQL_NATIVE_PATH },
- { ::dbaccess::DST_MYSQL_ODBC, MYSQL_ODBC_PATH },
- { ::dbaccess::DST_ORACLE_JDBC, ORACLE_PATH },
- { ::dbaccess::DST_ADABAS, ADABAS_PATH },
- { ::dbaccess::DST_LDAP, LDAP_PATH },
- { ::dbaccess::DST_MSACCESS, MSACCESS_PATH },
- { ::dbaccess::DST_MSACCESS_2007,MSACCESS2007_PATH },
- { ::dbaccess::DST_OUTLOOKEXP, OUTLOOKEXP_PATH },
- { ::dbaccess::DST_OUTLOOK, OUTLOOK_PATH },
- { ::dbaccess::DST_MOZILLA, MOZILLA_PATH },
- { ::dbaccess::DST_THUNDERBIRD, THUNDERBIRD_PATH },
- { ::dbaccess::DST_EVOLUTION, EVOLUTION_PATH },
- { ::dbaccess::DST_EVOLUTION_GROUPWISE, EVOLUTION_PATH_GROUPWISE },
- { ::dbaccess::DST_EVOLUTION_LDAP, EVOLUTION_PATH_LDAP },
- { ::dbaccess::DST_KAB, KAB_PATH },
- { ::dbaccess::DST_MACAB, MACAB_PATH },
- { ::dbaccess::DST_USERDEFINE1, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE2, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE3, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE4, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE5, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE6, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE7, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE8, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE9, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE10, USERDEFINED_PATH }
- };
-
- size_t i = 0;
- for ( ; i < sizeof( aKnownTypesAndPaths ) / sizeof( aKnownTypesAndPaths[0] ); ++i )
- {
- if ( aKnownTypesAndPaths[i].eType == m_eType )
- {
- activatePath( aKnownTypesAndPaths[i].nPathId, sal_True);
- break;
- }
- }
- DBG_ASSERT( i < sizeof( aKnownTypesAndPaths ) / sizeof( aKnownTypesAndPaths[0] ),
- "ODbTypeWizDialogSetup::activateDatabasePath: unknown database type!" );
+ ::rtl::OUString sOld = m_sURL;
+ DataSourceInfoConverter aConverter(getORB());
+ m_sURL = m_pGeneralPage->GetSelectedType();
+ aConverter.convert(m_pCollection,sOld,m_sURL,m_pImpl->getCurrentDataSource());
+ ::dbaccess::DATASOURCE_TYPE eType = VerifyDataSourceType(m_pCollection->determineType(m_sURL));
+ if (eType == ::dbaccess::DST_UNKNOWN)
+ eType = m_pCollection->determineType(m_sOldURL);
+
+ activatePath( static_cast<PathId>(m_pCollection->getIndexOf(m_sURL) + 1), sal_True);
updateTypeDependentStates();
}
break;
case OGeneralPage::eOpenExisting:
{
- activatePath( OPEN_DOC_PATH, sal_True );
+ activatePath( static_cast<PathId>(m_pCollection->size() + 1), sal_True );
enableButtons( WZB_FINISH, m_pGeneralPage->GetSelectedDocument().sURL.Len() != 0 );
}
break;
@@ -574,12 +516,9 @@ void ODbTypeWizDialogSetup::updateTypeDependentStates()
{
bDoEnable = sal_True;
}
- else
+ else if ( m_sURL == m_sOldURL )
{
- if (m_eType == m_eOldType)
- {
- bDoEnable = m_bIsConnectable; //(sConnectURL.Len() != 0);
- }
+ bDoEnable = m_bIsConnectable;
}
enableState(PAGE_DBSETUPWIZARD_AUTHENTIFICATION, bDoEnable);
enableState(PAGE_DBSETUPWIZARD_FINAL, bDoEnable );
@@ -590,21 +529,7 @@ void ODbTypeWizDialogSetup::updateTypeDependentStates()
//-------------------------------------------------------------------------
sal_Bool ODbTypeWizDialogSetup::IsConnectionUrlRequired()
{
- switch ( m_eType )
- {
- case ::dbaccess::DST_KAB:
- case ::dbaccess::DST_MACAB:
- case ::dbaccess::DST_EVOLUTION:
- case ::dbaccess::DST_EVOLUTION_GROUPWISE:
- case ::dbaccess::DST_EVOLUTION_LDAP:
- case ::dbaccess::DST_OUTLOOK:
- case ::dbaccess::DST_OUTLOOKEXP:
- case ::dbaccess::DST_MOZILLA:
- case ::dbaccess::DST_THUNDERBIRD:
- return sal_False;
- default:
- return sal_True;
- }
+ return m_pCollection->isConnectionUrlRequired(m_sURL);
}
//-------------------------------------------------------------------------
@@ -675,10 +600,25 @@ Reference< XDriver > ODbTypeWizDialogSetup::getDriver()
// -----------------------------------------------------------------------------
-::dbaccess::DATASOURCE_TYPE ODbTypeWizDialogSetup::getDatasourceType(const SfxItemSet& _rSet) const
+::rtl::OUString ODbTypeWizDialogSetup::getDatasourceType(const SfxItemSet& _rSet) const
{
- ::dbaccess::DATASOURCE_TYPE LocDatabaseType = m_pImpl->getDatasourceType(_rSet);
- return VerifyDataSourceType(LocDatabaseType);
+ ::rtl::OUString sRet = m_pImpl->getDatasourceType(_rSet);
+ if (m_pMySQLIntroPage != NULL && m_pMySQLIntroPage->IsVisible() )
+ {
+ switch( m_pMySQLIntroPage->getMySQLMode() )
+ {
+ case OMySQLIntroPageSetup::VIA_JDBC:
+ sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:jdbc:"));
+ break;
+ case OMySQLIntroPageSetup::VIA_NATIVE:
+ sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:"));
+ break;
+ case OMySQLIntroPageSetup::VIA_ODBC:
+ sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:odbc:"));
+ break;
+ }
+ }
+ return sRet;
}
// -----------------------------------------------------------------------------
@@ -725,16 +665,16 @@ TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState)
break;
case PAGE_DBSETUPWIZARD_MYSQL_ODBC:
- m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix( ::dbaccess::DST_MYSQL_ODBC)));
+ m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:odbc:")))));
pPage = OConnectionTabPageSetup::CreateODBCTabPage( this, *m_pOutSet);
break;
case PAGE_DBSETUPWIZARD_MYSQL_JDBC:
- m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix( ::dbaccess::DST_MYSQL_JDBC)));
+ m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:jdbc:")))));
pPage = OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( this, *m_pOutSet);
break;
case PAGE_DBSETUPWIZARD_MYSQL_NATIVE:
- m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix( ::dbaccess::DST_MYSQL_NATIVE)));
+ m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:")))));
pPage = OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLNATIVETabPage( this, *m_pOutSet);
break;
@@ -788,7 +728,7 @@ TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState)
pPage->SetAdminDialog(this, this);
defaultButton( _nState == PAGE_DBSETUPWIZARD_FINAL ? WZB_FINISH : WZB_NEXT );
- enableButtons( WZB_FINISH, _nState == START_PAGE ? sal_False : sal_True);
+ enableButtons( WZB_FINISH, _nState == PAGE_DBSETUPWIZARD_FINAL );
enableButtons( WZB_NEXT, _nState == PAGE_DBSETUPWIZARD_FINAL ? sal_False : sal_True);
pPage->Show();
}
@@ -811,23 +751,22 @@ IMPL_LINK(ODbTypeWizDialogSetup, ImplModifiedHdl, OGenericAdministrationPage*, _
// -----------------------------------------------------------------------------
-IMPL_LINK(ODbTypeWizDialogSetup, ImplClickHdl, OMySQLIntroPageSetup*, /*_pMySQLIntroPageSetup*/)
+IMPL_LINK(ODbTypeWizDialogSetup, ImplClickHdl, OMySQLIntroPageSetup*, _pMySQLIntroPageSetup)
{
- const ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(*m_pOutSet);
- switch( eType )
+ ::rtl::OUString sURLPrefix;
+ switch( _pMySQLIntroPageSetup->getMySQLMode() )
{
- case ::dbaccess::DST_MYSQL_ODBC:
- activatePath( MYSQL_ODBC_PATH, sal_True);
+ case OMySQLIntroPageSetup::VIA_ODBC:
+ sURLPrefix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:odbc:"));
break;
- case ::dbaccess::DST_MYSQL_JDBC:
- activatePath( MYSQL_JDBC_PATH, sal_True);
+ case OMySQLIntroPageSetup::VIA_JDBC:
+ sURLPrefix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:jdbc:"));
break;
- case ::dbaccess::DST_MYSQL_NATIVE:
- activatePath( MYSQL_NATIVE_PATH, sal_True);
+ case OMySQLIntroPageSetup::VIA_NATIVE:
+ sURLPrefix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:"));
break;
- default:
- ;
- }
+ } // switch( _pMySQLIntroPageSetup->getMySQLMode() )
+ activatePath( static_cast<PathId>(m_pCollection->getIndexOf(sURLPrefix) + 1), sal_True);
return sal_True;
}
@@ -856,17 +795,17 @@ IMPL_LINK(ODbTypeWizDialogSetup, OnSingleDocumentChosen, OGeneralPage*, /*_pGene
// -----------------------------------------------------------------------------
void ODbTypeWizDialogSetup::enterState(WizardState _nState)
{
- m_eType = m_pImpl->getDatasourceType(*m_pOutSet);
+ m_sURL = m_pImpl->getDatasourceType(*m_pOutSet);
RoadmapWizard::enterState(_nState);
switch(_nState)
{
case PAGE_DBSETUPWIZARD_INTRO:
- m_eOldType = m_eType;
+ m_sOldURL = m_sURL;
break;
case PAGE_DBSETUPWIZARD_FINAL:
enableButtons( WZB_FINISH, sal_True);
if ( pFinalPage )
- pFinalPage->enableTableWizardCheckBox(m_pCollection->supportsTableCreation(m_eType));
+ pFinalPage->enableTableWizardCheckBox(m_pCollection->supportsTableCreation(m_sURL));
break;
}
}
@@ -886,17 +825,12 @@ sal_Bool ODbTypeWizDialogSetup::leaveState(WizardState _nState)
{
if (_nState == PAGE_DBSETUPWIZARD_MYSQL_INTRO)
return sal_True;
- if ( _nState == PAGE_DBSETUPWIZARD_INTRO )
+ if ( _nState == PAGE_DBSETUPWIZARD_INTRO && m_sURL != m_sOldURL )
{
- OSL_ENSURE(m_eType != ::dbaccess::DST_UNKNOWN && m_eOldType != ::dbaccess::DST_UNKNOWN,"Type unknown");
- if ( m_eType != m_eOldType )
- resetPages(m_pImpl->getCurrentDataSource());
+ resetPages(m_pImpl->getCurrentDataSource());
}
SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(_nState));
- if ( pPage )
- return pPage->DeactivatePage(m_pOutSet) != 0;
- else
- return sal_False;
+ return pPage && pPage->DeactivatePage(m_pOutSet) != 0;
}
// -----------------------------------------------------------------------------
@@ -931,6 +865,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
aArgs.put( "Overwrite", sal_Bool( sal_True ) );
aArgs.put( "InteractionHandler", xHandler );
+ aArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG );
::rtl::OUString sPath = m_pImpl->getDocumentUrl( *m_pOutSet );
xStore->storeAsURL( sPath, aArgs.getPropertyValues() );
@@ -980,39 +915,37 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
}
//-------------------------------------------------------------------------
- ::dbaccess::DATASOURCE_TYPE ODbTypeWizDialogSetup::getDefaultDatabaseType() const
+ ::rtl::OUString ODbTypeWizDialogSetup::getDefaultDatabaseType() const
{
- ::dbaccess::DATASOURCE_TYPE eRet = ::dbaccess::DST_DBASE;
-
- ::rtl::OUString sURL = m_pCollection->getDatasourcePrefix( ::dbaccess::DST_EMBEDDED_HSQLDB );
- Reference< XDriverAccess > xDriverManager( getORB()->createInstance( SERVICE_SDBC_DRIVERMANAGER ), UNO_QUERY );
- if ( xDriverManager.is() && xDriverManager->getDriverByURL( sURL ).is() )
- eRet = ::dbaccess::DST_EMBEDDED_HSQLDB;
+ ::rtl::OUString sEmbeddedURL = m_pCollection->getEmbeddedDatabase();
+ ::connectivity::DriversConfig aDriverConfig(getORB());
+ if ( !aDriverConfig.getDriverFactoryName(sEmbeddedURL).getLength() )
+ sEmbeddedURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:"));
- return eRet;
+ return sEmbeddedURL;
}
//-------------------------------------------------------------------------
void ODbTypeWizDialogSetup::CreateDatabase()
{
::rtl::OUString sUrl;
- ::dbaccess::DATASOURCE_TYPE eType = getDefaultDatabaseType();
- if ( eType == ::dbaccess::DST_EMBEDDED_HSQLDB )
+ ::rtl::OUString eType = getDefaultDatabaseType();
+ if ( m_pCollection->isEmbeddedDatabase(eType) )
{
- sUrl = m_pCollection->getDatasourcePrefix( ::dbaccess::DST_EMBEDDED_HSQLDB );
+ sUrl = eType;
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
OSL_ENSURE(xDatasource.is(),"DataSource is null!");
if ( xDatasource.is() )
- xDatasource->setPropertyValue( PROPERTY_INFO, makeAny( m_pCollection->getDefaultDBSettings( ::dbaccess::DST_EMBEDDED_HSQLDB ) ) );
+ xDatasource->setPropertyValue( PROPERTY_INFO, makeAny( m_pCollection->getDefaultDBSettings( eType ) ) );
m_pImpl->translateProperties(xDatasource,*m_pOutSet);
}
- if ( eType == ::dbaccess::DST_DBASE )
+ else if ( m_pCollection->isFileSystemBased(eType) )
{
Reference< XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" )), UNO_QUERY);
INetURLObject aDBPathURL(m_sWorkPath);
aDBPathURL.Append(m_aDocURL.getBase());
createUniqueFolderName(&aDBPathURL);
- ::rtl::OUString sPrefix = m_pCollection->getDatasourcePrefix( ::dbaccess::DST_DBASE);
+ ::rtl::OUString sPrefix = eType;
sUrl = aDBPathURL.GetMainURL( INetURLObject::NO_DECODE);
xSimpleFileAccess->createFolder(sUrl);
//OFileNotation aFileNotation(sUrl);
diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx
index 500cc3dd6..419723748 100644
--- a/dbaccess/source/ui/dlg/detailpages.cxx
+++ b/dbaccess/source/ui/dlg/detailpages.cxx
@@ -528,7 +528,7 @@ namespace dbaui
//========================================================================
//= OMySQLJDBCDetailsPage
//========================================================================
- OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId, const char* _pDriverName)
+ OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId)
:OCommonBehaviourTabPage(pParent, _nResId, _rCoreAttrs, CBTP_USE_CHARSET ,false)
,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
@@ -543,12 +543,18 @@ namespace dbaui
,m_nPortId(_nPortId)
,m_bUseClass(true)
{
- if ( _pDriverName != NULL )
+ SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
+ SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
+ ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
+ if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
+ {
+ m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
+ }
+ if ( m_sDefaultJdbcDriverName.Len() )
{
m_aEDDriverClass.SetModifyHdl(getControlModifiedLink());
m_aEDDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCDetailsPage, OnEditModified));
m_aTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
- m_sDefaultJdbcDriverName = String::CreateFromAscii(_pDriverName);
}
else
{
@@ -814,7 +820,7 @@ namespace dbaui
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateMySQLJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_MYSQL_JDBC, _rAttrSet,DSID_MYSQL_PORTNUMBER ,"com.mysql.jdbc.Driver") );
+ return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_MYSQL_JDBC, _rAttrSet,DSID_MYSQL_PORTNUMBER ) );
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateMySQLNATIVE( Window* pParent, const SfxItemSet& _rAttrSet )
@@ -825,7 +831,7 @@ namespace dbaui
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateOracleJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_ORACLE_JDBC, _rAttrSet,DSID_ORACLE_PORTNUMBER,"oracle.jdbc.driver.OracleDriver" ) );
+ return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_ORACLE_JDBC, _rAttrSet,DSID_ORACLE_PORTNUMBER) );
}
@@ -1181,7 +1187,7 @@ namespace dbaui
//------------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateSpecialSettingsPage( Window* _pParent, const SfxItemSet& _rAttrSet )
{
- ::dbaccess::DATASOURCE_TYPE eType = ODbDataSourceAdministrationHelper::getDatasourceType( _rAttrSet );
+ ::rtl::OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( _rAttrSet );
DataSourceMetaData aMetaData( eType );
return new SpecialSettingsPage( _pParent, _rAttrSet, aMetaData );
}
diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx
index 9b2f6e0e4..04cc1ddc6 100644
--- a/dbaccess/source/ui/dlg/detailpages.hxx
+++ b/dbaccess/source/ui/dlg/detailpages.hxx
@@ -220,7 +220,7 @@ namespace dbaui
, USHORT _nResId
, const SfxItemSet& _rCoreAttrs
, USHORT _nPortId
- , const char* _pDriverName);
+ );
protected:
diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx
index c01e16d8f..5d2ec3627 100644
--- a/dbaccess/source/ui/dlg/dsselect.cxx
+++ b/dbaccess/source/ui/dlg/dsselect.cxx
@@ -107,7 +107,7 @@ using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::comphelper;
//==================================================================
-ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringBag& _rDatasources, ::dbaccess::DATASOURCE_TYPE _eType,SfxItemSet* _pOutputSet)
+ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringBag& _rDatasources, bool _bAdabas,SfxItemSet* _pOutputSet)
:ModalDialog(_pParent, ModuleRes(DLG_DATASOURCE_SELECTION))
,m_aDescription (this, ModuleRes(FT_DESCRIPTION))
,m_aDatasource (this, ModuleRes(LB_DATASOURCE))
@@ -120,7 +120,7 @@ ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringB
,m_aCreateAdabasDB (this, ModuleRes(PB_CREATE))
,m_pOutputSet(_pOutputSet)
{
- if ( ::dbaccess::DST_ADABAS == _eType)
+ if ( _bAdabas )
{ // set a new title (indicating that we're browsing local data sources only)
SetText(ModuleRes(STR_LOCAL_DATASOURCES));
m_aDescription.SetText(ModuleRes(STR_DESCRIPTION2));
@@ -158,7 +158,7 @@ ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringB
fillListBox(_rDatasources);
#ifdef HAVE_ODBC_ADMINISTRATION
// allow ODBC datasource managenment
- if ( ::dbaccess::DST_ODBC == _eType || ::dbaccess::DST_MYSQL_ODBC == _eType )
+ if ( !_bAdabas )
{
m_aManageDatasources.Show();
m_aManageDatasources.Enable();
diff --git a/dbaccess/source/ui/dlg/dsselect.hxx b/dbaccess/source/ui/dlg/dsselect.hxx
index 4adb8c0f2..80a18a8b4 100644
--- a/dbaccess/source/ui/dlg/dsselect.hxx
+++ b/dbaccess/source/ui/dlg/dsselect.hxx
@@ -72,7 +72,7 @@ protected:
#endif
public:
- ODatasourceSelectDialog( Window* _pParent, const StringBag& _rDatasources, ::dbaccess::DATASOURCE_TYPE _eType,SfxItemSet* _pOutputSet = NULL );
+ ODatasourceSelectDialog( Window* _pParent, const StringBag& _rDatasources, bool _bAdabas,SfxItemSet* _pOutputSet = NULL );
~ODatasourceSelectDialog();
inline String GetSelected() const { return m_aDatasource.GetSelectEntry();}
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index b4cc4b273..844db6b66 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -32,59 +32,26 @@
#include "precompiled_dbaccess.hxx"
#include "dsnItem.hxx"
-#ifndef _DBAUI_GENERALPAGE_HXX_
#include "generalpage.hxx"
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
-#endif
-#ifndef _DBU_DLG_HRC_
#include "dbu_dlg.hrc"
-#endif
-#ifndef _DBAUI_DBADMIN_HRC_
#include "dbadmin.hrc"
-#endif
-#ifndef _DBAUI_DATASOURCEITEMS_HXX_
#include "dsitems.hxx"
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
-#endif
-#ifndef _DBAUI_DBADMIN_HXX_
#include "dbadmin.hxx"
-#endif
#include <sfx2/filedlghelper.hxx>
#include <sfx2/docfilt.hxx>
-#ifndef _VCL_STDTEXT_HXX
#include <vcl/stdtext.hxx>
-#endif
-#ifndef _DBAUI_LOCALRESACCESS_HXX_
#include "localresaccess.hxx"
-#endif
-#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _SFXSTRITEM_HXX
#include <svtools/stritem.hxx>
-#endif
-#ifndef _SV_WAITOBJ_HXX
+#include <connectivity/DriversConfig.hxx>
#include <vcl/waitobj.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_
#include <com/sun/star/sdbc/XDriverAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
#include <com/sun/star/uno/Sequence.hxx>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef DBAUI_DRIVERSETTINGS_HXX
#include "DriverSettings.hxx"
-#endif
#include "UITools.hxx"
//.........................................................................
namespace dbaui
@@ -120,11 +87,11 @@ namespace dbaui
,m_sMySQLEntry (ModuleRes(STR_MYSQLENTRY))
,m_eOriginalCreationMode (eCreateNew)
,m_pCollection (NULL)
- ,m_eCurrentSelection ( ::dbaccess::DST_UNKNOWN)
,m_eNotSupportedKnownType ( ::dbaccess::DST_UNKNOWN)
,m_eLastMessage (smNone)
,m_bDisplayingInvalid (sal_False)
,m_bUserGrabFocus (sal_True)
+ ,m_bInitTypeList (true)
{
// fill the listbox with the UI descriptions for the possible types
// and remember the respective DSN prefixes
@@ -159,10 +126,10 @@ namespace dbaui
{
struct DisplayedType
{
- ::dbaccess::DATASOURCE_TYPE eType;
+ ::rtl::OUString eType;
String sDisplayName;
- DisplayedType( ::dbaccess::DATASOURCE_TYPE _eType, const String& _rDisplayName ) : eType( _eType ), sDisplayName( _rDisplayName ) { }
+ DisplayedType( const ::rtl::OUString& _eType, const String& _rDisplayName ) : eType( _eType ), sDisplayName( _rDisplayName ) { }
};
typedef ::std::vector< DisplayedType > DisplayedTypes;
@@ -178,69 +145,51 @@ namespace dbaui
//-------------------------------------------------------------------------
void OGeneralPage::initializeTypeList()
{
- m_pDatasourceType->Clear();
-
- Reference< XDriverAccess > xDriverManager;
-
- // get the driver manager, to ask it for all known URL prefixes
- DBG_ASSERT(m_xORB.is(), "OGeneralPage::initializeTypeList: have no service factory!");
- if (m_xORB.is())
- {
- {
- // if the connection pool (resp. driver manager) may be expensive to load if it is accessed the first time,
- // so display a wait cursor
- WaitObject aWaitCursor(GetParent());
- xDriverManager = Reference< XDriverAccess >(m_xORB->createInstance(SERVICE_SDBC_CONNECTIONPOOL), UNO_QUERY);
- if (!xDriverManager.is())
- xDriverManager = Reference< XDriverAccess >(m_xORB->createInstance(SERVICE_SDBC_DRIVERMANAGER), UNO_QUERY);
- }
- if (!xDriverManager.is())
- ShowServiceNotAvailableError(GetParent(), String(SERVICE_SDBC_DRIVERMANAGER), sal_True);
- }
-
- if ( m_pCollection )
+ if ( m_bInitTypeList )
{
- DisplayedTypes aDisplayedTypes;
+ m_bInitTypeList = false;
+ m_pDatasourceType->Clear();
- for ( ::dbaccess::ODsnTypeCollection::TypeIterator aTypeLoop = m_pCollection->begin();
- aTypeLoop != m_pCollection->end();
- ++aTypeLoop
- )
+ if ( m_pCollection )
{
- ::dbaccess::DATASOURCE_TYPE eType = aTypeLoop.getType();
-
- if ( xDriverManager.is() )
- { // we have a driver manager to check
- ::rtl::OUString sURLPrefix = m_pCollection->getDatasourcePrefix(eType);
- if (!xDriverManager->getDriverByURL(sURLPrefix).is())
- // we have no driver for this prefix
- // -> omit it
- continue;
- }
- String sDisplayName = aTypeLoop.getDisplayName();
- if ( m_pDatasourceType->GetEntryPos( sDisplayName ) == LISTBOX_ENTRY_NOTFOUND )
+ DisplayedTypes aDisplayedTypes;
+
+ ::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
+ for ( ::dbaccess::ODsnTypeCollection::TypeIterator aTypeLoop = m_pCollection->begin();
+ aTypeLoop != aEnd;
+ ++aTypeLoop
+ )
{
- if ( approveDataSourceType( eType, sDisplayName ) )
- aDisplayedTypes.push_back( DisplayedTypes::value_type( eType, sDisplayName ) );
+ const ::rtl::OUString sURLPrefix = aTypeLoop.getURLPrefix();
+ if ( sURLPrefix.getLength() )
+ {
+ String sDisplayName = aTypeLoop.getDisplayName();
+ if ( m_pDatasourceType->GetEntryPos( sDisplayName ) == LISTBOX_ENTRY_NOTFOUND
+ && approveDataSourceType( sURLPrefix, sDisplayName ) )
+ {
+ aDisplayedTypes.push_back( DisplayedTypes::value_type( sURLPrefix, sDisplayName ) );
+ }
+ }
}
- }
- ::std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), DisplayedTypeLess() );
- for ( DisplayedTypes::const_iterator loop = aDisplayedTypes.begin();
- loop != aDisplayedTypes.end();
- ++loop
- )
- insertDatasourceTypeEntryData( loop->eType, loop->sDisplayName );
+ ::std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), DisplayedTypeLess() );
+ DisplayedTypes::const_iterator aDisplayEnd = aDisplayedTypes.end();
+ for ( DisplayedTypes::const_iterator loop = aDisplayedTypes.begin();
+ loop != aDisplayEnd;
+ ++loop
+ )
+ insertDatasourceTypeEntryData( loop->eType, loop->sDisplayName );
+ } // if ( m_pCollection )
}
}
//-------------------------------------------------------------------------
- void OGeneralPage::setParentTitle(::dbaccess::DATASOURCE_TYPE _eSelectedType)
+ void OGeneralPage::setParentTitle(const ::rtl::OUString& _sURLPrefix)
{
if (!m_DBWizardMode)
{
- String sName = m_pCollection->getTypeDisplayName(_eSelectedType);
+ const String sName = m_pCollection->getTypeDisplayName(_sURLPrefix);
if ( m_pAdminDialog )
{
LocalResourceAccess aStringResAccess( PAGE_GENERAL, RSC_TABPAGE );
@@ -272,10 +221,10 @@ namespace dbaui
}
//-------------------------------------------------------------------------
- void OGeneralPage::switchMessage(const ::dbaccess::DATASOURCE_TYPE _eType)
+ void OGeneralPage::switchMessage(const ::rtl::OUString& _sURLPrefix)
{
SPECIAL_MESSAGE eMessage = smNone;
- if ( _eType == m_eNotSupportedKnownType )
+ if ( !_sURLPrefix.getLength()/*_eType == m_eNotSupportedKnownType*/ )
{
eMessage = smUnsupportedType;
}
@@ -299,12 +248,12 @@ namespace dbaui
}
//-------------------------------------------------------------------------
- void OGeneralPage::onTypeSelected(const ::dbaccess::DATASOURCE_TYPE _eType)
+ void OGeneralPage::onTypeSelected(const ::rtl::OUString& _sURLPrefix)
{
// the the new URL text as indicated by the selection history
- implSetCurrentType( _eType );
+ implSetCurrentType( _sURLPrefix );
- switchMessage(_eType);
+ switchMessage(_sURLPrefix);
if ( m_aTypeSelectHandler.IsSet() )
m_aTypeSelectHandler.Call(this);
@@ -382,16 +331,16 @@ namespace dbaui
sConnectURL = pUrlItem->GetValue();
}
- ::dbaccess::DATASOURCE_TYPE eOldSelection = m_eCurrentSelection;
+ ::rtl::OUString eOldSelection = m_eCurrentSelection;
m_eNotSupportedKnownType = ::dbaccess::DST_UNKNOWN;
- implSetCurrentType( ::dbaccess::DST_UNKNOWN );
+ implSetCurrentType( ::rtl::OUString() );
// compare the DSN prefix with the registered ones
String sDisplayName;
if (m_pCollection && bValid)
{
- implSetCurrentType( m_pCollection->getType(sConnectURL) );
+ implSetCurrentType( m_pCollection->getPrefix(sConnectURL) );
sDisplayName = m_pCollection->getTypeDisplayName(m_eCurrentSelection);
}
@@ -405,11 +354,11 @@ namespace dbaui
insertDatasourceTypeEntryData(m_eCurrentSelection, sDisplayName);
// remember this type so we can show the special message again if the user selects this
// type again (without changing the data source)
- m_eNotSupportedKnownType = m_eCurrentSelection;
+ m_eNotSupportedKnownType = m_pCollection->determineType(m_eCurrentSelection);
}
if (m_aRB_CreateDatabase.IsChecked() && m_DBWizardMode)
- sDisplayName = m_pCollection->getTypeDisplayName( ::dbaccess::DST_JDBC);
+ sDisplayName = m_pCollection->getTypeDisplayName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("jdbc:")));
m_pDatasourceType->SelectEntry(sDisplayName);
// notify our listener that our type selection has changed (if so)
@@ -432,8 +381,9 @@ namespace dbaui
// representative for all MySQl databases)
// Also, embedded databases (embedded HSQL, at the moment), are not to appear in the list of
// databases to connect to.
- bool OGeneralPage::approveDataSourceType( ::dbaccess::DATASOURCE_TYPE eType, String& _inout_rDisplayName )
+ bool OGeneralPage::approveDataSourceType( const ::rtl::OUString& _sURLPrefix, String& _inout_rDisplayName )
{
+ const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(_sURLPrefix);
if ( m_DBWizardMode && ( eType == ::dbaccess::DST_MYSQL_JDBC ) )
_inout_rDisplayName = m_sMySQLEntry;
@@ -451,11 +401,13 @@ namespace dbaui
// -----------------------------------------------------------------------
- void OGeneralPage::insertDatasourceTypeEntryData(::dbaccess::DATASOURCE_TYPE _eType, String sDisplayName)
+ void OGeneralPage::insertDatasourceTypeEntryData(const ::rtl::OUString& _sType, String sDisplayName)
{
// insert a (temporary) entry
sal_uInt16 nPos = m_pDatasourceType->InsertEntry(sDisplayName);
- m_pDatasourceType->SetEntryData(nPos, reinterpret_cast<void*>(_eType));
+ if ( nPos >= m_aURLPrefixes.size() )
+ m_aURLPrefixes.resize(nPos+1);
+ m_aURLPrefixes[nPos] = _sType;
}
// -----------------------------------------------------------------------
@@ -480,7 +432,7 @@ namespace dbaui
}
//-------------------------------------------------------------------------
- void OGeneralPage::implSetCurrentType( const ::dbaccess::DATASOURCE_TYPE _eType )
+ void OGeneralPage::implSetCurrentType( const ::rtl::OUString& _eType )
{
if ( _eType == m_eCurrentSelection )
return;
@@ -492,7 +444,7 @@ namespace dbaui
void OGeneralPage::Reset(const SfxItemSet& _rCoreAttrs)
{
// reset all locale data
- implSetCurrentType( ::dbaccess::DST_UNKNOWN );
+ implSetCurrentType( ::rtl::OUString() );
// this ensures that our type selection link will be called, even if the new is is the same as the
// current one
OGenericAdministrationPage::Reset(_rCoreAttrs);
@@ -508,7 +460,7 @@ namespace dbaui
{
if ( m_aRB_CreateDatabase.IsChecked() )
{
- _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix( ::dbaccess::DST_DBASE)));
+ _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:"))));
bChangedSomething = sal_True;
bCommitTypeSelection = false;
}
@@ -525,24 +477,24 @@ namespace dbaui
if ( bCommitTypeSelection )
{
USHORT nEntry = m_pDatasourceType->GetSelectEntryPos();
- ::dbaccess::DATASOURCE_TYPE eSelectedType = static_cast< ::dbaccess::DATASOURCE_TYPE>(reinterpret_cast<sal_IntPtr>(m_pDatasourceType->GetEntryData(nEntry)));
+ ::rtl::OUString sURLPrefix = m_aURLPrefixes[nEntry];
if (m_DBWizardMode)
{
if ( ( m_pDatasourceType->GetSavedValue() != nEntry )
|| ( GetDatabaseCreationMode() != m_eOriginalCreationMode )
)
{
- _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix(eSelectedType)));
+ _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL,sURLPrefix ));
bChangedSomething = sal_True;
}
else
- implSetCurrentType(eSelectedType);
+ implSetCurrentType(sURLPrefix);
}
else
{
if ( m_pDatasourceType->GetSavedValue() != nEntry)
{
- _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix(eSelectedType)));
+ _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, sURLPrefix));
bChangedSomething = sal_True;
}
}
@@ -555,11 +507,11 @@ namespace dbaui
{
// get the type from the entry data
sal_Int16 nSelected = _pBox->GetSelectEntryPos();
- ::dbaccess::DATASOURCE_TYPE eSelectedType = static_cast< ::dbaccess::DATASOURCE_TYPE>(reinterpret_cast<sal_IntPtr>(_pBox->GetEntryData(nSelected)));
+ const ::rtl::OUString sURLPrefix = m_aURLPrefixes[nSelected];
- setParentTitle(eSelectedType);
+ setParentTitle(sURLPrefix);
// let the impl method do all the stuff
- onTypeSelected(eSelectedType);
+ onTypeSelected(sURLPrefix);
// tell the listener we were modified
callModifiedHdl();
// outta here
@@ -607,7 +559,8 @@ namespace dbaui
}
if ( aFileDlg.Execute() == ERRCODE_NONE )
{
- if ( aFileDlg.GetCurrentFilter() != pFilter->GetUIName() )
+ String sPath = aFileDlg.GetPath();
+ if ( aFileDlg.GetCurrentFilter() != pFilter->GetUIName() || !pFilter->GetWildcard().Matches(sPath) )
{
String sMessage(ModuleRes(STR_ERR_USE_CONNECT_TO));
InfoBox aError(this, sMessage);
@@ -616,7 +569,7 @@ namespace dbaui
OnSetupModeSelected(&m_aRB_GetExistingDatabase);
return 0L;
}
- m_aBrowsedDocument.sURL = aFileDlg.GetPath();
+ m_aBrowsedDocument.sURL = sPath;
m_aBrowsedDocument.sFilter = String();
m_aChooseDocumentHandler.Call( this );
return 1L;
diff --git a/dbaccess/source/ui/dlg/generalpage.hxx b/dbaccess/source/ui/dlg/generalpage.hxx
index 041572847..b6a4aa159 100644
--- a/dbaccess/source/ui/dlg/generalpage.hxx
+++ b/dbaccess/source/ui/dlg/generalpage.hxx
@@ -102,11 +102,12 @@ namespace dbaui
::svt::ControlDependencyManager
m_aControlDependencies;
+ ::std::vector< ::rtl::OUString> m_aURLPrefixes;
::dbaccess::ODsnTypeCollection*
m_pCollection; /// the DSN type collection instance
- ::dbaccess::DATASOURCE_TYPE m_eCurrentSelection; /// currently selected type
+ ::rtl::OUString m_eCurrentSelection; /// currently selected type
::dbaccess::DATASOURCE_TYPE m_eNotSupportedKnownType; /// if a data source of an unsupported, but known type is encountered ....
enum SPECIAL_MESSAGE
@@ -122,8 +123,9 @@ namespace dbaui
Link m_aChooseDocumentHandler; /// to be called when a recent document has been definately chosen
sal_Bool m_bDisplayingInvalid : 1; // the currently displayed data source is deleted
sal_Bool m_bUserGrabFocus : 1;
- bool approveDataSourceType( ::dbaccess::DATASOURCE_TYPE eType, String& _inout_rDisplayName );
- void insertDatasourceTypeEntryData(::dbaccess::DATASOURCE_TYPE eType, String sDisplayName);
+ bool m_bInitTypeList : 1;
+ bool approveDataSourceType( const ::rtl::OUString& _sURLPrefix, String& _inout_rDisplayName );
+ void insertDatasourceTypeEntryData(const ::rtl::OUString& _sType, String sDisplayName);
public:
static SfxTabPage* Create(Window* pParent, const SfxItemSet& _rAttrSet, sal_Bool _bDBWizardMode = sal_False);
@@ -138,7 +140,7 @@ namespace dbaui
DocumentDescriptor GetSelectedDocument() const;
/// get the currently selected datasource type
- ::dbaccess::DATASOURCE_TYPE GetSelectedType() const { return m_eCurrentSelection; }
+ ::rtl::OUString GetSelectedType() const { return m_eCurrentSelection; }
protected:
// SfxTabPage overridables
@@ -156,15 +158,15 @@ namespace dbaui
protected:
- void onTypeSelected(const ::dbaccess::DATASOURCE_TYPE _eType);
+ void onTypeSelected(const ::rtl::OUString& _sURLPrefix);
void initializeTypeList();
- void implSetCurrentType( const ::dbaccess::DATASOURCE_TYPE _eType );
+ void implSetCurrentType( const ::rtl::OUString& _eType );
- void switchMessage(const ::dbaccess::DATASOURCE_TYPE _eType);
+ void switchMessage(const ::rtl::OUString& _sURLPrefix);
/// sets the the title of the parent dialog
- void setParentTitle(::dbaccess::DATASOURCE_TYPE _eSelectedType);
+ void setParentTitle(const ::rtl::OUString& _sURLPrefix);
DECL_LINK(OnDatasourceTypeSelected, ListBox*);
DECL_LINK(OnSetupModeSelected, RadioButton*);
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index 32cc46c4f..08d0ab144 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -102,8 +102,9 @@ namespace dbaui
return sal_False;
ConstIndexFieldsIterator aLeft = _rLHS.begin();
+ ConstIndexFieldsIterator aLeftEnd = _rLHS.end();
ConstIndexFieldsIterator aRight = _rRHS.begin();
- for (; aLeft != _rLHS.end(); ++aLeft, ++aRight)
+ for (; aLeft != aLeftEnd; ++aLeft, ++aRight)
{
if (*aLeft != *aRight)
return sal_False;
diff --git a/dbaccess/source/ui/dlg/makefile.mk b/dbaccess/source/ui/dlg/makefile.mk
index 0502de1c2..ceeac9f8c 100644
--- a/dbaccess/source/ui/dlg/makefile.mk
+++ b/dbaccess/source/ui/dlg/makefile.mk
@@ -78,10 +78,8 @@ SRC1FILES = \
CollectionView.src \
dlgattr.src \
advancedsettings.src\
- AdabasStatDlg.src \
UserAdminDlg.src \
sqlmessage.src \
- ExtensionNotPresent.src \
textconnectionsettings.src
@@ -109,7 +107,6 @@ EXCEPTIONSFILES= \
$(SLO)$/TextConnectionHelper.obj \
$(SLO)$/ConnectionPageSetup.obj \
$(SLO)$/DBSetupConnectionPages.obj \
- $(SLO)$/AdabasStatDlg.obj \
$(SLO)$/UserAdminDlg.obj \
$(SLO)$/UserAdmin.obj \
$(SLO)$/AdabasStat.obj \
@@ -121,7 +118,6 @@ EXCEPTIONSFILES= \
$(SLO)$/dbfindex.obj \
$(SLO)$/DriverSettings.obj \
$(SLO)$/odbcconfig.obj \
- $(SLO)$/ExtensionNotPresent.obj \
$(SLO)$/advancedsettings.obj \
$(SLO)$/datasourceui.obj \
$(SLO)$/textconnectionsettings.obj
diff --git a/dbaccess/source/ui/dlg/odbcconfig.cxx b/dbaccess/source/ui/dlg/odbcconfig.cxx
index b28f4499f..697fb237b 100644
--- a/dbaccess/source/ui/dlg/odbcconfig.cxx
+++ b/dbaccess/source/ui/dlg/odbcconfig.cxx
@@ -34,6 +34,7 @@
#ifndef _DBAUI_ODBC_CONFIG_HXX_
#include "odbcconfig.hxx"
#endif
+#include <rtl/bootstrap.hxx>
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
@@ -380,7 +381,8 @@ bool OOdbcManagement::manageDataSources_async()
// this is done in an external process, due to #i78733#
// (and note this whole functionality is supported on Windows only, ATM)
- ::rtl::OUString sExecutableName( RTL_CONSTASCII_USTRINGPARAM( "odbcconfig.exe" ) );
+ ::rtl::OUString sExecutableName( RTL_CONSTASCII_USTRINGPARAM( "$OOO_BASE_DIR/program/odbcconfig.exe" ) );
+ ::rtl::Bootstrap::expandMacros( sExecutableName ); //TODO: detect failure
oslProcess hProcessHandle(0);
oslProcessError eError = osl_executeProcess( sExecutableName.pData, NULL, 0, 0, NULL, NULL, NULL, 0, &hProcessHandle );
if ( eError != osl_Process_E_None )
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 5f8bd7519..8221f5d19 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: queryfilter.cxx,v $
- * $Revision: 1.36.66.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -382,7 +379,16 @@ sal_Bool DlgFilterCrit::getCondition(const ListBox& _rField,const ListBox& _rCom
if ( xInfo->hasPropertyByName(PROPERTY_REALNAME) )
{
if ( xInfo->hasPropertyByName(PROPERTY_TABLENAME) )
+ {
xColumn->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName;
+ if ( sTableName.getLength() )
+ {
+ // properly quote all parts of the table name, so e.g. <schema>.<table> becomes "<schema>"."<table>"
+ ::rtl::OUString aCatlog,aSchema,aTable;
+ ::dbtools::qualifiedNameComponents( m_xMetaData, sTableName, aCatlog, aSchema, aTable, ::dbtools::eInDataManipulation );
+ sTableName = ::dbtools::composeTableName( m_xMetaData, aCatlog, aSchema, aTable, sal_True, ::dbtools::eInDataManipulation );
+ }
+ }
xColumn->getPropertyValue(PROPERTY_REALNAME) >>= _rFilter.Name;
static ::rtl::OUString sAgg(RTL_CONSTASCII_USTRINGPARAM("AggregateFunction"));
if ( xInfo->hasPropertyByName(sAgg) )
@@ -398,7 +404,6 @@ sal_Bool DlgFilterCrit::getCondition(const ListBox& _rField,const ListBox& _rCom
if ( sTableName.getLength() )
{
static ::rtl::OUString sSep(RTL_CONSTASCII_USTRINGPARAM("."));
- sTableName = ::dbtools::quoteName(aQuote,sTableName);
sTableName += sSep;
sTableName += _rFilter.Name;
_rFilter.Name = sTableName;
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index 4051b2b84..a6743baf6 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -539,14 +539,17 @@ void OSQLMessageBox::impl_positionControls()
{
OSL_PRECOND( !m_pImpl->aDisplayInfo.empty(), "OSQLMessageBox::impl_positionControls: nothing to display at all?" );
- const ExceptionDisplayInfo& rFirstInfo = *m_pImpl->aDisplayInfo.begin();
+
+ if ( m_pImpl->aDisplayInfo.empty() )
+ return;
const ExceptionDisplayInfo* pSecondInfo = NULL;
+
+ const ExceptionDisplayInfo& rFirstInfo = *m_pImpl->aDisplayInfo.begin();
if ( m_pImpl->aDisplayInfo.size() > 1 )
pSecondInfo = &m_pImpl->aDisplayInfo[1];
-
- // one or two texts to display?
String sPrimary, sSecondary;
sPrimary = rFirstInfo.sMessage;
+ // one or two texts to display?
if ( pSecondInfo )
{
// we show two elements in the main dialog if and only if one of
diff --git a/dbaccess/source/ui/inc/AdabasStatDlg.hxx b/dbaccess/source/ui/inc/AdabasStatDlg.hxx
deleted file mode 100644
index 0d165d4db..000000000
--- a/dbaccess/source/ui/inc/AdabasStatDlg.hxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: AdabasStatDlg.hxx,v $
- * $Revision: 1.8.68.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef DBAUI_ADABASSTATDLG_HXX
-#define DBAUI_ADABASSTATDLG_HXX
-
-#ifndef _SFXTABDLG_HXX
-#include <sfx2/tabdlg.hxx>
-#endif
-#ifndef _DBAUI_DSNTYPES_HXX_
-#include "dsntypes.hxx"
-#endif
-#ifndef DBAUI_ITEMSETHELPER_HXX
-#include "IItemSetHelper.hxx"
-#endif
-#ifndef _COMPHELPER_UNO3_HXX_
-#include <comphelper/uno3.hxx>
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
-#include "moduledbu.hxx"
-#endif
-#include <memory>
-
-FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
-FORWARD_DECLARE_INTERFACE(sdbc,XConnection)
-FORWARD_DECLARE_INTERFACE(lang,XMultiServiceFactory)
-
-//.........................................................................
-namespace dbaui
-{
-//.........................................................................
- class ODbDataSourceAdministrationHelper;
- //=========================================================================
- //= OAdabasStatPageDlg
- //=========================================================================
-
- /** implements the adabas admin dialog
- */
- class OAdabasStatPageDlg : public SfxTabDialog, public IItemSetHelper, public IDatabaseSettingsDialog,public dbaui::OModuleClient
- {
- OModuleClient m_aModuleClient;
- ::std::auto_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
- protected:
- virtual void PageCreated(USHORT _nId, SfxTabPage& _rPage);
- public:
- OAdabasStatPageDlg( Window* _pParent
- ,SfxItemSet* _pItems
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
- ,const ::com::sun::star::uno::Any& _aDataSourceName);
-
- virtual ~OAdabasStatPageDlg();
-
- virtual const SfxItemSet* getOutputSet() const;
- virtual SfxItemSet* getWriteOutputSet();
-
- virtual short Execute();
-
- // forwards to ODbDataSourceAdministrationHelper
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
- virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
- virtual void clearPassword();
- virtual sal_Bool saveDatasource();
- virtual void setTitle(const ::rtl::OUString& _sTitle);
- virtual void enableConfirmSettings( bool _bEnable );
- };
-//.........................................................................
-} // namespace dbaui
-//.........................................................................
-
-#endif // DBAUI_ADABASSTATDLG_HXX
diff --git a/dbaccess/source/ui/inc/IItemSetHelper.hxx b/dbaccess/source/ui/inc/IItemSetHelper.hxx
index be1bbba13..084cad8c4 100644
--- a/dbaccess/source/ui/inc/IItemSetHelper.hxx
+++ b/dbaccess/source/ui/inc/IItemSetHelper.hxx
@@ -62,7 +62,7 @@ namespace dbaui
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const = 0;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection() = 0;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver() = 0;
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const = 0;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const = 0;
virtual void clearPassword() = 0;
virtual sal_Bool saveDatasource() = 0;
virtual void setTitle(const ::rtl::OUString& _sTitle) = 0;
diff --git a/dbaccess/source/ui/inc/IUpdateHelper.hxx b/dbaccess/source/ui/inc/IUpdateHelper.hxx
index 73b7dc013..dd4d6b712 100644
--- a/dbaccess/source/ui/inc/IUpdateHelper.hxx
+++ b/dbaccess/source/ui/inc/IUpdateHelper.hxx
@@ -30,6 +30,10 @@
#ifndef DBAUI_IUPDATEHELPER_HXX
#define DBAUI_IUPDATEHELPER_HXX
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Time.hpp>
+
namespace dbaui
{
class SAL_NO_VTABLE IUpdateHelper
@@ -39,6 +43,9 @@ namespace dbaui
virtual void updateDouble(sal_Int32 _nPos,const double& _nValue) = 0;
virtual void updateInt(sal_Int32 _nPos,const sal_Int32& _nValue) = 0;
virtual void updateNull(sal_Int32 _nPos, ::sal_Int32 sqlType) = 0;
+ virtual void updateDate(sal_Int32 _nPos,const ::com::sun::star::util::Date& _nValue) = 0;
+ virtual void updateTime(sal_Int32 _nPos,const ::com::sun::star::util::Time& _nValue) = 0;
+ virtual void updateTimestamp(sal_Int32 _nPos,const ::com::sun::star::util::DateTime& _nValue) = 0;
virtual void moveToInsertRow() = 0;
virtual void insertRow() = 0;
};
diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx
index a6b8c1e69..6062cec1a 100644
--- a/dbaccess/source/ui/inc/TableController.hxx
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -60,7 +60,6 @@
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
-#include "dsntypes.hxx"
class FixedText;
namespace dbaui
@@ -75,7 +74,6 @@ namespace dbaui
::std::vector< ::boost::shared_ptr<OTableRow> > m_vRowList;
OTypeInfoMap m_aTypeInfo;
::std::vector<OTypeInfoMap::iterator> m_aTypeInfoIndex;
- ::dbaccess::ODsnTypeCollection m_aTypeCollection;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTable;
diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx
index 02dabd454..de7b16000 100644
--- a/dbaccess/source/ui/inc/TableFieldDescription.hxx
+++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx
@@ -131,10 +131,11 @@ namespace dbaui
sal_Bool HasCriteria() const
{
::std::vector< ::rtl::OUString>::const_iterator aIter = m_vecCriteria.begin();
- for(;aIter != m_vecCriteria.end();++aIter)
+ ::std::vector< ::rtl::OUString>::const_iterator aEnd = m_vecCriteria.end();
+ for(;aIter != aEnd;++aIter)
if(aIter->getLength())
break;
- return aIter != m_vecCriteria.end();
+ return aIter != aEnd;
}
const ::std::vector< ::rtl::OUString>& GetCriteria() const { return m_vecCriteria;}
diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx
index d5860359e..ebd23bd3e 100644
--- a/dbaccess/source/ui/inc/TokenWriter.hxx
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -173,7 +173,7 @@ namespace dbaui
class ORTFImportExport : public ODatabaseImportExport
{
-
+ void appendRow(::rtl::OString* pHorzChar,sal_Int32 _nColumnCount,sal_Int32& k,sal_Int32& kk);
public:
// export data
ORTFImportExport( const ::svx::ODataAccessDescriptor& _aDataDescriptor,
diff --git a/dbaccess/source/ui/inc/UserAdminDlg.hxx b/dbaccess/source/ui/inc/UserAdminDlg.hxx
index 88722c0b0..9a1418216 100644
--- a/dbaccess/source/ui/inc/UserAdminDlg.hxx
+++ b/dbaccess/source/ui/inc/UserAdminDlg.hxx
@@ -90,7 +90,7 @@ namespace dbaui
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual sal_Bool saveDatasource();
virtual void setTitle(const ::rtl::OUString& _sTitle);
diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx
index a8e59acf1..b81ec4859 100644
--- a/dbaccess/source/ui/inc/WCPage.hxx
+++ b/dbaccess/source/ui/inc/WCPage.hxx
@@ -66,6 +66,7 @@ namespace dbaui
RadioButton m_aRB_Def;
RadioButton m_aRB_View;
RadioButton m_aRB_AppendData;
+ CheckBox m_aCB_UseHeaderLine;
CheckBox m_aCB_PrimaryColumn;
FixedText m_aFT_KeyName;
Edit m_edKeyName;
@@ -75,6 +76,7 @@ namespace dbaui
OWizNormalExtend* m_pPage3;
BOOL m_bPKeyAllowed;
+ BOOL m_bUseHeaderAllowed;
DECL_LINK( AppendDataClickHdl, Button* );
@@ -99,13 +101,19 @@ namespace dbaui
inline BOOL IsOptionDef() const { return m_aRB_Def.IsChecked(); }
inline BOOL IsOptionAppendData() const { return m_aRB_AppendData.IsChecked(); }
inline BOOL IsOptionView() const { return m_aRB_View.IsChecked(); }
+ inline BOOL UseHeaderLine() const { return m_aCB_UseHeaderLine.IsChecked(); }
String GetKeyName() const { return m_edKeyName.GetText(); }
void setCreateStyleAction();
- void disallowViews()
+ inline void disallowViews()
{
m_aRB_View.Disable();
}
+ inline void disallowUseHeaderLine()
+ {
+ m_bUseHeaderAllowed = FALSE;
+ m_aCB_UseHeaderLine.Disable();
+ }
void setCreatePrimaryKey( bool _bDoCreate, const ::rtl::OUString& _rSuggestedName );
};
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index 3a1a21a0c..c8ede1184 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -314,6 +314,7 @@ namespace dbaui
sal_Int16 m_nOperation;
Wizard_Button_Style m_ePressed;
sal_Bool m_bCreatePrimaryKeyColumn;
+ sal_Bool m_bUseHeaderLine;
private:
DECL_LINK( ImplPrevHdl , PushButton* );
@@ -373,6 +374,8 @@ namespace dbaui
// when not the value is COLUMN_POSITION_NOT_FOUND == (sal_uInt32)-1
ODatabaseExport::TPositions GetColumnPositions() const { return m_vColumnPos; }
::std::vector<sal_Int32> GetColumnTypes() const { return m_vColumnTypes; }
+ sal_Bool UseHeaderLine() const { return m_bUseHeaderLine; }
+ void setUseHeaderLine(sal_Bool _bUseHeaderLine) { m_bUseHeaderLine = _bUseHeaderLine; }
void insertColumn(sal_Int32 _nPos,OFieldDescription* _pField);
diff --git a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
index 48d11c615..2f33612fb 100644
--- a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
+++ b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
@@ -72,7 +72,7 @@ namespace dbaui
virtual ~AdvancedSettingsDialog();
/// determines whether or not the given data source type has any advanced setting
- static bool doesHaveAnyAdvancedSettings( ::dbaccess::DATASOURCE_TYPE _eType );
+ static bool doesHaveAnyAdvancedSettings( const ::rtl::OUString& _sURL );
virtual const SfxItemSet* getOutputSet() const;
virtual SfxItemSet* getWriteOutputSet();
@@ -83,7 +83,7 @@ namespace dbaui
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual sal_Bool saveDatasource();
virtual void setTitle(const ::rtl::OUString& _sTitle);
diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx
index 7cb168bff..0b3da2498 100644
--- a/dbaccess/source/ui/inc/brwctrlr.hxx
+++ b/dbaccess/source/ui/inc/brwctrlr.hxx
@@ -71,7 +71,6 @@ namespace dbtools
namespace dbaui
{
-
// =========================================================================
typedef ::cppu::ImplInheritanceHelper9 < OGenericUnoController
@@ -115,6 +114,8 @@ namespace dbaui
::osl::Mutex m_aAsyncLoadSafety; // for multi-thread access to our members
OAsyncronousLink m_aAsyncGetCellFocus;
+ OAsyncronousLink m_aAsyncDisplayError;
+ ::dbtools::SQLExceptionInfo m_aCurrentError;
String m_sStateSaveRecord;
String m_sStateUndoRecord;
@@ -129,7 +130,6 @@ namespace dbaui
sal_Bool m_bLoadCanceled : 1; // the load was canceled somehow
sal_Bool m_bClosingKillOpen : 1; // are we killing the load thread because we are to be suspended ?
- sal_Bool m_bErrorOccured : 1; // see enter-/leaveFormAction
bool m_bCannotSelectUnfiltered : 1; // recieved an DATA_CANNOT_SELECT_UNFILTERED error
protected:
@@ -237,6 +237,8 @@ namespace dbaui
virtual void BeforeDrop();
virtual void AfterDrop();
+ public:
+
protected:
virtual ~SbaXDataBrowserController();
@@ -322,10 +324,7 @@ namespace dbaui
void enterFormAction();
void leaveFormAction();
- bool errorOccured() const { return m_bErrorOccured; }
- // As many form actions don't throw an exception but call their error handler instead we don't have
- // a chance to recognize errors by exception catching.
- // So for error recognition the above methods may be used.
+
// init the formatter if form changes
void initFormatter();
@@ -371,6 +370,8 @@ namespace dbaui
// (the alternative would be to lock the SolarMutex in OnOpenFinished to avoid problems with the needed updates,
// but playing with this mutex seems very hazardous to me ....)
DECL_LINK(OnAsyncGetCellFocus, void*);
+
+ DECL_LINK( OnAsyncDisplayError, void* );
};
//==================================================================
diff --git a/dbaccess/source/ui/inc/curledit.hxx b/dbaccess/source/ui/inc/curledit.hxx
index 5418777a6..aa757c77a 100644
--- a/dbaccess/source/ui/inc/curledit.hxx
+++ b/dbaccess/source/ui/inc/curledit.hxx
@@ -40,6 +40,7 @@
#ifndef _DBAUI_DSNTYPES_HXX_
#include "dsntypes.hxx"
#endif
+#include <memory>
//.........................................................................
namespace dbaui
@@ -55,8 +56,8 @@ namespace dbaui
*/
class OConnectionURLEdit : public Edit
{
- ::dbaccess::ODsnTypeCollection
- m_aTypeCollection;
+ ::dbaccess::ODsnTypeCollection*
+ m_pTypeCollection;
FixedText* m_pForcedPrefix;
String m_sSaveValueNoPrefix;
BOOL m_bShowPrefix; // when <TRUE> the prefix will be visible, otherwise not
@@ -84,7 +85,7 @@ public:
inline void SaveValueNoPrefix() { m_sSaveValueNoPrefix = GetTextNoPrefix(); }
inline String GetSavedValueNoPrefix() const { return m_sSaveValueNoPrefix; }
- inline void initializeTypeCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) { m_aTypeCollection.initUserDriverTypes(_rxORB); }
+ inline void SetTypeCollection(::dbaccess::ODsnTypeCollection* _pTypeCollection) { m_pTypeCollection = _pTypeCollection; }
};
//.........................................................................
diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx
index deca0eaa5..3dcd68f5c 100644
--- a/dbaccess/source/ui/inc/dbadmin.hxx
+++ b/dbaccess/source/ui/inc/dbadmin.hxx
@@ -105,7 +105,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual sal_Bool saveDatasource();
virtual void setTitle(const ::rtl::OUString& _sTitle);
diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx
index 1ba3ae52d..7b3d8c4d5 100644
--- a/dbaccess/source/ui/inc/dbexchange.hxx
+++ b/dbaccess/source/ui/inc/dbexchange.hxx
@@ -89,12 +89,11 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
);
- /** with this ctor, only the object descriptor format will be provided
- */
ODataClipboard(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxLivingForm,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rSelectedRows,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxResultSet
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxResultSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
);
DECLARE_XINTERFACE( )
diff --git a/dbaccess/source/ui/inc/dbu_misc.hrc b/dbaccess/source/ui/inc/dbu_misc.hrc
index 9a3185ab0..8cd9b5a74 100644
--- a/dbaccess/source/ui/inc/dbu_misc.hrc
+++ b/dbaccess/source/ui/inc/dbu_misc.hrc
@@ -34,9 +34,8 @@
#include "dbu_resource.hrc"
#endif
-
-#define STR_HTML_TITLE RID_STR_MISC_START
-#define STR_RTF_TITLE RID_STR_MISC_START + 1
+// free
+// free
#define STR_WIZ_COLUMN_SELECT_TITEL RID_STR_MISC_START + 2
#define STR_WIZ_TYPE_SELECT_TITEL RID_STR_MISC_START + 3
#define STR_WIZ_PKEY_ALREADY_DEFINED RID_STR_MISC_START + 4
diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc
index 2a0ac8ef7..1b4b5ad1c 100644
--- a/dbaccess/source/ui/inc/dbu_resource.hrc
+++ b/dbaccess/source/ui/inc/dbu_resource.hrc
@@ -392,7 +392,7 @@
// free
#define RSC_CHARSETS RID_UNTYPED_START + 2
-#define RSC_DATASOURCE_TYPE_UINAMES RID_UNTYPED_START + 3
+// free
#define RSC_QUERY_OBJECT_TYPE RID_UNTYPED_START + 4
#define IMG_TABLESUBCRIPTION_SC RID_UNTYPED_START + 5
#define IMG_TABLESUBCRIPTION_SCH RID_UNTYPED_START + 6
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
index 9fc83513c..4aca29062 100644
--- a/dbaccess/source/ui/inc/dbwiz.hxx
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -77,7 +77,9 @@ private:
OModuleClient m_aModuleClient;
::std::auto_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
SfxItemSet* m_pOutSet;
- ::dbaccess::DATASOURCE_TYPE m_eType;
+ ::dbaccess::ODsnTypeCollection*
+ m_pCollection; /// the DSN type collection instance
+ ::rtl::OUString m_eType;
sal_Bool m_bResetting : 1; /// sal_True while we're resetting the pages
sal_Bool m_bApplied : 1; /// sal_True if any changes have been applied while the dialog was executing
@@ -101,7 +103,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual sal_Bool saveDatasource();
virtual void setTitle(const ::rtl::OUString& _sTitle);
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index 9028756da..6a6bb1bc3 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -84,8 +84,8 @@ private:
OModuleClient m_aModuleClient;
::std::auto_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
SfxItemSet* m_pOutSet;
- ::dbaccess::DATASOURCE_TYPE m_eType;
- ::dbaccess::DATASOURCE_TYPE m_eOldType;
+ ::rtl::OUString m_sURL;
+ ::rtl::OUString m_sOldURL;
sal_Bool m_bResetting : 1; /// sal_True while we're resetting the pages
sal_Bool m_bApplied : 1; /// sal_True if any changes have been applied while the dialog was executing
sal_Bool m_bUIEnabled : 1; /// <TRUE/> if the UI is enabled, false otherwise. Cannot be switched back to <TRUE/>, once it is <FALSE/>
@@ -131,7 +131,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual void setTitle(const ::rtl::OUString& _sTitle);
virtual void enableConfirmSettings( bool _bEnable );
@@ -172,7 +172,7 @@ protected:
private:
/** declares a path with or without authentication, as indicated by the database type
- @param _eType
+ @param _sURL
the data source type for which the path is declared. If this
data source type does not support authentication, the PAGE_DBSETUPWIZARD_AUTHENTIFICATION
state will be stripped from the sequence of states.
@@ -182,7 +182,7 @@ private:
the first state in this path, following by an arbitrary number of others, as in
RoadmapWizard::declarePath.
*/
- void declareAuthDepPath( ::dbaccess::DATASOURCE_TYPE _eType, PathId _nPathId, WizardState _nFirstState, ... );
+ void declareAuthDepPath( const ::rtl::OUString& _sURL, PathId _nPathId, const svt::RoadmapWizardTypes::WizardPath& _rPaths);
void RegisterDataSourceByLocation(const ::rtl::OUString& sPath);
sal_Bool SaveDatabaseDocument();
@@ -192,7 +192,7 @@ private:
void createUniqueFolderName(INetURLObject* pURL);
::dbaccess::DATASOURCE_TYPE VerifyDataSourceType(const ::dbaccess::DATASOURCE_TYPE _DatabaseType) const;
- ::dbaccess::DATASOURCE_TYPE getDefaultDatabaseType() const;
+ ::rtl::OUString getDefaultDatabaseType() const;
void updateTypeDependentStates();
sal_Bool callSaveAsDialog();
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
index 5b1fb0227..874e09427 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -70,7 +70,7 @@ namespace dbaui
class DataSourceMetaData
{
public:
- DataSourceMetaData( ::dbaccess::DATASOURCE_TYPE _eType );
+ DataSourceMetaData( const ::rtl::OUString& _sURL );
~DataSourceMetaData();
/// returns a struct describing this data source type's support for our known advanced settings
@@ -79,7 +79,7 @@ namespace dbaui
/// determines whether or not the data source requires authentication
AuthenticationMode getAuthentication() const;
- static AuthenticationMode getAuthentication( ::dbaccess::DATASOURCE_TYPE _eType );
+ static AuthenticationMode getAuthentication( const ::rtl::OUString& _sURL );
private:
::boost::shared_ptr< DataSourceMetaData_Impl > m_pImpl;
@@ -108,7 +108,6 @@ namespace dbaui
bool bBooleanComparisonMode;
bool bFormsCheckRequiredFields;
bool bIgnoreCurrency;
- bool bAutoIncrementIsPrimaryKey;
bool bEscapeDateTime;
// Note: If you extend this list, you need to adjust the ctor (of course)
@@ -130,7 +129,6 @@ namespace dbaui
,bBooleanComparisonMode ( true )
,bFormsCheckRequiredFields ( true )
,bIgnoreCurrency ( false )
- ,bAutoIncrementIsPrimaryKey ( false )
,bEscapeDateTime ( false )
{
}
@@ -158,7 +156,6 @@ namespace dbaui
|| ( bBooleanComparisonMode == true )
|| ( bFormsCheckRequiredFields == true )
|| ( bIgnoreCurrency == true )
- || ( bAutoIncrementIsPrimaryKey == true )
|| ( bEscapeDateTime == true )
;
}
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx
index d4a8f419d..a449523f3 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -299,6 +299,12 @@ namespace dbaui
virtual ::rtl::OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
virtual void DeleteSelectedRows();
+ /** copies the currently selected rows to the clipboard
+ @precond
+ at least one row is selected
+ */
+ void CopySelectedRowsToClipboard();
+
protected:
// DragSourceHelper overridables
@@ -348,6 +354,7 @@ namespace dbaui
private:
sal_Bool IsReadOnlyDB() const;
+ void implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfClipboardFalseIfDrag );
private:
using FmGridControl::AcceptDrop;
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 01bcba47a..0e0ee7f1c 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -130,7 +130,6 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_xCollator;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xCurrentFrameParent;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xMainToolbar;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xCurrentDatabaseDocument;
// ---------------------------
struct ExternalFeature
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index e827fdd68..e901f6135 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -353,8 +353,8 @@ void ODatabaseExport::insertValueIntoColumn()
{
Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
Reference<XNumberFormatTypes> xNumType(xSupplier->getNumberFormats(),UNO_QUERY);
- sal_Int16 nFormats[] = { NumberFormat::DATETIME
- ,NumberFormat::DATETIME
+ sal_Int16 nFormats[] = {
+ NumberFormat::DATETIME
,NumberFormat::DATE
,NumberFormat::TIME
,NumberFormat::NUMBER
@@ -393,13 +393,17 @@ void ODatabaseExport::insertValueIntoColumn()
switch(nType)
{
case NumberFormat::DATE:
+ m_pUpdateHelper->updateDate(nPos,::dbtools::DBTypeConversion::toDate(fOutNumber,m_aNullDate));
+ break;
case NumberFormat::DATETIME:
- fOutNumber = ::dbtools::DBTypeConversion::toStandardDbDate(m_aNullDate,fOutNumber);
+ m_pUpdateHelper->updateTimestamp(nPos,::dbtools::DBTypeConversion::toDateTime(fOutNumber,m_aNullDate));
+ break;
+ case NumberFormat::TIME:
+ m_pUpdateHelper->updateTime(nPos,::dbtools::DBTypeConversion::toTime(fOutNumber));
break;
default:
- ;
+ m_pUpdateHelper->updateDouble(nPos,fOutNumber);
}
- m_pUpdateHelper->updateDouble(nPos,fOutNumber);//::dbtools::DBTypeConversion::getStandardDate()
}
catch(Exception&)
{
@@ -686,35 +690,7 @@ sal_Bool ODatabaseExport::createRowSet()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::createRowSet" );
DBG_CHKTHIS(ODatabaseExport,NULL);
- //Reference<XResultSet> xDestSet(m_xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdb.RowSet")),UNO_QUERY);
- //Reference<XPropertySet > xProp(xDestSet,UNO_QUERY);
- //if(xProp.is())
- //{
- // ::rtl::OUString sDestName = ::dbtools::composeTableName(
- // m_xConnection->getMetaData(), m_xTable, ::dbtools::eInDataManipulation, false, false, false );
-
- // xProp->setPropertyValue(PROPERTY_ACTIVE_CONNECTION,makeAny(m_xConnection.getTyped()));
- // xProp->setPropertyValue(PROPERTY_COMMAND_TYPE,makeAny(CommandType::TABLE));
- // xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(sDestName));
- // xProp->setPropertyValue(PROPERTY_IGNORERESULT,::cppu::bool2any(sal_True));
- // xProp->setPropertyValue(PROPERTY_FETCHSIZE,sal_Int32(1));
- // Reference<XRowSet> xRowSet(xProp,UNO_QUERY);
- // xRowSet->execute();
-
- // Reference< XResultSetMetaDataSupplier> xSrcMetaSup(xRowSet,UNO_QUERY_THROW);
- // m_xResultSetMetaData = xSrcMetaSup->getMetaData();
-
- // if ( ::dbtools::canInsert(xProp) )
- // {
- // m_pUpdateHelper.reset(new ORowUpdateHelper(xRowSet));
- // OSL_ENSURE(m_xResultSetMetaData.is(),"No ResultSetMetaData!");
- // TPositions::iterator aIter = m_vColumns.begin();
- // for (;aIter != m_vColumns.end() ; ++aIter)
- // aIter->first = aIter->second;
- // }
- // else
- m_pUpdateHelper.reset(new OParameterUpdateHelper(createPreparedStatment(m_xConnection->getMetaData(),m_xTable,m_vColumns)));
- //}
+ m_pUpdateHelper.reset(new OParameterUpdateHelper(createPreparedStatment(m_xConnection->getMetaData(),m_xTable,m_vColumns)));
return m_pUpdateHelper.get() != NULL;
}
@@ -760,6 +736,7 @@ sal_Bool ODatabaseExport::executeWizard(const ::rtl::OUString& _rTableName,const
m_bIsAutoIncrement = aWizard.shouldCreatePrimaryKey();
m_vColumns = aWizard.GetColumnPositions();
m_vColumnTypes = aWizard.GetColumnTypes();
+ m_bAppendFirstLine = !aWizard.UseHeaderLine();
}
break;
default:
@@ -891,7 +868,8 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
i = 1;
// create the sql string
- for (::std::vector< ::rtl::OUString>::iterator aInsertIter = aInsertList.begin(); aInsertIter != aInsertList.end(); ++aInsertIter)
+ ::std::vector< ::rtl::OUString>::iterator aInsertEnd = aInsertList.end();
+ for (::std::vector< ::rtl::OUString>::iterator aInsertIter = aInsertList.begin(); aInsertIter != aInsertEnd; ++aInsertIter)
{
if ( aInsertIter->getLength() )
{
diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx
index 78d7e6d8f..9e27554d9 100644
--- a/dbaccess/source/ui/misc/RowSetDrop.cxx
+++ b/dbaccess/source/ui/misc/RowSetDrop.cxx
@@ -177,7 +177,8 @@ sal_Bool ORowSetImportExport::insertNewRow()
{
m_xTargetResultSetUpdate->moveToInsertRow();
sal_Int32 i = 1;
- for (::std::vector<sal_Int32>::iterator aIter = m_aColumnMapping.begin(); aIter != m_aColumnMapping.end() ;++aIter,++i )
+ ::std::vector<sal_Int32>::iterator aEnd = m_aColumnMapping.end();
+ for (::std::vector<sal_Int32>::iterator aIter = m_aColumnMapping.begin(); aIter != aEnd ;++aIter,++i )
{
if(*aIter > 0)
{
diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx
index b9dc322bd..94af6b9b5 100644
--- a/dbaccess/source/ui/misc/RtfReader.cxx
+++ b/dbaccess/source/ui/misc/RtfReader.cxx
@@ -163,16 +163,17 @@ void ORTFReader::NextToken( int nToken )
break;
case RTF_TROWD:
{
- sal_uInt32 nTell = rInput.Tell(); // verändert vielleicht die Position des Streams
bool bInsertRow = true;
if ( !m_xTable.is() ) // erste Zeile als Header verwenden
{
+ sal_uInt32 nTell = rInput.Tell(); // verändert vielleicht die Position des Streams
+
m_bError = !CreateTable(nToken);
bInsertRow = m_bAppendFirstLine;
if ( m_bAppendFirstLine )
{
rInput.Seek(nTell);
- bInsertRow = true;
+ rInput.ResetError();
}
}
if ( bInsertRow && !m_bError)
@@ -333,7 +334,7 @@ sal_Bool ORTFReader::CreateTable(int nToken)
break;
}
}
- while((nTmpToken2 = GetNextToken()) != RTF_ROW && eState != SVPAR_ERROR && eState != SVPAR_ACCEPTED);
+ while((nTmpToken2 = GetNextToken()) != RTF_TROWD && eState != SVPAR_ERROR && eState != SVPAR_ACCEPTED);
sal_Bool bOk = !m_vDestVector.empty();
if(bOk)
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index d6bb6c3bf..c2536ea72 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -95,6 +95,7 @@ const static char __FAR_DATA sFontFamily[] = "font-family: ";
const static char __FAR_DATA sFontSize[] = "font-size: ";
#define SBA_FORMAT_SELECTION_COUNT 4
+#define CELL_X 1437
DBG_NAME(ODatabaseImportExport)
//======================================================================
@@ -479,12 +480,9 @@ BOOL ORTFImportExport::Write()
(*m_pStream) << ";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}"
<< ODatabaseImportExport::sNewLine;
- sal_Int32 nCellx = 1437;
::rtl::OString aTRRH("\\trrh-270\\pard\\intbl");
::rtl::OString aFS("\\fs20\\f0\\cf0\\cb2");
- ::rtl::OString aFS2("\\fs20\\f1\\cf0\\cb1");
::rtl::OString aCell1("\\clbrdrl\\brdrs\\brdrcf0\\clbrdrt\\brdrs\\brdrcf0\\clbrdrb\\brdrs\\brdrcf0\\clbrdrr\\brdrs\\brdrcf0\\clshdng10000\\clcfpat2\\cellx");
- ::rtl::OString aCell2("\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx");
(*m_pStream) << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH;
m_pStream->WriteNumber(40);
@@ -508,7 +506,7 @@ BOOL ORTFImportExport::Write()
for( sal_Int32 i=1; i<=nCount; ++i )
{
(*m_pStream) << aCell1;
- m_pStream->WriteNumber(i*nCellx);
+ m_pStream->WriteNumber(i*CELL_X);
(*m_pStream) << ODatabaseImportExport::sNewLine;
}
@@ -572,65 +570,30 @@ BOOL ORTFImportExport::Write()
Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
sal_Int32 k=1;
sal_Int32 kk=0;
- m_xResultSet->beforeFirst(); // set back before the first row
- while(m_xResultSet->next())
+ if(m_aSelection.getLength())
{
- if(!m_pRowMarker || m_pRowMarker[kk] == k)
+ const Any* pSelIter = m_aSelection.getConstArray();
+ const Any* pEnd = pSelIter + m_aSelection.getLength();
+ sal_Bool bContinue = sal_True;
+ for(;pSelIter != pEnd && bContinue;++pSelIter)
{
- ++kk;
- (*m_pStream) << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH;
- m_pStream->WriteNumber(40);
- (*m_pStream) << ODatabaseImportExport::sNewLine;
-
- for ( sal_Int32 i=1; i<=nCount; ++i )
- {
- (*m_pStream) << aCell2;
- m_pStream->WriteNumber(i*nCellx);
- (*m_pStream) << ODatabaseImportExport::sNewLine;
- }
-
- (*m_pStream) << '{';
- (*m_pStream) << aTRRH;
- for ( sal_Int32 i=1; i<=nCount; ++i )
- {
- (*m_pStream) << ODatabaseImportExport::sNewLine;
- (*m_pStream) << '{';
- (*m_pStream) << pHorzChar[i-1];
+ sal_Int32 nPos = -1;
+ *pSelIter >>= nPos;
+ OSL_ENSURE(nPos != -1,"Invalid posiotion!");
+ bContinue = (m_xResultSet->absolute(nPos));
+ if ( bContinue )
+ appendRow(pHorzChar,nCount,k,kk);
- if ( bBold ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_B;
- if ( bItalic ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_I;
- if ( bUnderline ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_UL;
- if ( bStrikeout ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_STRIKE;
-
- (*m_pStream) << aFS2;
- (*m_pStream) << ' ';
-
- try
- {
- Reference<XPropertySet> xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW);
- dbtools::FormattedColumnValue aFormatedValue(aContext,xRowSet,xColumn);
- ::rtl::OUString sValue = aFormatedValue.getFormattedValue();
- // m_xRow->getString(i);
- //if (!m_xRow->wasNull())
- if ( sValue.getLength() )
- RTFOutFuncs::Out_String(*m_pStream,sValue,m_eDestEnc);
- }
- catch (Exception&)
- {
- OSL_ENSURE(0,"RTF WRITE!");
- }
-
- (*m_pStream) << OOO_STRING_SVTOOLS_RTF_CELL;
- (*m_pStream) << '}';
- (*m_pStream) << ODatabaseImportExport::sNewLine;
- (*m_pStream) << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL;
- }
- (*m_pStream) << OOO_STRING_SVTOOLS_RTF_ROW << ODatabaseImportExport::sNewLine;
- (*m_pStream) << '}';
}
- ++k;
+ } // if(m_aSelection.getLength())
+ else
+ {
+ m_xResultSet->beforeFirst(); // set back before the first row
+ while(m_xResultSet->next())
+ {
+ appendRow(pHorzChar,nCount,k,kk);
+ }
}
-
delete [] pHorzChar;
}
@@ -638,6 +601,75 @@ BOOL ORTFImportExport::Write()
(*m_pStream) << (BYTE) 0;
return ((*m_pStream).GetError() == SVSTREAM_OK);
}
+// -----------------------------------------------------------------------------
+void ORTFImportExport::appendRow(::rtl::OString* pHorzChar,sal_Int32 _nColumnCount,sal_Int32& k,sal_Int32& kk)
+{
+ if(!m_pRowMarker || m_pRowMarker[kk] == k)
+ {
+ ++kk;
+ (*m_pStream) << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH;
+ m_pStream->WriteNumber(40);
+ (*m_pStream) << ODatabaseImportExport::sNewLine;
+
+ static const ::rtl::OString aCell2("\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx");
+ static const ::rtl::OString aTRRH("\\trrh-270\\pard\\intbl");
+
+ for ( sal_Int32 i=1; i<=_nColumnCount; ++i )
+ {
+ (*m_pStream) << aCell2;
+ m_pStream->WriteNumber(i*CELL_X);
+ (*m_pStream) << ODatabaseImportExport::sNewLine;
+ }
+
+ const BOOL bBold = ( ::com::sun::star::awt::FontWeight::BOLD == m_aFont.Weight );
+ const BOOL bItalic = ( ::com::sun::star::awt::FontSlant_ITALIC == m_aFont.Slant );
+ const BOOL bUnderline = ( ::com::sun::star::awt::FontUnderline::NONE != m_aFont.Underline );
+ const BOOL bStrikeout = ( ::com::sun::star::awt::FontStrikeout::NONE != m_aFont.Strikeout );
+ static const ::rtl::OString aFS2("\\fs20\\f1\\cf0\\cb1");
+ ::comphelper::ComponentContext aContext(m_xFactory);
+ Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
+
+ (*m_pStream) << '{';
+ (*m_pStream) << aTRRH;
+ for ( sal_Int32 i=1; i <= _nColumnCount; ++i )
+ {
+ (*m_pStream) << ODatabaseImportExport::sNewLine;
+ (*m_pStream) << '{';
+ (*m_pStream) << pHorzChar[i-1];
+
+ if ( bBold ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_B;
+ if ( bItalic ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_I;
+ if ( bUnderline ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_UL;
+ if ( bStrikeout ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_STRIKE;
+
+ (*m_pStream) << aFS2;
+ (*m_pStream) << ' ';
+
+ try
+ {
+ Reference<XPropertySet> xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW);
+ dbtools::FormattedColumnValue aFormatedValue(aContext,xRowSet,xColumn);
+ ::rtl::OUString sValue = aFormatedValue.getFormattedValue();
+ // m_xRow->getString(i);
+ //if (!m_xRow->wasNull())
+ if ( sValue.getLength() )
+ RTFOutFuncs::Out_String(*m_pStream,sValue,m_eDestEnc);
+ }
+ catch (Exception&)
+ {
+ OSL_ENSURE(0,"RTF WRITE!");
+ }
+
+ (*m_pStream) << OOO_STRING_SVTOOLS_RTF_CELL;
+ (*m_pStream) << '}';
+ (*m_pStream) << ODatabaseImportExport::sNewLine;
+ (*m_pStream) << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL;
+ }
+ (*m_pStream) << OOO_STRING_SVTOOLS_RTF_ROW << ODatabaseImportExport::sNewLine;
+ (*m_pStream) << '}';
+ }
+ ++k;
+}
//-------------------------------------------------------------------
BOOL ORTFImportExport::Read()
{
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index fb56431f8..a2a6d4150 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -867,7 +867,8 @@ void fillTypeInfo( const Reference< ::com::sun::star::sdbc::XConnection>& _rxCon
_rTypeInfoIters.reserve(_rTypeInfoMap.size());
OTypeInfoMap::iterator aIter = _rTypeInfoMap.begin();
- for(;aIter != _rTypeInfoMap.end();++aIter)
+ OTypeInfoMap::iterator aEnd = _rTypeInfoMap.end();
+ for(;aIter != aEnd;++aIter)
_rTypeInfoIters.push_back(aIter);
// Close the result set/statement.
diff --git a/dbaccess/source/ui/misc/UpdateHelperImpl.hxx b/dbaccess/source/ui/misc/UpdateHelperImpl.hxx
index d74c6cf74..facd40212 100644
--- a/dbaccess/source/ui/misc/UpdateHelperImpl.hxx
+++ b/dbaccess/source/ui/misc/UpdateHelperImpl.hxx
@@ -60,6 +60,18 @@ namespace dbaui
{
m_xRowUpdate->updateDouble(_nPos, _nValue);
}
+ virtual void updateDate(sal_Int32 _nPos,const ::com::sun::star::util::Date& _nValue)
+ {
+ m_xRowUpdate->updateDate(_nPos, _nValue);
+ }
+ virtual void updateTime(sal_Int32 _nPos,const ::com::sun::star::util::Time& _nValue)
+ {
+ m_xRowUpdate->updateTime(_nPos, _nValue);
+ }
+ virtual void updateTimestamp(sal_Int32 _nPos,const ::com::sun::star::util::DateTime& _nValue)
+ {
+ m_xRowUpdate->updateTimestamp(_nPos, _nValue);
+ }
virtual void updateInt(sal_Int32 _nPos,const sal_Int32& _nValue)
{
m_xRowUpdate->updateInt(_nPos, _nValue);
@@ -100,6 +112,21 @@ namespace dbaui
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateDouble" );
m_xParameters->setDouble(_nPos, _nValue);
}
+ virtual void updateDate(sal_Int32 _nPos,const ::com::sun::star::util::Date& _nValue)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateDouble" );
+ m_xParameters->setDate(_nPos, _nValue);
+ }
+ virtual void updateTime(sal_Int32 _nPos,const ::com::sun::star::util::Time& _nValue)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateDouble" );
+ m_xParameters->setTime(_nPos, _nValue);
+ }
+ virtual void updateTimestamp(sal_Int32 _nPos,const ::com::sun::star::util::DateTime& _nValue)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateDouble" );
+ m_xParameters->setTimestamp(_nPos, _nValue);
+ }
virtual void updateInt(sal_Int32 _nPos,const sal_Int32& _nValue)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateInt" );
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index fa4127b23..a907c331a 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -111,12 +111,14 @@ OCopyTable::OCopyTable( Window * pParent )
,m_aRB_DefData( this, ModuleRes( RB_DEFDATA ) )
,m_aRB_Def( this, ModuleRes( RB_DEF ) )
,m_aRB_View( this, ModuleRes( RB_VIEW ) )
- ,m_aRB_AppendData( this, ModuleRes( RB_APPENDDATA ) )
+ ,m_aRB_AppendData( this, ModuleRes( RB_APPENDDATA ) )
+ ,m_aCB_UseHeaderLine( this, ModuleRes( CB_USEHEADERLINE ) )
,m_aCB_PrimaryColumn( this, ModuleRes( CB_PRIMARY_COLUMN ) )
,m_aFT_KeyName( this, ModuleRes( FT_KEYNAME ) )
,m_edKeyName( this, ModuleRes( ET_KEYNAME ) )
,m_pPage2(NULL)
,m_pPage3(NULL)
+ ,m_bUseHeaderAllowed(TRUE)
{
DBG_CTOR(OCopyTable,NULL);
@@ -127,6 +129,7 @@ OCopyTable::OCopyTable( Window * pParent )
if ( !m_pParent->supportsViews() )
m_aRB_View.Disable();
+ m_aCB_UseHeaderLine.Check(TRUE);
m_bPKeyAllowed = m_pParent->supportsPrimaryKey();
m_aCB_PrimaryColumn.Enable(m_bPKeyAllowed);
@@ -187,6 +190,7 @@ IMPL_LINK( OCopyTable, RadioChangeHdl, Button*, pButton )
m_aFT_KeyName.Enable(bKey && m_aCB_PrimaryColumn.IsChecked());
m_edKeyName.Enable(bKey && m_aCB_PrimaryColumn.IsChecked());
m_aCB_PrimaryColumn.Enable(bKey);
+ m_aCB_UseHeaderLine.Enable(m_bUseHeaderAllowed && IsOptionDefData());
// set typ what to do
if( IsOptionDefData() )
@@ -211,7 +215,8 @@ sal_Bool OCopyTable::LeavePage()
{
DBG_CHKTHIS(OCopyTable,NULL);
m_pParent->m_bCreatePrimaryKeyColumn = (m_bPKeyAllowed && m_aCB_PrimaryColumn.IsEnabled()) ? m_aCB_PrimaryColumn.IsChecked() : sal_False;
- m_pParent->m_aKeyName = m_pParent->m_bCreatePrimaryKeyColumn ? m_edKeyName.GetText() : String();
+ m_pParent->m_aKeyName = m_pParent->m_bCreatePrimaryKeyColumn ? m_edKeyName.GetText() : String();
+ m_pParent->setUseHeaderLine( m_aCB_UseHeaderLine.IsChecked() );
// first check if the table already exists in the database
if( m_pParent->getOperation() != CopyTableOperation::AppendData )
@@ -296,6 +301,7 @@ void OCopyTable::ActivatePage()
m_pParent->GetOKButton().Enable( TRUE );
m_nOldOperation = m_pParent->getOperation();
m_edTableName.GrabFocus();
+ m_aCB_UseHeaderLine.Check(m_pParent->UseHeaderLine());
}
//------------------------------------------------------------------------
String OCopyTable::GetTitle() const
@@ -336,10 +342,11 @@ sal_Bool OCopyTable::checkAppendData()
// #90027#
const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector();
ODatabaseExport::TColumnVector::const_iterator aDestIter = pDestColumns->begin();
+ ODatabaseExport::TColumnVector::const_iterator aDestEnd = pDestColumns->end();
const sal_uInt32 nDestSize = pDestColumns->size();
sal_Bool bNotConvert;
sal_uInt32 i = 0;
- for(sal_Int32 nPos = 1;aDestIter != pDestColumns->end() && i < nDestSize && i < nSrcSize;++aDestIter,++nPos,++i)
+ for(sal_Int32 nPos = 1;aDestIter != aDestEnd && i < nDestSize && i < nSrcSize;++aDestIter,++nPos,++i)
{
bNotConvert = sal_True;
m_pParent->m_vColumnPos[i] = ODatabaseExport::TPositions::value_type(nPos,nPos);
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 186b37eaf..c1c15328b 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -144,8 +144,9 @@ void OWizColumnSelect::Reset()
// insert the source columns in the left listbox
const ODatabaseExport::TColumnVector* pSrcColumns = m_pParent->getSrcVector();
ODatabaseExport::TColumnVector::const_iterator aIter = pSrcColumns->begin();
+ ODatabaseExport::TColumnVector::const_iterator aEnd = pSrcColumns->end();
- for(;aIter != pSrcColumns->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
sal_uInt16 nPos = m_lbOrgColumnNames.InsertEntry((*aIter)->first);
m_lbOrgColumnNames.SetEntryData(nPos,(*aIter)->second);
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index bb734b861..79ac5958e 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -633,6 +633,7 @@ OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rD
bAllowViews = false;
OCopyTable* pPage1( new OCopyTable( this ) );
+ pPage1->disallowUseHeaderLine();
if ( !bAllowViews )
pPage1->disallowViews();
pPage1->setCreateStyleAction();
@@ -831,7 +832,8 @@ sal_Bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos)
if ( bContainsColumns )
{ // we have dest columns so look for the matching column
ODatabaseExport::TColumnVector::const_iterator aSrcIter = m_vSourceVec.begin();
- for(;aSrcIter != m_vSourceVec.end();++aSrcIter)
+ ODatabaseExport::TColumnVector::const_iterator aSrcEnd = m_vSourceVec.end();
+ for(;aSrcIter != aSrcEnd;++aSrcIter)
{
ODatabaseExport::TColumns::iterator aDestIter = m_vDestColumns.find(m_mNameMapping[(*aSrcIter)->first]);
@@ -856,7 +858,8 @@ sal_Bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos)
sal_Int32 nMaxNameLen = getMaxColumnNameLength();
ODatabaseExport::TColumnVector::const_iterator aSrcIter = m_vSourceVec.begin();
- for(_rnBreakPos=0;aSrcIter != m_vSourceVec.end() && bRet ;++aSrcIter,++_rnBreakPos)
+ ODatabaseExport::TColumnVector::const_iterator aSrcEnd = m_vSourceVec.end();
+ for(_rnBreakPos=0;aSrcIter != aSrcEnd && bRet ;++aSrcIter,++_rnBreakPos)
{
OFieldDescription* pField = new OFieldDescription(*(*aSrcIter)->second);
pField->SetName(convertColumnName(TExportColumnFindFunctor(&m_vDestColumns),(*aSrcIter)->first,sExtraChars,nMaxNameLen));
@@ -1096,7 +1099,8 @@ void OCopyTableWizard::impl_loadSourceData()
void OCopyTableWizard::loadData( const ICopyTableSourceObject& _rSourceObject, ODatabaseExport::TColumns& _rColumns, ODatabaseExport::TColumnVector& _rColVector )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::loadData" );
- for ( ODatabaseExport::TColumns::iterator col = _rColumns.begin(); col != _rColumns.end(); ++col )
+ ODatabaseExport::TColumns::iterator colEnd = _rColumns.end();
+ for ( ODatabaseExport::TColumns::iterator col = _rColumns.begin(); col != colEnd; ++col )
delete col->second;
_rColVector.clear();
@@ -1176,7 +1180,8 @@ void OCopyTableWizard::appendColumns( Reference<XColumnsSupplier>& _rxColSup, co
OSL_ENSURE(xAppend.is(),"No XAppend Interface!");
ODatabaseExport::TColumnVector::const_iterator aIter = _pVec->begin();
- for(;aIter != _pVec->end();++aIter)
+ ODatabaseExport::TColumnVector::const_iterator aEnd = _pVec->end();
+ for(;aIter != aEnd;++aIter)
{
OFieldDescription* pField = (*aIter)->second;
if(!pField)
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index e2f44f070..703ec3ec8 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -187,9 +187,10 @@ sal_Bool OWizNameMatching::LeavePage()
DBG_ASSERT(pSrcField,"OWizNameMatching: OColumn can not be null!");
ODatabaseExport::TColumnVector::const_iterator aSrcIter = pSrcColumns->begin();
- for(;aSrcIter != pSrcColumns->end() && (*aSrcIter)->second != pSrcField;++aSrcIter)
+ ODatabaseExport::TColumnVector::const_iterator aSrcEnd = pSrcColumns->end();
+ for(;aSrcIter != aSrcEnd && (*aSrcIter)->second != pSrcField;++aSrcIter)
;
- sal_Int32 nPos = ::std::distance(pSrcColumns->begin(),aSrcIter);
+ const sal_Int32 nPos = ::std::distance(pSrcColumns->begin(),aSrcIter);
// sal_Int32 nPos = m_CTRL_LEFT.GetModel()->GetAbsPos(pLeftEntry);
if(m_CTRL_LEFT.GetCheckButtonState(pLeftEntry) == SV_BUTTON_CHECKED)
@@ -198,8 +199,9 @@ sal_Bool OWizNameMatching::LeavePage()
DBG_ASSERT(pDestField,"OWizNameMatching: OColumn can not be null!");
const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector();
ODatabaseExport::TColumnVector::const_iterator aDestIter = pDestColumns->begin();
+ ODatabaseExport::TColumnVector::const_iterator aDestEnd = pDestColumns->end();
- for(;aDestIter != pDestColumns->end() && (*aDestIter)->second != pDestField;++aDestIter)
+ for(;aDestIter != aDestEnd && (*aDestIter)->second != pDestField;++aDestIter)
;
OSL_ENSURE((nPos) < static_cast<sal_Int32>(m_pParent->m_vColumnPos.size()),"m_pParent->m_vColumnPos: Illegal index for vector");
@@ -435,7 +437,8 @@ void OColumnTreeBox::FillListBox( const ODatabaseExport::TColumnVector& _rList)
{
Clear();
ODatabaseExport::TColumnVector::const_iterator aIter = _rList.begin();
- for(;aIter != _rList.end();++aIter)
+ ODatabaseExport::TColumnVector::const_iterator aEnd = _rList.end();
+ for(;aIter != aEnd;++aIter)
{
SvLBoxEntry* pEntry = InsertEntry((*aIter)->first,0,sal_False,LIST_APPEND,(*aIter)->second);
SvButtonState eState = !(m_bReadOnly && (*aIter)->second->IsAutoIncrement()) ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED;
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 984a2f03d..45cf651ac 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -339,7 +339,8 @@ void OWizTypeSelect::Reset()
const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector();
ODatabaseExport::TColumnVector::const_iterator aIter = pDestColumns->begin();
- for(;aIter != pDestColumns->end();++aIter)
+ ODatabaseExport::TColumnVector::const_iterator aEnd = pDestColumns->end();
+ for(;aIter != aEnd;++aIter)
{
sal_uInt16 nPos;
if((*aIter)->second->IsPrimaryKey())
diff --git a/dbaccess/source/ui/misc/WizardPages.hrc b/dbaccess/source/ui/misc/WizardPages.hrc
index 94df8d8fc..774999dfb 100644
--- a/dbaccess/source/ui/misc/WizardPages.hrc
+++ b/dbaccess/source/ui/misc/WizardPages.hrc
@@ -72,6 +72,7 @@
#define RB_VIEW 3
#define RB_APPENDDATA 4
#define CB_PRIMARY_COLUMN 5
+#define CB_USEHEADERLINE 6
#define CONTROL_CONTAINER 1
// controls
diff --git a/dbaccess/source/ui/misc/WizardPages.src b/dbaccess/source/ui/misc/WizardPages.src
index c7c511c3b..dbcfeee92 100644
--- a/dbaccess/source/ui/misc/WizardPages.src
+++ b/dbaccess/source/ui/misc/WizardPages.src
@@ -48,16 +48,6 @@
#define BUTTON_SIZE_X 50
#define BUTTON_SIZE_Y 14
-String STR_HTML_TITLE
-{
- Text [ en-US ] = "Copy HTML table" ;
-};
-
-String STR_RTF_TITLE
-{
- Text [ en-US ] = "Copy RTF table" ;
-};
-
String STR_WIZ_COLUMN_SELECT_TITEL
{
Text [ en-US ] = "Apply columns";
@@ -523,22 +513,29 @@ TabPage TAB_WIZ_COPYTABLE
Text [ en-US ] = "Append ~data" ;
};
- CheckBox CB_PRIMARY_COLUMN
+ CheckBox CB_USEHEADERLINE
{
Pos = MAP_APPFONT ( 12, 93 ) ;
+ Size = MAP_APPFONT ( WINDOW_SIZE_X - 18, 10 ) ;
+ Text [ en-US ] = "Use first ~line as column names" ;
+ };
+
+ CheckBox CB_PRIMARY_COLUMN
+ {
+ Pos = MAP_APPFONT ( 12, 107 ) ;
Size = MAP_APPFONT ( 90 , 10 ) ;
Text [ en-US ] = "Crea~te primary key";
};
FixedText FT_KEYNAME
{
- Pos = MAP_APPFONT ( 21 , 108 ) ;
+ Pos = MAP_APPFONT ( 21 , 122 ) ;
Size = MAP_APPFONT ( 39 , 8 ) ;
Text [ en-US ] = "Name";
};
Edit ET_KEYNAME
{
- Pos = MAP_APPFONT ( 80, 106 ) ;
+ Pos = MAP_APPFONT ( 80, 120 ) ;
Size = MAP_APPFONT ( 65 , 12 ) ;
TabStop = TRUE ;
Border = TRUE ;
diff --git a/dbaccess/source/ui/misc/dbumiscres.src b/dbaccess/source/ui/misc/dbumiscres.src
index 3258c8375..c8f8ac710 100644
--- a/dbaccess/source/ui/misc/dbumiscres.src
+++ b/dbaccess/source/ui/misc/dbumiscres.src
@@ -96,4 +96,8 @@ String STR_NAMED_OBJECT_ALREADY_EXISTS
{
Text [ en-US ] = "The name '$#$' already exists.\nPlease enter another name." ;
};
-
+String RID_STR_EXTENSION_NOT_PRESENT
+{
+ // #i96130# use hard coded name
+ Text [ en-US ] = "The report, \"$file$\", requires the extension Sun™ Report Builder.";
+};
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index 4f100aa22..847bc8799 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -29,7 +29,9 @@
************************************************************************/
#include "dsmeta.hxx"
-
+#include <connectivity/DriversConfig.hxx>
+#include "dsntypes.hxx"
+#include <comphelper/processfactory.hxx>
/** === begin UNO includes === **/
/** === end UNO includes === **/
@@ -41,34 +43,12 @@ namespace dbaui
//........................................................................
/** === begin UNO using === **/
+ using namespace dbaccess;
+ using namespace ::com::sun::star;
/** === end UNO using === **/
struct InitAdvanced : public AdvancedSettingsSupport
{
- // strange ctor, but makes instantiating this class more readable (see below)
- InitAdvanced( short _Generated, short _SQL, short _Append, short _As, short _Outer, short _Priv, short _Param,
- short _Version, short _Catalog, short _Schema, short _Index, short _DOS, short _Required, short _Bool,short _IgnoreCur,short _AutoPKey, short _EscapeDT )
- :AdvancedSettingsSupport()
- {
- bGeneratedValues = ( _Generated != 0 );
- bUseSQL92NamingConstraints = ( _SQL != 0 );
- bAppendTableAliasInSelect = ( _Append != 0 );
- bUseKeywordAsBeforeAlias = ( _As != 0 );
- bUseBracketedOuterJoinSyntax = ( _Outer != 0 );
- bIgnoreDriverPrivileges = ( _Priv != 0 );
- bParameterNameSubstitution = ( _Param != 0 );
- bDisplayVersionColumns = ( _Version != 0 );
- bUseCatalogInSelect = ( _Catalog != 0 );
- bUseSchemaInSelect = ( _Schema != 0 );
- bUseIndexDirectionKeyword = ( _Index != 0 );
- bUseDOSLineEnds = ( _DOS != 0 );
- bBooleanComparisonMode = ( _Bool != 0 );
- bFormsCheckRequiredFields = ( _Required != 0 );
- bIgnoreCurrency = ( _IgnoreCur != 0 );
- bAutoIncrementIsPrimaryKey = ( _AutoPKey != 0 );
- bEscapeDateTime = ( _EscapeDT != 0 );
- }
-
enum Special { All, AllButIgnoreCurrency, None };
InitAdvanced( Special _eType )
@@ -89,7 +69,6 @@ namespace dbaui
bBooleanComparisonMode = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
bFormsCheckRequiredFields = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
bIgnoreCurrency = ( _eType == All );
- bAutoIncrementIsPrimaryKey = false; // hsqldb special
bEscapeDateTime = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
}
};
@@ -114,95 +93,125 @@ namespace dbaui
//= global tables
//====================================================================
//--------------------------------------------------------------------
- static const AdvancedSettingsSupport& getAdvancedSettingsSupport( ::dbaccess::DATASOURCE_TYPE _eType )
+ static const AdvancedSettingsSupport& getAdvancedSettingsSupport( const ::rtl::OUString& _sURL )
{
- typedef ::std::map< ::dbaccess::DATASOURCE_TYPE, AdvancedSettingsSupport > AdvancedSupport;
-
+ DECLARE_STL_USTRINGACCESS_MAP( AdvancedSettingsSupport, AdvancedSupport);
static AdvancedSupport s_aSupport;
if ( s_aSupport.empty() )
{
- s_aSupport[ ::dbaccess::DST_MSACCESS ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_MYSQL_ODBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_MYSQL_JDBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1 );
- s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = InitAdvanced( 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_ORACLE_JDBC ] = InitAdvanced( InitAdvanced::All );
- s_aSupport[ ::dbaccess::DST_ADABAS ] = InitAdvanced( 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_CALC ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_DBASE ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_FLAT ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_JDBC ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_ODBC ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_ADO ] = InitAdvanced( 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_MOZILLA ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_THUNDERBIRD ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_LDAP ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_OUTLOOK ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_OUTLOOKEXP ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_EVOLUTION ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_EVOLUTION_GROUPWISE ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_EVOLUTION_LDAP ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_KAB ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_MACAB ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_MSACCESS_2007 ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_EMBEDDED_HSQLDB ] = InitAdvanced( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 );
- s_aSupport[ ::dbaccess::DST_USERDEFINE1 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE2 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE3 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE4 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE5 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE6 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE7 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE8 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE9 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE10 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- }
- return s_aSupport[ _eType ];
+ ::connectivity::DriversConfig aDriverConfig(::comphelper::getProcessServiceFactory());
+ const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+ const ::rtl::OUString* pIter = aURLs.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ InitAdvanced aInit(InitAdvanced::None);
+ const uno::Sequence< beans::NamedValue> aProperties = aDriverConfig.getFeatures(*pIter).getNamedValues();
+ const beans::NamedValue* pPropertiesIter = aProperties.getConstArray();
+ const beans::NamedValue* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
+ for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ {
+ if ( pPropertiesIter->Name.equalsAscii("GeneratedValues") )
+ {
+ pPropertiesIter->Value >>= aInit.bGeneratedValues;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseSQL92NamingConstraints") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseSQL92NamingConstraints;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("AppendTableAliasInSelect") )
+ {
+ pPropertiesIter->Value >>= aInit.bAppendTableAliasInSelect;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseKeywordAsBeforeAlias") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseKeywordAsBeforeAlias;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseBracketedOuterJoinSyntax") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseBracketedOuterJoinSyntax;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("IgnoreDriverPrivileges") )
+ {
+ pPropertiesIter->Value >>= aInit.bIgnoreDriverPrivileges;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("ParameterNameSubstitution") )
+ {
+ pPropertiesIter->Value >>= aInit.bParameterNameSubstitution;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("DisplayVersionColumns") )
+ {
+ pPropertiesIter->Value >>= aInit.bDisplayVersionColumns;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseCatalogInSelect") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseCatalogInSelect;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseSchemaInSelect") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseSchemaInSelect;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseIndexDirectionKeyword") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseIndexDirectionKeyword;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseDOSLineEnds") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseDOSLineEnds;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("BooleanComparisonMode") )
+ {
+ pPropertiesIter->Value >>= aInit.bBooleanComparisonMode;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("FormsCheckRequiredFields") )
+ {
+ pPropertiesIter->Value >>= aInit.bFormsCheckRequiredFields;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("IgnoreCurrency") )
+ {
+ pPropertiesIter->Value >>= aInit.bIgnoreCurrency;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("EscapeDateTime") )
+ {
+ pPropertiesIter->Value >>= aInit.bEscapeDateTime;
+ }
+ } // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ s_aSupport.insert(AdvancedSupport::value_type(*pIter,aInit));
+ }
+ } // if ( s_aSupport.empty() )
+ OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
+ return s_aSupport[ _sURL ];
}
//--------------------------------------------------------------------
- static AuthenticationMode getAuthenticationMode( ::dbaccess::DATASOURCE_TYPE _eType )
+ static AuthenticationMode getAuthenticationMode( const ::rtl::OUString& _sURL )
{
- typedef ::std::map< ::dbaccess::DATASOURCE_TYPE, FeatureSupport > Supported;
-
+ DECLARE_STL_USTRINGACCESS_MAP( FeatureSupport, Supported);
static Supported s_aSupport;
if ( s_aSupport.empty() )
{
- s_aSupport[ ::dbaccess::DST_MSACCESS ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_MYSQL_ODBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_MYSQL_JDBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_ORACLE_JDBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_ADABAS ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_CALC ] = FeatureSupport( AuthPwd );
- s_aSupport[ ::dbaccess::DST_DBASE ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_FLAT ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_JDBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_ODBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_ADO ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_MOZILLA ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_THUNDERBIRD ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_LDAP ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_OUTLOOK ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_OUTLOOKEXP ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_EVOLUTION ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_EVOLUTION_GROUPWISE ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_EVOLUTION_LDAP ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_KAB ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_MACAB ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_MSACCESS_2007 ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_EMBEDDED_HSQLDB ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_USERDEFINE1 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE2 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE3 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE4 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE5 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE6 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE7 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE8 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE9 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE10 ] = FeatureSupport( AuthUserPwd );
- }
- return s_aSupport[ _eType ].eAuthentication;
+ ::connectivity::DriversConfig aDriverConfig(::comphelper::getProcessServiceFactory());
+ const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+ const ::rtl::OUString* pIter = aURLs.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ FeatureSupport aInit( AuthNone );
+ const ::comphelper::NamedValueCollection& aMetaData = aDriverConfig.getMetaData(*pIter);
+ if ( aMetaData.has("Authentication") )
+ {
+ ::rtl::OUString sAuth;
+ aMetaData.get("Authentication") >>= sAuth;
+ if ( sAuth.equalsAscii("UserPassword") )
+ aInit = AuthUserPwd;
+ else if ( sAuth.equalsAscii("Password") )
+ aInit = AuthPwd;
+ }
+ s_aSupport.insert(Supported::value_type(*pIter,aInit));
+ } // for(;pIter != pEnd;++pIter)
+ } // if ( s_aSupport.empty() )
+ OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
+ return s_aSupport[ _sURL ].eAuthentication;
}
//====================================================================
@@ -211,17 +220,17 @@ namespace dbaui
class DataSourceMetaData_Impl
{
public:
- DataSourceMetaData_Impl( ::dbaccess::DATASOURCE_TYPE _eType );
+ DataSourceMetaData_Impl( const ::rtl::OUString& _sURL );
- inline ::dbaccess::DATASOURCE_TYPE getType() const { return m_eType; }
+ inline ::rtl::OUString getType() const { return m_sURL; }
private:
- ::dbaccess::DATASOURCE_TYPE m_eType;
+ const ::rtl::OUString m_sURL;
};
//--------------------------------------------------------------------
- DataSourceMetaData_Impl::DataSourceMetaData_Impl( ::dbaccess::DATASOURCE_TYPE _eType )
- :m_eType( _eType )
+ DataSourceMetaData_Impl::DataSourceMetaData_Impl( const ::rtl::OUString& _sURL )
+ :m_sURL( _sURL )
{
}
@@ -229,8 +238,8 @@ namespace dbaui
//= DataSourceMetaData
//====================================================================
//--------------------------------------------------------------------
- DataSourceMetaData::DataSourceMetaData( ::dbaccess::DATASOURCE_TYPE _eType )
- :m_pImpl( new DataSourceMetaData_Impl( _eType ) )
+ DataSourceMetaData::DataSourceMetaData( const ::rtl::OUString& _sURL )
+ :m_pImpl( new DataSourceMetaData_Impl( _sURL ) )
{
}
@@ -252,9 +261,9 @@ namespace dbaui
}
//--------------------------------------------------------------------
- AuthenticationMode DataSourceMetaData::getAuthentication( ::dbaccess::DATASOURCE_TYPE _eType )
+ AuthenticationMode DataSourceMetaData::getAuthentication( const ::rtl::OUString& _sURL )
{
- return getAuthenticationMode( _eType );
+ return getAuthenticationMode( _sURL );
}
//........................................................................
diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx
index befe0216d..1770a10fa 100644
--- a/dbaccess/source/ui/misc/indexcollection.cxx
+++ b/dbaccess/source/ui/misc/indexcollection.cxx
@@ -119,7 +119,8 @@ namespace dbaui
// loop'n'compare
Indexes::const_iterator aSearch = m_aIndexes.begin();
- for (; aSearch != m_aIndexes.end(); ++aSearch)
+ Indexes::const_iterator aEnd = m_aIndexes.end();
+ for (; aSearch != aEnd; ++aSearch)
if (aSearch->sName == sNameCompare)
break;
@@ -133,7 +134,8 @@ namespace dbaui
// loop'n'compare
Indexes::iterator aSearch = m_aIndexes.begin();
- for (; aSearch != m_aIndexes.end(); ++aSearch)
+ Indexes::iterator aEnd = m_aIndexes.end();
+ for (; aSearch != aEnd; ++aSearch)
if (aSearch->sName == sNameCompare)
break;
@@ -147,7 +149,8 @@ namespace dbaui
// loop'n'compare
Indexes::const_iterator aSearch = m_aIndexes.begin();
- for (; aSearch != m_aIndexes.end(); ++aSearch)
+ Indexes::const_iterator aEnd = m_aIndexes.end();
+ for (; aSearch != aEnd; ++aSearch)
if (aSearch->getOriginalName() == sNameCompare)
break;
@@ -161,7 +164,8 @@ namespace dbaui
// loop'n'compare
Indexes::iterator aSearch = m_aIndexes.begin();
- for (; aSearch != m_aIndexes.end(); ++aSearch)
+ Indexes::iterator aEnd = m_aIndexes.end();
+ for (; aSearch != aEnd; ++aSearch)
if (aSearch->getOriginalName() == sNameCompare)
break;
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 4d4905f80..5906492a8 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -140,7 +140,6 @@
#include <connectivity/dbtools.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/io/WrongFormatException.hpp>
-#include "ExtensionNotPresent.hxx"
#include "com/sun/star/sdb/RowSetVetoException.hpp"
//......................................................................
@@ -455,7 +454,7 @@ namespace dbaui
// more like a hack, insert an empty message
String sText( ModuleRes( RID_STR_EXTENSION_NOT_PRESENT ) );
- sText = sText.GetToken(0,'\n');
+ sText.SearchAndReplaceAscii("$file$",_rLinkName);
aInfo.prepend(sText);
String sMessage = String(ModuleRes(STR_COULDNOTOPEN_LINKEDDOC));
diff --git a/dbaccess/source/ui/misc/uiservices.cxx b/dbaccess/source/ui/misc/uiservices.cxx
index d2b96f5a2..cd179a2fa 100644
--- a/dbaccess/source/ui/misc/uiservices.cxx
+++ b/dbaccess/source/ui/misc/uiservices.cxx
@@ -74,7 +74,6 @@ extern "C" void SAL_CALL createRegistryInfo_OAdvancedSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialog();
extern "C" void SAL_CALL createRegistryInfo_OUserSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialogSetup();
-extern "C" void SAL_CALL createRegistryInfo_OAdabasSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel();
extern "C" void SAL_CALL createRegistryInfo_OColumnControl();
extern "C" void SAL_CALL createRegistryInfo_OToolboxController();
@@ -107,7 +106,6 @@ extern "C" void SAL_CALL createRegistryInfo_DBU()
createRegistryInfo_ODBTypeWizDialog();
createRegistryInfo_ODBTypeWizDialogSetup();
createRegistryInfo_OUserSettingsDialog();
- createRegistryInfo_OAdabasSettingsDialog();
createRegistryInfo_OColumnControlModel();
createRegistryInfo_OColumnControl();
createRegistryInfo_OToolboxController();
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index 467a9b2dc..95031ec06 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
@@ -129,9 +129,10 @@ namespace dbaui
nIndex = m_pLine->GetParent()->GetTabWinMap()->size();
const ::std::vector<OTableConnection*>* pVec = m_pLine->GetParent()->getTableConnections();
::std::vector<OTableConnection*>::const_iterator aIter = pVec->begin();
- for (; aIter != pVec->end() && (*aIter) != m_pLine; ++nIndex,++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pVec->end();
+ for (; aIter != aEnd && (*aIter) != m_pLine; ++nIndex,++aIter)
;
- nIndex = ( aIter != pVec->end() ) ? nIndex : -1;
+ nIndex = ( aIter != aEnd ) ? nIndex : -1;
}
return nIndex;
}
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index 187950c0a..77c9c04a2 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -419,7 +419,8 @@ void OJoinController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabW
"OJoinController::SaveTabWinsPosSize : inkonsistenter Zustand : sollte genausviel TabWinDatas haben wie TabWins !");
OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->begin();
- for(;aIter != pTabWinList->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pTabWinList->end();
+ for(;aIter != aEnd;++aIter)
SaveTabWinPosSize(aIter->second, nOffsetX, nOffsetY);
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx
index d75cfde69..b7b9c3558 100644
--- a/dbaccess/source/ui/querydesign/JoinExchange.cxx
+++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx
@@ -92,8 +92,9 @@ namespace dbaui
//------------------------------------------------------------------------
sal_Bool OJoinExchObj::isFormatAvailable( const DataFlavorExVector& _rFormats ,SotFormatStringId _nSlotID)
{
+ DataFlavorExVector::const_iterator aCheckEnd = _rFormats.end();
for ( DataFlavorExVector::const_iterator aCheck = _rFormats.begin();
- aCheck != _rFormats.end();
+ aCheck != aCheckEnd;
++aCheck
)
{
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index ac95ca4e7..948a3d0d4 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -102,6 +102,7 @@
#endif
#include <cppuhelper/exc_hlp.hxx>
#include <tools/diagnose_ex.h>
+#include <boost/bind.hpp>
#include <algorithm>
#include <functional>
@@ -291,7 +292,8 @@ void OJoinTableView::Resize()
return;
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
OTableWindow* pCurrent = aIter->second;
Point aPos(pCurrent->GetData()->GetPosition() - GetScrollOffset());
@@ -631,7 +633,8 @@ void OJoinTableView::SetDefaultTabWinPosSize( OTableWindow* pTabWin )
// Belegte Bereiche dieser Zeile pruefen
OTableWindow* pOtherTabWin;// = GetTabWinMap()->First();
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
pOtherTabWin = aIter->second;
Rectangle aOtherTabWinRect( pOtherTabWin->GetPosPixel(), pOtherTabWin->GetSizePixel() );
@@ -814,7 +817,8 @@ BOOL OJoinTableView::ScrollPane( long nDelta, BOOL bHoriz, BOOL bPaintScrollBars
Point aPos;
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
pTabWin = aIter->second;
aPos = pTabWin->GetPosPixel();
@@ -954,7 +958,8 @@ void OJoinTableView::MouseButtonUp( const MouseEvent& rEvt )
DeselectConn(GetSelectedConn());
::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
{
if( (*aIter)->CheckHit(rEvt.GetPosPixel()) )
{
@@ -1085,9 +1090,7 @@ void OJoinTableView::DrawConnections( const Rectangle& rRect )
DBG_CHKTHIS(OJoinTableView,NULL);
//////////////////////////////////////////////////////////////////////
// Die Joins zeichnen
- ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
- (*aIter)->Draw( rRect );
+ ::std::for_each(m_vTableConnection.begin(),m_vTableConnection.end(),boost::bind( &OTableConnection::Draw, _1, boost::cref( rRect )));
// zum Schluss noch mal die selektierte ueber alle anderen drueber
if (GetSelectedConn())
GetSelectedConn()->Draw( rRect );
@@ -1124,7 +1127,8 @@ void OJoinTableView::ClearAll()
// und das selbe mit den Connections
::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
RemoveConnection( *aIter ,sal_True);
m_vTableConnection.clear();
@@ -1325,7 +1329,8 @@ void OJoinTableView::Command(const CommandEvent& rEvt)
const Point& aMousePos = rEvt.GetMousePosPixel();
::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
{
if( (*aIter)->CheckHit(aMousePos) )
{
@@ -1355,7 +1360,8 @@ OTableConnection* OJoinTableView::GetTabConn(const OTableWindow* pLhs,const OTab
BOOL bFoundStart = _rpFirstAfter ? FALSE : TRUE;
::std::vector<OTableConnection*>::const_iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
{
OTableConnection* pData = *aIter;
@@ -1437,7 +1443,8 @@ long OJoinTableView::PreNotify(NotifyEvent& rNEvt)
BOOL bForward = !pKeyEvent->GetKeyCode().IsShift();
// is there an active tab win ?
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
if (aIter->second && aIter->second->HasChildPathFocus())
break;
@@ -1569,7 +1576,8 @@ long OJoinTableView::PreNotify(NotifyEvent& rNEvt)
if (pSearchFor)
{
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
if (aIter->second == pSearchFor)
{
@@ -1622,7 +1630,8 @@ void OJoinTableView::StateChanged( StateChangedType nType )
SetZoomedPointFont( aFont );
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
aIter->second->SetZoom(GetZoom());
Size aSize(CalcZoom(aIter->second->GetSizePixel().Width()),CalcZoom(aIter->second->GetSizePixel().Height()));
@@ -1643,7 +1652,8 @@ void OJoinTableView::HideTabWins()
// working on a copy because the real list will be cleared in inner calls
OTableWindowMap aCopy(*pTabWins);
OTableWindowMap::iterator aIter = aCopy.begin();
- for(;aIter != aCopy.end();++aIter)
+ OTableWindowMap::iterator aEnd = aCopy.end();
+ for(;aIter != aEnd;++aIter)
RemoveTabWin(aIter->second);
}
@@ -1690,7 +1700,8 @@ void OJoinTableView::clearLayoutInformation()
m_aTableMap.clear();
::std::vector<OTableConnection*>::const_iterator aIter2 = m_vTableConnection.begin();
- for(;aIter2 != m_vTableConnection.end();++aIter2)
+ ::std::vector<OTableConnection*>::const_iterator aEnd2 = m_vTableConnection.end();
+ for(;aIter2 != aEnd2;++aIter2)
delete *aIter2;
m_vTableConnection.clear();
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index badcf1c16..2c926e9af 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -464,34 +464,36 @@ namespace
OConnectionLineDataVec* pLineDataList,
OQueryTableConnectionData* pData)
{
- ::rtl::OUString aCondition;
- if ( !_xConnection.is() )
- return aCondition;
-
- OConnectionLineDataVec::iterator aIter = pLineDataList->begin();
- try
+ ::rtl::OUStringBuffer aCondition;
+ if ( _xConnection.is() )
{
- Reference< XDatabaseMetaData > xMetaData = _xConnection->getMetaData();
- ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
+ OConnectionLineDataVec::iterator aIter = pLineDataList->begin();
+ OConnectionLineDataVec::iterator aEnd = pLineDataList->end();
+ try
+ {
+ const Reference< XDatabaseMetaData > xMetaData = _xConnection->getMetaData();
+ const ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
+ const ::rtl::OUString sEqual(RTL_CONSTASCII_USTRINGPARAM(" = "));
- for(;aIter != pLineDataList->end();++aIter)
+ for(;aIter != aEnd;++aIter)
+ {
+ OConnectionLineDataRef pLineData = *aIter;
+ if(aCondition.getLength())
+ aCondition.append(C_AND);
+ aCondition.append(quoteTableAlias(sal_True,pData->GetAliasName(JTCS_FROM),aQuote));
+ aCondition.append(::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_FROM) ));
+ aCondition.append(sEqual);
+ aCondition.append(quoteTableAlias(sal_True,pData->GetAliasName(JTCS_TO),aQuote));
+ aCondition.append(::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_TO) ));
+ }
+ }
+ catch(SQLException&)
{
- OConnectionLineDataRef pLineData = *aIter;
- if(aCondition.getLength())
- aCondition += C_AND;
- aCondition += quoteTableAlias(sal_True,pData->GetAliasName(JTCS_FROM),aQuote);
- aCondition += ::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_FROM) );
- aCondition += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = "));
- aCondition += quoteTableAlias(sal_True,pData->GetAliasName(JTCS_TO),aQuote);
- aCondition += ::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_TO) );
+ OSL_ASSERT(!"Failure while building Join criteria!");
}
}
- catch(SQLException&)
- {
- OSL_ASSERT(!"Failure while building Join criteria!");
- }
- return aCondition;
+ return aCondition.makeStringAndClear();
}
//------------------------------------------------------------------------------
/** JoinCycle looks for a join cycle and append it to the string
@@ -657,7 +659,8 @@ namespace
// first search for the "to" window
const ::std::vector<OTableConnection*>* pConnections = pEntryConn->GetParent()->getTableConnections();
::std::vector<OTableConnection*>::const_iterator aIter = pConnections->begin();
- for(;aIter != pConnections->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pConnections->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(*aIter);
if(!pNext->IsVisited() && (pNext->GetSourceWin() == pEntryTabTo || pNext->GetDestWin() == pEntryTabTo))
@@ -671,11 +674,11 @@ namespace
}
// when nothing found found look for the "from" window
- if(aIter == pConnections->end())
+ if(aIter == aEnd)
{
OQueryTableWindow* pEntryTabFrom = static_cast<OQueryTableWindow*>(pEntryConn->GetSourceWin());
aIter = pConnections->begin();
- for(;aIter != pConnections->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(*aIter);
if(!pNext->IsVisited() && (pNext->GetSourceWin() == pEntryTabFrom || pNext->GetDestWin() == pEntryTabFrom))
@@ -746,12 +749,17 @@ namespace
OTableFields& _rFieldList,
sal_Bool bAlias)
{
- ::rtl::OUString aTmpStr,aFieldListStr;
+ Reference< XConnection> xConnection = static_cast<OQueryController&>(_pView->getController()).getConnection();
+ if ( !xConnection.is() )
+ return ::rtl::OUString();
+
+ ::rtl::OUStringBuffer aTmpStr,aFieldListStr;
sal_Bool bAsterix = sal_False;
int nVis = 0;
OTableFields::iterator aIter = _rFieldList.begin();
- for(;aIter != _rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = _rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
if ( pEntryField->IsVisible() )
@@ -764,31 +772,28 @@ namespace
if(nVis == 1)
bAsterix = sal_False;
- Reference< XConnection> xConnection = static_cast<OQueryController&>(_pView->getController()).getConnection();
- if(!xConnection.is())
- return aFieldListStr;
-
try
{
- Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
- ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
+ const Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ const ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
OJoinTableView::OTableWindowMap* pTabList = _pView->getTableView()->GetTabWinMap();
const static ::rtl::OUString sFieldSeparator(RTL_CONSTASCII_USTRINGPARAM(", "));
+ const static ::rtl::OUString s_sAs(RTL_CONSTASCII_USTRINGPARAM(" AS "));
aIter = _rFieldList.begin();
- for(;aIter != _rFieldList.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
::rtl::OUString rFieldName = pEntryField->GetField();
if ( rFieldName.getLength() && pEntryField->IsVisible() )
{
aTmpStr = ::rtl::OUString();
- ::rtl::OUString rAlias = pEntryField->GetAlias();
- ::rtl::OUString rFieldAlias = pEntryField->GetFieldAlias();
+ const ::rtl::OUString rAlias = pEntryField->GetAlias();
+ const ::rtl::OUString rFieldAlias = pEntryField->GetFieldAlias();
- aTmpStr += quoteTableAlias((bAlias || bAsterix),rAlias,aQuote);
+ aTmpStr.append(quoteTableAlias((bAlias || bAsterix),rAlias,aQuote));
// if we have a none numeric field, the table alias could be in the name
// otherwise we are not allowed to do this (e.g. 0.1 * PRICE )
@@ -798,8 +803,9 @@ namespace
String sTemp = rFieldName;
OTableFieldDescRef aInfo = new OTableFieldDesc();
OJoinTableView::OTableWindowMap::iterator tableIter = pTabList->begin();
+ OJoinTableView::OTableWindowMap::iterator tableEnd = pTabList->end();
sal_Bool bFound = sal_False;
- for(;!bFound && tableIter != pTabList->end() ;++tableIter)
+ for(;!bFound && tableIter != tableEnd ;++tableIter)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(tableIter->second);
@@ -810,21 +816,21 @@ namespace
if ( ( rFieldName.toChar() != '*' ) && ( rFieldName.indexOf( aQuote ) == -1 ) )
{
OSL_ENSURE(pEntryField->GetTable().getLength(),"No table field name!");
- aTmpStr += ::dbtools::quoteName(aQuote, rFieldName);
+ aTmpStr.append(::dbtools::quoteName(aQuote, rFieldName));
}
else
- aTmpStr += rFieldName;
+ aTmpStr.append(rFieldName);
}
else
- aTmpStr += rFieldName;
+ aTmpStr.append(rFieldName);
if ( pEntryField->isAggreateFunction() )
{
DBG_ASSERT(pEntryField->GetFunction().getLength(),"Functionname darf hier nicht leer sein! ;-(");
- ::rtl::OUString aTmpStr2( pEntryField->GetFunction());
- aTmpStr2 += ::rtl::OUString('(');
- aTmpStr2 += aTmpStr;
- aTmpStr2 += ::rtl::OUString(')');
+ ::rtl::OUStringBuffer aTmpStr2( pEntryField->GetFunction());
+ aTmpStr2.appendAscii("(");
+ aTmpStr2.append(aTmpStr.makeStringAndClear());
+ aTmpStr2.appendAscii(")");
aTmpStr = aTmpStr2;
}
@@ -833,26 +839,26 @@ namespace
pEntryField->isNumericOrAggreateFunction() ||
pEntryField->isOtherFunction()))
{
- aTmpStr += ::rtl::OUString::createFromAscii(" AS ");
- aTmpStr += ::dbtools::quoteName(aQuote, rFieldAlias);
+ aTmpStr.append(s_sAs);
+ aTmpStr.append(::dbtools::quoteName(aQuote, rFieldAlias));
}
- aFieldListStr += aTmpStr;
- aFieldListStr += sFieldSeparator;
+ aFieldListStr.append(aTmpStr.makeStringAndClear());
+ aFieldListStr.append(sFieldSeparator);
}
}
if(aFieldListStr.getLength())
- aFieldListStr = aFieldListStr.replaceAt(aFieldListStr.getLength()-2,2, ::rtl::OUString() );
+ aFieldListStr.setLength(aFieldListStr.getLength()-2);
}
catch(SQLException&)
{
OSL_ASSERT(!"Failure while building select list!");
}
- return aFieldListStr;
+ return aFieldListStr.makeStringAndClear();
}
//------------------------------------------------------------------------------
sal_Bool GenerateCriterias( OQueryDesignView* _pView,
- ::rtl::OUString& rRetStr,
- ::rtl::OUString& rHavingStr,
+ ::rtl::OUStringBuffer& rRetStr,
+ ::rtl::OUStringBuffer& rHavingStr,
OTableFields& _rFieldList,
sal_Bool bMulti )
{
@@ -863,7 +869,8 @@ namespace
// Zeilenweise werden die Ausdr"ucke mit AND verknuepft
sal_uInt16 nMaxCriteria = 0;
OTableFields::iterator aIter = _rFieldList.begin();
- for(;aIter != _rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = _rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
nMaxCriteria = ::std::max<sal_uInt16>(nMaxCriteria,(sal_uInt16)(*aIter)->GetCriteria().size());
}
@@ -872,15 +879,15 @@ namespace
return FALSE;
try
{
- Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
- ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
+ const Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ const ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
const IParseContext& rContext = static_cast<OQueryController&>(_pView->getController()).getParser().getContext();
for (sal_uInt16 i=0 ; i < nMaxCriteria ; i++)
{
aHavingStr = aWhereStr = ::rtl::OUString();
- for(aIter = _rFieldList.begin();aIter != _rFieldList.end();++aIter)
+ for(aIter = _rFieldList.begin();aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
aFieldName = pEntryField->GetField();
@@ -996,26 +1003,26 @@ namespace
{
aWhereStr += ::rtl::OUString(')'); // Klammern zu fuer 'AND' Zweig
if (rRetStr.getLength()) // schon Feldbedingungen ?
- rRetStr += C_OR;
+ rRetStr.append(C_OR);
else // Klammern auf fuer 'OR' Zweig
- rRetStr += ::rtl::OUString('(');
- rRetStr += aWhereStr;
+ rRetStr.append(sal_Unicode('('));
+ rRetStr.append(aWhereStr);
}
if (aHavingStr.getLength())
{
aHavingStr += ::rtl::OUString(')'); // Klammern zu fuer 'AND' Zweig
if (rHavingStr.getLength()) // schon Feldbedingungen ?
- rHavingStr += C_OR;
+ rHavingStr.append(C_OR);
else // Klammern auf fuer 'OR' Zweig
- rHavingStr += ::rtl::OUString('(');
- rHavingStr += aHavingStr;
+ rHavingStr.append(sal_Unicode('('));
+ rHavingStr.append(aHavingStr);
}
}
if (rRetStr.getLength())
- rRetStr += ::rtl::OUString(')'); // Klammern zu fuer 'OR' Zweig
+ rRetStr.append(sal_Unicode(')')); // Klammern zu fuer 'OR' Zweig
if (rHavingStr.getLength())
- rHavingStr += ::rtl::OUString(')'); // Klammern zu fuer 'OR' Zweig
+ rHavingStr.append(sal_Unicode(')')); // Klammern zu fuer 'OR' Zweig
}
catch(SQLException&)
{
@@ -1046,8 +1053,8 @@ namespace
// * darf keine Filter enthalten : habe ich die entsprechende Warnung schon angezeigt ?
sal_Bool bCritsOnAsterikWarning = sal_False; // ** TMFS **
OTableFields::iterator aIter = _rFieldList.begin();
-
- for(;aIter != _rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = _rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
EOrderDir eOrder = pEntryField->GetOrderDir();
@@ -1132,7 +1139,8 @@ namespace
const ::std::vector<OTableConnection*>* _pConnList)
{
::std::vector<OTableConnection*>::const_iterator aIter = _pConnList->begin();
- for(;aIter != _pConnList->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = _pConnList->end();
+ for(;aIter != aEnd;++aIter)
{
const OQueryTableConnection* pEntryConn = static_cast<const OQueryTableConnection*>(*aIter);
OQueryTableConnectionData* pEntryConnData = static_cast<OQueryTableConnectionData*>(pEntryConn->GetData().get());
@@ -1175,12 +1183,13 @@ namespace
if(!pConnList->empty())
{
::std::vector<OTableConnection*>::const_iterator aIter = pConnList->begin();
- for(;aIter != pConnList->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pConnList->end();
+ for(;aIter != aEnd;++aIter)
static_cast<OQueryTableConnection*>(*aIter)->SetVisited(sal_False);
aIter = pConnList->begin();
- sal_Bool bUseEscape = ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_OUTERJOINESCAPE );
- for(;aIter != pConnList->end();++aIter)
+ const sal_Bool bUseEscape = ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_OUTERJOINESCAPE );
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aIter);
if(!pEntryConn->IsVisited())
@@ -1228,7 +1237,7 @@ namespace
// and now all inner joins
aIter = pConnList->begin();
- for(;aIter != pConnList->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aIter);
if(!pEntryConn->IsVisited())
@@ -1247,7 +1256,8 @@ namespace
}
// all tables that haven't a connection to anyone
OQueryTableView::OTableWindowMap::const_iterator aTabIter = pTabList->begin();
- for(;aTabIter != pTabList->end();++aTabIter)
+ OQueryTableView::OTableWindowMap::const_iterator aTabEnd = pTabList->end();
+ for(;aTabIter != aTabEnd;++aTabIter)
{
const OQueryTableWindow* pEntryTab = static_cast<const OQueryTableWindow*>(aTabIter->second);
if(!pEntryTab->ExistsAConn())
@@ -1278,7 +1288,8 @@ namespace
const ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
OTableFields::iterator aIter = _rFieldList.begin();
- for(;aIter != _rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = _rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
if ( pEntryField->IsGroupBy() )
@@ -1421,7 +1432,7 @@ namespace
if ( SQL_ISRULE(pChild,search_condition) )
eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pChild,nLevel,bHaving,bAddOrOnOneLine);
else
- eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pChild, bAddOrOnOneLine ? nLevel : nLevel++,bHaving,bAddOrOnOneLine);
+ eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pChild, bAddOrOnOneLine ? nLevel : nLevel++,bHaving, i == 0 ? false : bAddOrOnOneLine);
}
}
else
@@ -1475,8 +1486,9 @@ namespace
eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pCondition->getChild(1), nLevel2,bHaving,bMustAddOrOnOneLine );
}
// Das erste Element ist (wieder) eine AND-Verknuepfung
- else if ( SQL_ISRULE(pCondition,boolean_term) && pCondition->count() == 3 )
+ else if ( SQL_ISRULE(pCondition,boolean_term) )
{
+ OSL_ENSURE(pCondition->count() == 3,"Illegal definifiton of boolean_term");
eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pCondition->getChild(0), nLevel,bHaving,bAddOrOnOneLine );
if ( eErrorCode == eOk )
eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pCondition->getChild(2), nLevel,bHaving,bAddOrOnOneLine );
@@ -1644,7 +1656,8 @@ namespace
{
OJoinTableView::OTableWindowMap* pTabList = _pView->getTableView()->GetTabWinMap();
OJoinTableView::OTableWindowMap::iterator aIter = pTabList->begin();
- for(;aIter != pTabList->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aTabEnd = pTabList->end();
+ for(;aIter != aTabEnd;++aIter)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
if (pTabWin->ExistsField( ::rtl::OUString::createFromAscii("*"), aDragLeft ))
@@ -1718,13 +1731,14 @@ namespace
{
OConnectionLineDataVec* pLineDataList = pConn->GetData()->GetConnLineDataList();
OConnectionLineDataVec::iterator aIter = pLineDataList->begin();
- for(;aIter != pLineDataList->end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = pLineDataList->end();
+ for(;aIter != aEnd;++aIter)
{
if((*aIter)->GetSourceFieldName() == aDragLeft->GetField() ||
(*aIter)->GetDestFieldName() == aDragLeft->GetField() )
break;
}
- if(aIter != pLineDataList->end())
+ if(aIter != aEnd)
return eOk;
}
}
@@ -1853,7 +1867,8 @@ namespace
OQueryTableWindow* lcl_findColumnInTables( const ::rtl::OUString& _rColumName, const OJoinTableView::OTableWindowMap& _rTabList, OTableFieldDescRef& _rInfo )
{
OJoinTableView::OTableWindowMap::const_iterator aIter = _rTabList.begin();
- for ( ; aIter != _rTabList.end(); ++aIter )
+ OJoinTableView::OTableWindowMap::const_iterator aEnd = _rTabList.end();
+ for ( ; aIter != aEnd; ++aIter )
{
OQueryTableWindow* pTabWin = static_cast< OQueryTableWindow* >( aIter->second );
if ( pTabWin && pTabWin->ExistsField( _rColumName, _rInfo ) )
@@ -2019,7 +2034,8 @@ namespace
// now we have to insert the fields which aren't in the statement
OQueryController& rController = static_cast<OQueryController&>(_pView->getController());
OTableFields& rUnUsedFields = rController.getUnUsedFields();
- for(OTableFields::iterator aIter = rUnUsedFields.begin();aIter != rUnUsedFields.end();++aIter)
+ OTableFields::iterator aEnd = rUnUsedFields.end();
+ for(OTableFields::iterator aIter = rUnUsedFields.begin();aIter != aEnd;++aIter)
if(_pSelectionBrw->InsertField(*aIter,BROWSER_INVALIDID,sal_False,sal_False).isValid())
(*aIter) = NULL;
OTableFields().swap( rUnUsedFields );
@@ -2088,7 +2104,8 @@ namespace
OQueryTableView* pTableView = static_cast<OQueryTableView*>(_pView->getTableView());
pTableView->clearLayoutInformation();
OSQLTables::const_iterator aIter = aMap.begin();
- for(;aIter != aMap.end();++aIter)
+ OSQLTables::const_iterator aEnd = aMap.end();
+ for(;aIter != aEnd;++aIter)
{
OSQLTable xTable = aIter->second;
Reference< XPropertySet > xTableProps( xTable, UNO_QUERY_THROW );
@@ -2132,7 +2149,8 @@ namespace
// now delete the data for which we haven't any tablewindow
OJoinTableView::OTableWindowMap aTableMap(*pTableView->GetTabWinMap());
OJoinTableView::OTableWindowMap::iterator aIterTableMap = aTableMap.begin();
- for(;aIterTableMap != aTableMap.end();++aIterTableMap)
+ OJoinTableView::OTableWindowMap::iterator aIterTableEnd = aTableMap.end();
+ for(;aIterTableMap != aIterTableEnd;++aIterTableMap)
{
if(aMap.find(aIterTableMap->second->GetComposedName()) == aMap.end() &&
aMap.find(aIterTableMap->first) == aMap.end())
@@ -2191,7 +2209,8 @@ namespace
sal_Bool bFirstField = sal_True;
::rtl::OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*"));
OJoinTableView::OTableWindowMap::iterator aIter = _pTabList->begin();
- for(;aIter != _pTabList->end() && eOk == eErrorCode ;++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = _pTabList->end();
+ for(;aIter != aEnd && eOk == eErrorCode ;++aIter)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
OTableFieldDescRef aInfo = new OTableFieldDesc();
@@ -2319,7 +2338,8 @@ namespace
if ( pParamRef && pParamRef->getTokenValue().toChar() == '*' )
{
OJoinTableView::OTableWindowMap::iterator aIter = pTabList->begin();
- for(;aIter != pTabList->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pTabList->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
if (pTabWin->ExistsField( ::rtl::OUString::createFromAscii("*"), aInfo ))
@@ -2448,7 +2468,8 @@ namespace
OTableFields& aList = rController.getTableFieldDesc();
OTableFields::iterator aIter = aList.begin();
- for(;aIter != aList.end();++aIter)
+ OTableFields::iterator aEnd = aList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntry = *aIter;
if(pEntry.isValid() && pEntry->GetFieldAlias() == aColumnName)
@@ -2869,7 +2890,8 @@ void OQueryDesignView::fillValidFields(const ::rtl::OUString& sAliasName, ComboB
::rtl::OUString strCurrentPrefix;
::std::vector< ::rtl::OUString> aFields;
OJoinTableView::OTableWindowMap::iterator aIter = pTabWins->begin();
- for(;aIter != pTabWins->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pTabWins->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableWindow* pCurrentWin = static_cast<OQueryTableWindow*>(aIter->second);
if (bAllTables || (pCurrentWin->GetAliasName() == sAliasName))
@@ -2880,7 +2902,8 @@ void OQueryDesignView::fillValidFields(const ::rtl::OUString& sAliasName, ComboB
pCurrentWin->EnumValidFields(aFields);
::std::vector< ::rtl::OUString>::iterator aStrIter = aFields.begin();
- for(;aStrIter != aFields.end();++aStrIter)
+ ::std::vector< ::rtl::OUString>::iterator aStrEnd = aFields.end();
+ for(;aStrIter != aStrEnd;++aStrIter)
{
if (bAllTables || aStrIter->toChar() == '*')
pFieldList->InsertEntry(::rtl::OUString(strCurrentPrefix) += *aStrIter);
@@ -2942,7 +2965,8 @@ sal_Bool OQueryDesignView::checkStatement()
sal_uInt32 nFieldcount = 0;
OTableFields& rFieldList = rController.getTableFieldDesc();
OTableFields::iterator aIter = rFieldList.begin();
- for(;aIter != rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
if ( pEntryField->GetField().getLength() && pEntryField->IsVisible() )
@@ -2951,6 +2975,7 @@ sal_Bool OQueryDesignView::checkStatement()
!pEntryField->HasCriteria() &&
pEntryField->isNoneFunction() &&
pEntryField->GetOrderDir() == ORDER_NONE &&
+ !pEntryField->IsGroupBy() &&
!pEntryField->GetFunction().getLength() )
rUnUsedFields.push_back(pEntryField);
}
@@ -2979,7 +3004,7 @@ sal_Bool OQueryDesignView::checkStatement()
// wenn es Felder gibt, koennen die nur durch Einfuegen aus einer schon existenten Tabelle entstanden sein; wenn andererseits
// eine Tabelle geloescht wird, verschwinden auch die zugehoerigen Felder -> ergo KANN es das nicht geben, dass Felder
// existieren, aber keine Tabellen (und aFieldListStr hat schon eine Laenge, das stelle ich oben sicher)
- ::rtl::OUString aHavingStr,aCriteriaListStr;
+ ::rtl::OUStringBuffer aHavingStr,aCriteriaListStr;
// ----------------- Kriterien aufbauen ----------------------
if (!GenerateCriterias(this,aCriteriaListStr,aHavingStr,rFieldList, nTabcount > 1))
return ::rtl::OUString();
@@ -2994,22 +3019,22 @@ sal_Bool OQueryDesignView::checkStatement()
if(aCriteriaListStr.getLength())
{
aTmp += C_AND;
- aTmp += aCriteriaListStr;
+ aTmp += aCriteriaListStr.makeStringAndClear();
}
aCriteriaListStr = aTmp;
}
// ----------------- Statement aufbauen ----------------------
- ::rtl::OUString aSqlCmd(::rtl::OUString::createFromAscii("SELECT "));
+ ::rtl::OUStringBuffer aSqlCmd(::rtl::OUString::createFromAscii("SELECT "));
if(static_cast<OQueryController&>(getController()).isDistinct())
- aSqlCmd += ::rtl::OUString::createFromAscii(" DISTINCT ");
- aSqlCmd += aFieldListStr;
- aSqlCmd += ::rtl::OUString::createFromAscii(" FROM ");
- aSqlCmd += aTableListStr;
+ aSqlCmd.append(::rtl::OUString::createFromAscii(" DISTINCT "));
+ aSqlCmd.append(aFieldListStr);
+ aSqlCmd.append(::rtl::OUString::createFromAscii(" FROM "));
+ aSqlCmd.append(aTableListStr);
if (aCriteriaListStr.getLength())
{
- aSqlCmd += ::rtl::OUString::createFromAscii(" WHERE ");
- aSqlCmd += aCriteriaListStr;
+ aSqlCmd.append(::rtl::OUString::createFromAscii(" WHERE "));
+ aSqlCmd.append(aCriteriaListStr.makeStringAndClear());
}
// ----------------- GroupBy aufbauen und Anh"angen ------------
Reference<XDatabaseMetaData> xMeta;
@@ -3019,18 +3044,18 @@ sal_Bool OQueryDesignView::checkStatement()
if ( xMeta.is() )
bUseAlias = bUseAlias || !xMeta->supportsGroupByUnrelated();
- aSqlCmd += GenerateGroupBy(this,rFieldList,bUseAlias);
+ aSqlCmd.append(GenerateGroupBy(this,rFieldList,bUseAlias));
// ----------------- having Anh"angen ------------
if(aHavingStr.getLength())
{
- aSqlCmd += ::rtl::OUString::createFromAscii(" HAVING ");
- aSqlCmd += aHavingStr;
+ aSqlCmd.append(::rtl::OUString::createFromAscii(" HAVING "));
+ aSqlCmd.append(aHavingStr.makeStringAndClear());
}
// ----------------- Sortierung aufbauen und Anh"angen ------------
::rtl::OUString sOrder;
SqlParseError eErrorCode = eOk;
if ( (eErrorCode = GenerateOrder(this,rFieldList,nTabcount > 1,sOrder)) == eOk)
- aSqlCmd += sOrder;
+ aSqlCmd.append(sOrder);
else
{
if ( !m_rController.hasError() )
@@ -3039,11 +3064,12 @@ sal_Bool OQueryDesignView::checkStatement()
m_rController.displayError();
}
+ ::rtl::OUString sSQL = aSqlCmd.makeStringAndClear();
if ( xConnection.is() )
{
::connectivity::OSQLParser& rParser( rController.getParser() );
::rtl::OUString sErrorMessage;
- ::std::auto_ptr<OSQLParseNode> pParseNode( rParser.parseTree( sErrorMessage, aSqlCmd, sal_True ) );
+ ::std::auto_ptr<OSQLParseNode> pParseNode( rParser.parseTree( sErrorMessage, sSQL, sal_True ) );
if ( pParseNode.get() )
{
OSQLParseNode* pNode = pParseNode->getChild(3)->getChild(1);
@@ -3055,12 +3081,12 @@ sal_Bool OQueryDesignView::checkStatement()
OSQLParseNode::compress(pCondition);
::rtl::OUString sTemp;
pParseNode->parseNodeToStr(sTemp,xConnection);
- aSqlCmd = sTemp;
+ sSQL = sTemp;
}
}
}
}
- return aSqlCmd;
+ return sSQL;
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
index ba7182523..e034d0849 100644
--- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
@@ -96,7 +96,8 @@ OQueryTabWinUndoAct::~OQueryTabWinUndoAct()
// und natuerlich auch die entsprechenden Connections
::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
{
m_pOwner->DeselectConn(*aIter);
delete (*aIter);
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index ce4ee5616..26b494743 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -434,14 +434,15 @@ void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn,
// erst mal schauen, ob ich diese Connection schon habe
OQueryTableConnection* pTabConn = NULL;
const ::std::vector<OTableConnection*>* pConnections = getTableConnections();
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pConnections->end();
::std::vector<OTableConnection*>::const_iterator aIter = ::std::find( pConnections->begin(),
- pConnections->end(),
+ aEnd,
static_cast<const OTableConnection*>(&rNewConn)
);
- if(aIter == pConnections->end())
+ if(aIter == aEnd )
{
aIter = pConnections->begin();
- for(;aIter != pConnections->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
if(*static_cast<OQueryTableConnection*>(*aIter) == rNewConn)
{
@@ -549,14 +550,15 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
TTableWindowData::value_type pNewTabWinData;
TTableWindowData* pWindowData = getDesignView()->getController().getTableWindowData();
TTableWindowData::iterator aWinIter = pWindowData->begin();
- for(;aWinIter != pWindowData->end();++aWinIter)
+ TTableWindowData::iterator aWinEnd = pWindowData->end();
+ for(;aWinIter != aWinEnd;++aWinIter)
{
pNewTabWinData = *aWinIter;
if (pNewTabWinData && pNewTabWinData->GetWinName() == strAlias && pNewTabWinData->GetComposedName() == _rComposedName && pNewTabWinData->GetTableName() == _rTableName)
break;
}
if ( !bAppend )
- bAppend = ( aWinIter == pWindowData->end() );
+ bAppend = ( aWinIter == aWinEnd );
if ( bAppend )
pNewTabWinData = createTableWindowData(_rComposedName, _rTableName, strAlias);
// die TabWinData brauche ich nicht in die entsprechende Liste der DocShell eintragen, das macht ShowTabWin
@@ -626,9 +628,10 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
OSL_ENSURE(aReferencedTable.getLength(),"Foreign key without referencedTableName");
OTableWindowMap::const_iterator aIter = pTabWins->find(aReferencedTable);
- if(aIter == pTabWins->end())
+ OTableWindowMap::const_iterator aEnd = pTabWins->end();
+ if(aIter == aEnd)
{
- for(aIter = pTabWins->begin();aIter != pTabWins->end();++aIter)
+ for(aIter = pTabWins->begin();aIter != aEnd;++aIter)
{
OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second);
OSL_ENSURE( pTabWinTmp,"TableWindow is null!" );
@@ -636,7 +639,7 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
break;
}
}
- if ( aIter != pTabWins->end() && pNewTabWin != aIter->second )
+ if ( aIter != aEnd && pNewTabWin != aIter->second )
addConnections( this, *pNewTabWin, *static_cast<OQueryTableWindow*>(aIter->second), xFKeyColumns );
}
break;
@@ -645,7 +648,8 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
{
// we have a primary key so look in our list if there exsits a key which this is refered to
OTableWindowMap::const_iterator aIter = pTabWins->begin();
- for(;aIter != pTabWins->end();++aIter)
+ OTableWindowMap::const_iterator aEnd = pTabWins->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second);
if ( pTabWinTmp == pNewTabWin )
@@ -827,7 +831,8 @@ sal_Bool OQueryTableView::FindTableFromField(const String& rFieldName, OTableFie
DBG_CHKTHIS(OQueryTableView,NULL);
rCnt = 0;
OTableWindowMap::const_iterator aIter = GetTabWinMap()->begin();
- for(;aIter != GetTabWinMap()->end();++aIter)
+ OTableWindowMap::const_iterator aEnd = GetTabWinMap()->end();
+ for(;aIter != aEnd;++aIter)
{
if(static_cast<OQueryTableWindow*>(aIter->second)->ExistsField(rFieldName, rInfo))
++rCnt;
@@ -919,7 +924,8 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
// (ich muss ueber das Parent gehen, da nur das die Position der Scrollbars kennt)
// dann aus der Liste der TabWins raus und verstecken
OTableWindowMap::iterator aIter = pTabWins->begin();
- for ( ;aIter != pTabWins->end(); ++aIter )
+ OTableWindowMap::iterator aEnd = pTabWins->end();
+ for ( ;aIter != aEnd ; ++aIter )
if ( aIter->second == pTabWin )
{
pTabWins->erase( aIter );
@@ -943,7 +949,7 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
sal_Int16 nCnt = 0;
const ::std::vector<OTableConnection*>* pTabConList = getTableConnections();
::std::vector<OTableConnection*>::const_iterator aIter2 = pTabConList->begin();
- for(;aIter2 != pTabConList->end();)
+ for(;aIter2 != pTabConList->end();)// the end may change
{
OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>(*aIter2);
OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!");
@@ -1016,8 +1022,9 @@ sal_Bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUn
// die Connections
::std::vector<OTableConnection*>* pTableCon = pUndoAction->GetTabConnList();
::std::vector<OTableConnection*>::iterator aIter = pTableCon->begin();
+ ::std::vector<OTableConnection*>::iterator aEnd = pTableCon->end();
- for(;aIter != pTableCon->end();++aIter)
+ for(;aIter != aEnd;++aIter)
addConnection(*aIter); // add all connections from the undo action
// each connection should invalidated inside addConnection so we don't need this here any longer
@@ -1069,7 +1076,8 @@ sal_Bool OQueryTableView::ExistsAVisitedConn(const OQueryTableWindow* pFrom) con
if (pList)
{
::std::vector<OTableConnection*>::const_iterator aIter = pList->begin();
- for(;aIter != pList->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pList->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pTemp = static_cast<OQueryTableConnection*>(*aIter);
if (pTemp->IsVisited() &&
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 5e961309d..c1f8f1649 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -573,7 +573,9 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon
if (pTabWinList)
{
OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->begin();
- for(;aIter != pTabWinList->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pTabWinList->end();
+
+ for(;aIter != aEnd;++aIter)
m_pTableCell->InsertEntry(static_cast<OQueryTableWindow*>(aIter->second)->GetAliasName());
m_pTableCell->InsertEntry(String(ModuleRes(STR_QUERY_NOTABLE)), 0);
@@ -1790,7 +1792,8 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo , sal_uInt
OTableFields& rFields = getFields();
OTableFields::iterator aIter = rFields.begin();
- for(;aIter != rFields.end();++aIter)
+ OTableFields::iterator aEnd = rFields.end();
+ for(;aIter != aEnd;++aIter)
{
pEntry = *aIter;
OSL_ENSURE(pEntry.isValid(),"OTableFieldDescRef was null!");
@@ -1841,14 +1844,16 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
DBG_ASSERT(rInfo.isValid() && !rInfo->IsEmpty(),"AddCondition:: OTableFieldDescRef sollte nicht Empty sein!");
- OTableFieldDescRef pEntry;
+ OTableFieldDescRef pLastEntry;
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
- OTableFields::iterator aIter = getFields().begin();
- for(;aIter != getFields().end();++aIter)
+ OTableFields& rFields = getFields();
+ OTableFields::iterator aIter = rFields.begin();
+ OTableFields::iterator aEnd = rFields.end();
+ for(;aIter != aEnd;++aIter)
{
- pEntry = *aIter;
+ OTableFieldDescRef pEntry = *aIter;
const ::rtl::OUString aField = pEntry->GetField();
const ::rtl::OUString aAlias = pEntry->GetAlias();
@@ -1865,22 +1870,9 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S
if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
pEntry->SetVisible(sal_True);
}
- if (!pEntry->GetCriteria(nLevel).getLength() || _bAddOrOnOneLine )
+ if (!pEntry->GetCriteria(nLevel).getLength() )
{
- String sCriteria = rValue;
- if ( _bAddOrOnOneLine )
- {
- String sOldCriteria = pEntry->GetCriteria( nLevel );
- if ( sOldCriteria.Len() )
- {
- sCriteria = String(RTL_CONSTASCII_USTRINGPARAM("("));
- sCriteria += sOldCriteria;
- sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(" OR "));
- sCriteria += rValue;
- sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(")"));
- }
- }
- pEntry->SetCriteria( nLevel, sCriteria);
+ pEntry->SetCriteria( nLevel, rValue);
if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1))
{
RowInserted( GetRowCount()-1, 1, TRUE );
@@ -1889,11 +1881,36 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S
}
m_bVisibleRow[BROW_CRIT1_ROW + nLevel] = sal_True;
break;
+ } // if (!pEntry->GetCriteria(nLevel).getLength() )
+ if ( _bAddOrOnOneLine )
+ {
+ pLastEntry = pEntry;
}
}
+ } // for(;aIter != getFields().end();++aIter)
+ if ( pLastEntry.isValid() )
+ {
+ String sCriteria = rValue;
+ String sOldCriteria = pLastEntry->GetCriteria( nLevel );
+ if ( sOldCriteria.Len() )
+ {
+ sCriteria = String(RTL_CONSTASCII_USTRINGPARAM("( "));
+ sCriteria += sOldCriteria;
+ sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(" OR "));
+ sCriteria += rValue;
+ sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(" )"));
+ }
+ pLastEntry->SetCriteria( nLevel, sCriteria);
+ if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1))
+ {
+ RowInserted( GetRowCount()-1, 1, TRUE );
+ m_bVisibleRow.push_back(sal_True);
+ ++m_nVisibleCount;
+ }
+ m_bVisibleRow[BROW_CRIT1_ROW + nLevel] = sal_True;
}
- if (aIter == getFields().end())
+ else if (aIter == getFields().end())
{
OTableFieldDescRef pTmp = InsertField(rInfo, BROWSER_INVALIDID, sal_False, sal_False );
if ( pTmp->isNumericOrAggreateFunction() && rInfo->IsGroupBy() ) // das GroupBy wird bereits von rInfo "ubernommen
@@ -1926,7 +1943,8 @@ void OSelectionBrowseBox::AddOrder( const OTableFieldDescRef& rInfo, const EOrde
sal_Bool bAppend = sal_False;
OTableFields& rFields = getFields();
OTableFields::iterator aIter = rFields.begin();
- for(;aIter != rFields.end();++aIter)
+ OTableFields::iterator aEnd = rFields.end();
+ for(;aIter != aEnd;++aIter)
{
pEntry = *aIter;
::rtl::OUString aField = pEntry->GetField();
diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx
index f0870d8d4..84f5fcd09 100644
--- a/dbaccess/source/ui/querydesign/TableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnection.cxx
@@ -89,8 +89,9 @@ namespace dbaui
// Linienliste mit Defaults initialisieren
OConnectionLineDataVec* pLineData = GetData()->GetConnLineDataList();
OConnectionLineDataVec::const_iterator aIter = pLineData->begin();
+ OConnectionLineDataVec::const_iterator aEnd = pLineData->end();
m_vConnLine.reserve(pLineData->size());
- for(;aIter != pLineData->end();++aIter)
+ for(;aIter != aEnd;++aIter)
m_vConnLine.push_back( new OConnectionLine(this, *aIter) );
}
@@ -102,7 +103,8 @@ namespace dbaui
// -----------------------------------------------------------------------------
void OTableConnection::clearLineData()
{
- for(::std::vector<OConnectionLine*>::iterator aLineIter = m_vConnLine.begin();aLineIter != m_vConnLine.end();++aLineIter)
+ ::std::vector<OConnectionLine*>::iterator aLineEnd = m_vConnLine.end();
+ for(::std::vector<OConnectionLine*>::iterator aLineIter = m_vConnLine.begin();aLineIter != aLineEnd;++aLineIter)
delete *aLineIter;
m_vConnLine.clear();
}
@@ -130,8 +132,9 @@ namespace dbaui
{
const ::std::vector<OConnectionLine*>* pLine = rConn.GetConnLineList();
::std::vector<OConnectionLine*>::const_iterator aIter = pLine->begin();
+ ::std::vector<OConnectionLine*>::const_iterator aEnd = pLine->end();
m_vConnLine.reserve(pLine->size());
- for(;aIter != pLine->end();++aIter)
+ for(;aIter != aEnd;++aIter)
m_vConnLine.push_back( CreateConnLine( **aIter ));
}
@@ -223,7 +226,8 @@ namespace dbaui
// Aus allen Linien das umgebende Rechteck bestimmen
Rectangle aBoundingRect( Point(0,0), Point(0,0) );
Rectangle aTempRect;
- for(::std::vector<OConnectionLine*>::const_iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter)
+ ::std::vector<OConnectionLine*>::const_iterator aEnd = m_vConnLine.end();
+ for(::std::vector<OConnectionLine*>::const_iterator aIter = m_vConnLine.begin();aIter != aEnd;++aIter)
{
aTempRect = (*aIter)->GetBoundingRect();
diff --git a/dbaccess/source/ui/querydesign/TableConnectionData.cxx b/dbaccess/source/ui/querydesign/TableConnectionData.cxx
index 76461f2fa..bcb1116a6 100644
--- a/dbaccess/source/ui/querydesign/TableConnectionData.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnectionData.cxx
@@ -111,7 +111,8 @@ OTableConnectionData& OTableConnectionData::operator=( const OTableConnectionDat
OConnectionLineDataVec* pLineData = const_cast<OTableConnectionData*>(&rConnData)->GetConnLineDataList();
OConnectionLineDataVec::const_iterator aIter = pLineData->begin();
- for(;aIter != pLineData->end();++aIter)
+ OConnectionLineDataVec::const_iterator aEnd = pLineData->end();
+ for(;aIter != aEnd;++aIter)
m_vConnLineData.push_back(new OConnectionLineData(**aIter));
return *this;
@@ -140,12 +141,13 @@ BOOL OTableConnectionData::SetConnLine( USHORT nIndex, const String& rSourceFiel
BOOL OTableConnectionData::AppendConnLine( const ::rtl::OUString& rSourceFieldName, const ::rtl::OUString& rDestFieldName )
{
OConnectionLineDataVec::iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
if((*aIter)->GetDestFieldName() == rDestFieldName && (*aIter)->GetSourceFieldName() == rSourceFieldName)
break;
}
- if(aIter == m_vConnLineData.end())
+ if(aIter == aEnd)
{
OConnectionLineDataRef pNew = new OConnectionLineData(rSourceFieldName, rDestFieldName);
if (!pNew.isValid())
diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
index 3da65b47d..eaffece60 100644
--- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
@@ -187,9 +187,10 @@ namespace dbaui
// search the postion of our table window in the table window map
OJoinTableView::OTableWindowMap* pMap = m_pTable->getTableView()->GetTabWinMap();
OJoinTableView::OTableWindowMap::iterator aIter = pMap->begin();
- for (nIndex = 0; aIter != pMap->end() && aIter->second != m_pTable; ++nIndex,++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pMap->end();
+ for (nIndex = 0; aIter != aEnd && aIter->second != m_pTable; ++nIndex,++aIter)
;
- nIndex = aIter != pMap->end() ? nIndex : -1;
+ nIndex = aIter != aEnd ? nIndex : -1;
}
return nIndex;
}
@@ -278,9 +279,10 @@ namespace dbaui
const ::std::vector<OTableConnection*>* pConnectionList = pView->getTableConnections();
::std::vector<OTableConnection*>::const_iterator aIter = pView->getTableConnections(m_pTable);
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pConnectionList->end();
::std::vector< Reference<XInterface> > aRelations;
aRelations.reserve(5); // just guessing
- for (; aIter != pConnectionList->end() ; ++aIter )
+ for (; aIter != aEnd ; ++aIter )
aRelations.push_back(getParentChild(aIter - pConnectionList->begin()));
Reference<XInterface> *pRelations = aRelations.empty() ? 0 : &aRelations[0];
diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src
index 8e244f67d..412e9c6dd 100644
--- a/dbaccess/source/ui/querydesign/query.src
+++ b/dbaccess/source/ui/querydesign/query.src
@@ -310,28 +310,6 @@ String STR_QRY_ILLEGAL_JOIN
Text [ en-US ] = "Join could not be processed" ;
};
-String STR_QUERY_SAVEMODIFIED
-{
- Text [ en-US ] = "The $object$ has been changed.\nDo you want to save the changes?" ;
- Text [ x-comment ] = "For $object$, one of the values of the RSC_QUERY_OBJECT_TYPE resource will be inserted.";
-};
-
-Resource RSC_QUERY_OBJECT_TYPE
-{
- String 1
- {
- Text [ en-US ] = "table view";
- };
- String 2
- {
- Text [ en-US ] = "query";
- };
- String 3
- {
- Text [ en-US ] = "SQL statement";
- };
-};
-
String STR_SVT_SQL_SYNTAX_ERROR
{
Text [ en-US ] = "Syntax error in SQL statement" ;
@@ -401,20 +379,42 @@ String STR_VIEWDESIGN
Text [ en-US ] = " - %PRODUCTNAME Base: View Design";
};
+String STR_QUERY_SAVEMODIFIED
+{
+ Text [ en-US ] = "$object$ has been changed.\nDo you want to save the changes?" ;
+ Text [ x-comment ] = "For $object$, one of the values of the RSC_QUERY_OBJECT_TYPE resource will be inserted.";
+};
+
String STR_ERROR_PARSING_STATEMENT
{
- Text [ en-US ] = "The SQL command which constitutes the $object$ could not be parsed.";
+ Text [ en-US ] = "$object$ is based on an SQL command which could not be parsed.";
Text [ x-comment ] = "For $object$, one of the values of the RSC_QUERY_OBJECT_TYPE resource "
"(except \"SQL command\", which doesn't make sense here) will be inserted.";
};
String STR_INFO_OPENING_IN_SQL_VIEW
{
- Text [ en-US ] = "The $object$ will be opened in SQL view.";
+ Text [ en-US ] = "$object$ will be opened in SQL view.";
Text [ x-comment ] = "For $object$, one of the values of the RSC_QUERY_OBJECT_TYPE resource "
"(except \"SQL command\", which doesn't make sense here) will be inserted.";
};
+Resource RSC_QUERY_OBJECT_TYPE
+{
+ String 1
+ {
+ Text [ en-US ] = "The table view";
+ };
+ String 2
+ {
+ Text [ en-US ] = "The query";
+ };
+ String 3
+ {
+ Text [ en-US ] = "The SQL statement";
+ };
+};
+
String STR_STATEMENT_WITHOUT_RESULT_SET
{
Text [ en-US ] = "The query does not create a result set, and thus cannot be part of another query.";
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 4393856fc..ea3ab1ca3 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -717,6 +717,8 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
pNodeTmp = pTemp->getChild(1);
::connectivity::OSQLParseNode::absorptions(pNodeTmp);
pNodeTmp = pTemp->getChild(1);
+ OSQLParseNode::compress(pNodeTmp);
+ pNodeTmp = pTemp->getChild(1);
} // if ( pCondition ) // no where clause
::rtl::OUString sTemp;
pNode->parseNodeToStr(sTemp,getConnection());
@@ -1098,8 +1100,9 @@ void OQueryController::reconnect(sal_Bool _bUI)
void OQueryController::saveViewSettings(Sequence<PropertyValue>& _rViewProps)
{
OTableFields::const_iterator aFieldIter = m_vTableFieldDesc.begin();
+ OTableFields::const_iterator aFieldEnd = m_vTableFieldDesc.end();
sal_Int32 nCount = 0;
- for(;aFieldIter != m_vTableFieldDesc.end();++aFieldIter)
+ for(;aFieldIter != aFieldEnd;++aFieldIter)
{
if(!(*aFieldIter)->IsEmpty())
++nCount;
@@ -1118,7 +1121,7 @@ void OQueryController::saveViewSettings(Sequence<PropertyValue>& _rViewProps)
PropertyValue *pFieldsIter = aFields.getArray();
// the fielddata
aFieldIter = m_vTableFieldDesc.begin();
- for(sal_Int32 i = 1;aFieldIter != m_vTableFieldDesc.end();++aFieldIter,++i)
+ for(sal_Int32 i = 1;aFieldIter !=aFieldEnd;++aFieldIter,++i)
{
if ( !(*aFieldIter)->IsEmpty() )
{
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
index 8a1f83339..d94e511d3 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnection.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
@@ -104,7 +104,8 @@ void ORelationTableConnection::Draw( const Rectangle& rRect )
const OConnectionLine* pTopLine = NULL;
const ::std::vector<OConnectionLine*>* pConnLineList = GetConnLineList();
::std::vector<OConnectionLine*>::const_iterator aIter = pConnLineList->begin();
- for(;aIter != pConnLineList->end();++aIter)
+ ::std::vector<OConnectionLine*>::const_iterator aEnd = pConnLineList->end();
+ for(;aIter != aEnd;++aIter)
{
if( (*aIter)->IsValid() )
{
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index 3de67e64d..3b79e9895 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -138,7 +138,8 @@ void ORelationTableConnectionData::ChangeOrientation()
// Source- und DestFieldName der Linien austauschen
::rtl::OUString sTempString;
OConnectionLineDataVec::iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
sTempString = (*aIter)->GetSourceFieldName();
(*aIter)->SetSourceFieldName( (*aIter)->GetDestFieldName() );
@@ -195,7 +196,8 @@ BOOL ORelationTableConnectionData::checkPrimaryKey(const Reference< XIndexAccess
for(;pKeyIter != pKeyEnd;++pKeyIter)
{
OConnectionLineDataVec::const_iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::const_iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
++nValidLinesCount;
if ( (*aIter)->GetFieldName(_eEConnectionSide) == *pKeyIter )
@@ -338,7 +340,8 @@ BOOL ORelationTableConnectionData::Update()
if ( xColumnFactory.is() )
{
OConnectionLineDataVec::iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
if((*aIter)->GetSourceFieldName().getLength() && (*aIter)->GetDestFieldName().getLength())
{
@@ -392,7 +395,8 @@ BOOL ORelationTableConnectionData::Update()
xColumn->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedColumn;
OConnectionLineDataVec::iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
if( (*aIter)->GetSourceFieldName() == sName
&& (*aIter)->GetDestFieldName() == sRelatedColumn )
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index 979967c81..bb9bc9afe 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -515,12 +515,13 @@ TTableWindowData::value_type ORelationController::existsTable(const ::rtl::OUStr
Reference<XDatabaseMetaData> xMeta = getConnection()->getMetaData();
::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
TTableWindowData::const_iterator aIter = m_vTableData.begin();
- for(;aIter != m_vTableData.end();++aIter)
+ TTableWindowData::const_iterator aEnd = m_vTableData.end();
+ for(;aIter != aEnd;++aIter)
{
if(bCase((*aIter)->GetComposedName(),_rComposedTableName))
break;
}
- return ( aIter != m_vTableData.end()) ? *aIter : TTableWindowData::value_type();
+ return ( aIter != aEnd) ? *aIter : TTableWindowData::value_type();
}
// -----------------------------------------------------------------------------
void ORelationController::loadLayoutInformation()
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index b86d86004..d3ae601cf 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -207,7 +207,8 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
OTableWindow* pDestWin = jxdDest.pListBox->GetTabWin();
::std::vector<OTableConnection*>::const_iterator aIter = getTableConnections()->begin();
- for(;aIter != getTableConnections()->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = getTableConnections()->end();
+ for(;aIter != aEnd;++aIter)
{
OTableConnection* pFirst = *aIter;
if((pFirst->GetSourceWin() == pSourceWin && pFirst->GetDestWin() == pDestWin) ||
diff --git a/dbaccess/source/ui/relationdesign/relation.src b/dbaccess/source/ui/relationdesign/relation.src
index 8385f2c82..343fe9e11 100644
--- a/dbaccess/source/ui/relationdesign/relation.src
+++ b/dbaccess/source/ui/relationdesign/relation.src
@@ -77,7 +77,7 @@ String STR_QUERY_REL_DELETE_WINDOW
String STR_QUERY_REL_COULD_NOT_CREATE
{
- Text [ en-US ] = "The datbase could not create the relation. May be foreign keys for this kind of table aren't supported.\nPlease check your documentation of the database.";
+ Text [ en-US ] = "The database could not create the relation. May be foreign keys for this kind of table aren't supported.\nPlease check your documentation of the database.";
};
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index a5a4308f7..8540b4b8d 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -176,7 +176,11 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC
if(xPropSetInfo->hasPropertyByName(PROPERTY_ISNULLABLE))
SetIsNullable(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_ISNULLABLE)));
if(xPropSetInfo->hasPropertyByName(PROPERTY_FORMATKEY))
- SetFormatKey(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY)));
+ {
+ const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY);
+ if ( aValue.hasValue() )
+ SetFormatKey(::comphelper::getINT32(aValue));
+ }
if(xPropSetInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
m_aRelativePosition = xAffectedCol->getPropertyValue(PROPERTY_RELATIVEPOSITION);
if(xPropSetInfo->hasPropertyByName(PROPERTY_WIDTH))
@@ -184,7 +188,11 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC
if(xPropSetInfo->hasPropertyByName(PROPERTY_HIDDEN))
xAffectedCol->getPropertyValue(PROPERTY_HIDDEN) >>= m_bHidden;
if(xPropSetInfo->hasPropertyByName(PROPERTY_ALIGN))
- SetHorJustify( ::dbaui::mapTextJustify(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_ALIGN))));
+ {
+ const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_ALIGN);
+ if ( aValue.hasValue() )
+ SetHorJustify( ::dbaui::mapTextJustify(::comphelper::getINT32(aValue)));
+ }
if(xPropSetInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT))
SetAutoIncrement(::cppu::any2bool(xAffectedCol->getPropertyValue(PROPERTY_ISAUTOINCREMENT)));
}
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index cfdf827af..53022b5ad 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -512,7 +512,8 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16
const OTypeInfoMap* pTypeInfo = GetView()->getController().getTypeInfo();
OTypeInfoMap::const_iterator aIter = pTypeInfo->begin();
- for(;aIter != pTypeInfo->end();++aIter)
+ OTypeInfoMap::const_iterator aEnd = pTypeInfo->end();
+ for(;aIter != aEnd;++aIter)
pTypeCell->InsertEntry( aIter->second->aUIName );
pTypeCell->SelectEntry( aInitString );
}
@@ -620,9 +621,10 @@ sal_Int32 OTableEditorCtrl::HasFieldName( const String& rFieldName )
::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True);
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_pRowList->begin();
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_pRowList->end();
OFieldDescription* pFieldDescr;
sal_Int32 nCount(0);
- for(;aIter != m_pRowList->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
pFieldDescr = (*aIter)->GetActFieldDescr();
if( pFieldDescr && bCase(rFieldName,pFieldDescr->GetName()))
@@ -1310,9 +1312,9 @@ Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId )
String OTableEditorCtrl::GetCellText( long nRow, sal_uInt16 nColId ) const
{
DBG_CHKTHIS(OTableEditorCtrl,NULL);
- //////////////////////////////////////////////////////////////////////
- // Text aus Dokumentdaten holen
- return ::comphelper::getString(const_cast<OTableEditorCtrl*>(this)->GetCellData( nRow, nColId ));
+ ::rtl::OUString sCellText;
+ const_cast< OTableEditorCtrl* >( this )->GetCellData( nRow, nColId ) >>= sCellText;
+ return sCellText;
}
//------------------------------------------------------------------------------
@@ -1806,7 +1808,8 @@ void OTableEditorCtrl::SetPrimaryKey( sal_Bool bSet )
long nIndex = 0;
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_pRowList->begin();
- for(sal_Int32 nRow = 0;aIter != m_pRowList->end();++aIter,++nRow)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aEnd = m_pRowList->end();
+ for(sal_Int32 nRow = 0;aIter != aEnd;++aIter,++nRow)
{
OFieldDescription* pFieldDescr = (*aIter)->GetActFieldDescr();
if( pFieldDescr && (*aIter)->IsPrimaryKey() && (!bSet || !IsRowSelected(nRow)) )
@@ -1856,7 +1859,8 @@ sal_Bool OTableEditorCtrl::IsPrimaryKey()
// Gehoeren alle markierten Felder zu einem Primary Key ?
long nPrimaryKeys = 0;
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_pRowList->begin();
- for(sal_Int32 nRow=0;aIter != m_pRowList->end();++aIter,++nRow)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aEnd = m_pRowList->end();
+ for(sal_Int32 nRow=0;aIter != aEnd;++aIter,++nRow)
{
if( IsRowSelected(nRow) && !(*aIter)->IsPrimaryKey() )
return sal_False;
@@ -1890,7 +1894,7 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType )
pRow->SetFieldType( _pType, sal_True );
if ( _pType.get() )
{
- sal_uInt16 nCurrentlySelected = pTypeCell->GetSelectEntryPos();
+ const sal_uInt16 nCurrentlySelected = pTypeCell->GetSelectEntryPos();
if ( ( LISTBOX_ENTRY_NOTFOUND == nCurrentlySelected )
|| ( GetView()->getController().getTypeInfo( nCurrentlySelected ) != _pType )
@@ -1899,7 +1903,8 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType )
USHORT nEntryPos = 0;
const OTypeInfoMap* pTypeInfo = GetView()->getController().getTypeInfo();
OTypeInfoMap::const_iterator aIter = pTypeInfo->begin();
- for(;aIter != pTypeInfo->end();++aIter,++nEntryPos)
+ OTypeInfoMap::const_iterator aEnd = pTypeInfo->end();
+ for(;aIter != aEnd;++aIter,++nEntryPos)
{
if(aIter->second == _pType)
break;
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 71172b6c4..ac53e1900 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -166,6 +166,9 @@
#include <cppuhelper/exc_hlp.hxx>
#endif
#include "dsmeta.hxx"
+#include <boost/bind.hpp>
+#include <algorithm>
+#include <functional>
extern "C" void SAL_CALL createRegistryInfo_OTableControl()
{
@@ -255,7 +258,6 @@ OTableController::OTableController(const Reference< XMultiServiceFactory >& _rM)
InvalidateAll();
m_pTypeInfo = TOTypeInfoSP(new OTypeInfo());
m_pTypeInfo->aUIName = m_sTypeNames.GetToken(TYPE_OTHER);
- m_aTypeCollection.initUserDriverTypes(_rM);
}
// -----------------------------------------------------------------------------
OTableController::~OTableController()
@@ -1015,7 +1017,8 @@ void OTableController::loadData()
for(;pKeyBegin != pKeyEnd;++pKeyBegin)
{
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator rowIter = m_vRowList.begin();
- for(;rowIter != m_vRowList.end();++rowIter)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator rowEnd = m_vRowList.end();
+ for(;rowIter != rowEnd;++rowIter)
{
if((*rowIter)->GetActFieldDescr()->GetName() == *pKeyBegin)
{
@@ -1399,7 +1402,7 @@ void OTableController::alterColumns()
// third append the new columns
aIter = m_vRowList.begin();
- for(;aIter != m_vRowList.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OSL_ENSURE(*aIter,"OTableRow is null!");
OFieldDescription* pField = (*aIter)->GetActFieldDescr();
@@ -1437,7 +1440,7 @@ void OTableController::alterColumns()
if ( xKeyColumns.is() )
{
aIter = m_vRowList.begin();
- for(;aIter != m_vRowList.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OSL_ENSURE(*aIter,"OTableRow is null!");
OFieldDescription* pField = (*aIter)->GetActFieldDescr();
@@ -1551,9 +1554,7 @@ void OTableController::assignTable()
setEditable( xMeta.is() && !xMeta->isReadOnly() && (isAlterAllowed() || isDropAllowed() || isAddAllowed()) );
if(!isEditable())
{
- ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_vRowList.begin();
- for(; aIter != m_vRowList.end(); ++aIter)
- (*aIter)->SetReadOnly(sal_True);
+ ::std::for_each(m_vRowList.begin(),m_vRowList.end(),boost::bind( &OTableRow::SetReadOnly, _1, boost::cref( sal_True )));
}
m_bNew = sal_False;
// be notified when the table is in disposing
@@ -1612,7 +1613,8 @@ void OTableController::reSyncRows()
sal_Bool bAlterAllowed = isAlterAllowed();
sal_Bool bAddAllowed = isAddAllowed();
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_vRowList.begin();
- for(;aIter != m_vRowList.end();++aIter)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_vRowList.end();
+ for(;aIter != aEnd;++aIter)
{
OSL_ENSURE(*aIter,"OTableRow is null!");
OFieldDescription* pField = (*aIter)->GetActFieldDescr();
@@ -1636,7 +1638,8 @@ void OTableController::reSyncRows()
::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True);
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_vRowList.begin();
- for(sal_Int32 i=0;aIter != m_vRowList.end();++aIter)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aEnd = m_vRowList.end();
+ for(sal_Int32 i=0;aIter != aEnd;++aIter)
{
OFieldDescription* pFieldDesc = (*aIter)->GetActFieldDescr();
if (pFieldDesc && pFieldDesc->GetName().getLength() && bCase(sName,pFieldDesc->GetName()))
@@ -1702,8 +1705,6 @@ sal_Int32 OTableController::getFirstEmptyRowPosition() const
// -----------------------------------------------------------------------------
bool OTableController::isAutoIncrementPrimaryKey() const
{
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(getDataSource()->getPropertyValue(PROPERTY_URL)));
- DataSourceMetaData aMeta(eType);
- return aMeta.getAdvancedSettingsSupport().bAutoIncrementIsPrimaryKey;
+ return getSdbMetaData().isAutoIncrementPrimaryKey();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
index 1d8c59b76..86f710c66 100644
--- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
@@ -61,7 +61,8 @@ namespace dbaui
{
(*rxOStm) << (sal_Int32)pRows->size(); // first stream the size
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = pRows->begin();
- for(;aIter != pRows->end();++aIter)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aEnd = pRows->end();
+ for(;aIter != aEnd;++aIter)
(*rxOStm) << *(*aIter);
return sal_True;
}
diff --git a/dbaccess/source/ui/tabledesign/TableUndo.cxx b/dbaccess/source/ui/tabledesign/TableUndo.cxx
index 57aee4321..3ac4825b6 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.cxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.cxx
@@ -271,11 +271,12 @@ void OTableEditorDelUndoAct::Undo()
// Geloeschte Zeilen wieder einfuegen
ULONG nPos;
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_aDeletedRows.begin();
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_aDeletedRows.end();
::boost::shared_ptr<OTableRow> pNewOrigRow;
::std::vector< ::boost::shared_ptr<OTableRow> >* pOriginalRows = pTabEdCtrl->GetRowList();
- for(;aIter != m_aDeletedRows.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
pNewOrigRow.reset(new OTableRow( **aIter ));
nPos = (*aIter)->GetPos();
@@ -294,9 +295,10 @@ void OTableEditorDelUndoAct::Redo()
// Zeilen wieder loeschen
ULONG nPos;
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_aDeletedRows.begin();
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_aDeletedRows.end();
::std::vector< ::boost::shared_ptr<OTableRow> >* pOriginalRows = pTabEdCtrl->GetRowList();
- for(;aIter != m_aDeletedRows.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
nPos = (*aIter)->GetPos();
pOriginalRows->erase( pOriginalRows->begin()+nPos );
@@ -354,8 +356,9 @@ void OTableEditorInsUndoAct::Redo()
long nInsertRow = m_nInsPos;
::boost::shared_ptr<OTableRow> pRow;
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_vInsertedRows.begin();
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_vInsertedRows.end();
::std::vector< ::boost::shared_ptr<OTableRow> >* pRowList = pTabEdCtrl->GetRowList();
- for(;aIter != m_vInsertedRows.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
pRow.reset(new OTableRow( **aIter ));
pRowList->insert( pRowList->begin()+nInsertRow ,pRow );
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index 0e3125215..eaf7c45e5 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -171,6 +171,8 @@ namespace dbaui
virtual void SAL_CALL setDestinationTableName( const ::rtl::OUString& _destinationTableName ) throw (RuntimeException);
virtual Optional< ::rtl::OUString > SAL_CALL getCreatePrimaryKey() throw (RuntimeException);
virtual void SAL_CALL setCreatePrimaryKey( const Optional< ::rtl::OUString >& _newPrimaryKey ) throw (IllegalArgumentException, RuntimeException);
+ virtual sal_Bool SAL_CALL getUseHeaderLineAsColumnNames() throw (RuntimeException);
+ virtual void SAL_CALL setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames ) throw (RuntimeException);
virtual void SAL_CALL addCopyTableListener( const Reference< XCopyTableListener >& Listener ) throw (RuntimeException);
virtual void SAL_CALL removeCopyTableListener( const Reference< XCopyTableListener >& Listener ) throw (RuntimeException);
@@ -331,6 +333,7 @@ private:
sal_Int16 m_nOperation;
::rtl::OUString m_sDestinationTable;
Optional< ::rtl::OUString > m_aPrimaryKeyName;
+ sal_Bool m_bUseHeaderLineAsColumnNames;
// source
SharedConnection m_xSourceConnection;
@@ -381,6 +384,7 @@ CopyTableWizard::CopyTableWizard( const Reference< XMultiServiceFactory >& _rxOR
,m_nOperation( CopyTableOperation::CopyDefinitionAndData )
,m_sDestinationTable()
,m_aPrimaryKeyName( sal_False, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) ))
+ ,m_bUseHeaderLineAsColumnNames( sal_True )
,m_xSourceConnection()
,m_nCommandType( CommandType::COMMAND )
,m_pSourceObject()
@@ -522,7 +526,18 @@ void SAL_CALL CopyTableWizard::setCreatePrimaryKey( const Optional< ::rtl::OUStr
m_aPrimaryKeyName = _newPrimaryKey;
}
-
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL CopyTableWizard::getUseHeaderLineAsColumnNames() throw (RuntimeException)
+{
+ CopyTableAccessGuard aGuard( *this );
+ return m_bUseHeaderLineAsColumnNames;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL CopyTableWizard::setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames ) throw (RuntimeException)
+{
+ CopyTableAccessGuard aGuard( *this );
+ m_bUseHeaderLineAsColumnNames = _bUseHeaderLineAsColumnNames;
+}
//--------------------------------------------------------------------
void SAL_CALL CopyTableWizard::addCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException)
{
@@ -589,6 +604,7 @@ void CopyTableWizard::impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialo
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_attributesToDialog_nothrow" );
// primary key column
_rDialog.setCreatePrimaryKey( m_aPrimaryKeyName.IsPresent, m_aPrimaryKeyName.Value );
+ _rDialog.setUseHeaderLine(m_bUseHeaderLineAsColumnNames);
// everything else was passed at construction time already
}
@@ -606,6 +622,7 @@ void CopyTableWizard::impl_dialogToAttributes_nothrow( const OCopyTableWizard& _
m_sDestinationTable = _rDialog.getName();
m_nOperation = _rDialog.getOperation();
+ m_bUseHeaderLineAsColumnNames = _rDialog.UseHeaderLine();
}
//-------------------------------------------------------------------------
@@ -1018,18 +1035,18 @@ namespace
else
(m_xDest.get()->*_pSetter)( m_rDestPos, value );
}
-
- template< typename VALUE_TYPE >
+ template< typename VALUE_TYPE >
void transferComplexValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ),
void (SAL_CALL XParameters::*_pSetter)( sal_Int32, const VALUE_TYPE& ) )
{
- VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) );
+ const VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) );
+ {
if ( m_xSource->wasNull() )
m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] );
else
(m_xDest.get()->*_pSetter)( m_rDestPos, value );
+ }
}
-
private:
const sal_Int32& m_rSourcePos;
const sal_Int32& m_rDestPos;
@@ -1193,11 +1210,14 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
bContinue = _rxSourceResultSet->next();
if ( !bContinue )
+ {
break;
+ }
++nRowCount;
sal_Bool bInsertAutoIncrement = sal_True;
ODatabaseExport::TPositions::const_iterator aPosIter = aColumnMapping.begin();
+ ODatabaseExport::TPositions::const_iterator aPosEnd = aColumnMapping.end();
aCopyEvent.Error.clear();
try
@@ -1209,7 +1229,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
sal_Int32 nSourceColumn( 1 );
ValueTransfer aTransfer( nSourceColumn, nDestColumn, aSourceColTypes, xRow, xStatementParams );
- for ( ; aPosIter != aColumnMapping.end(); ++aPosIter )
+ for ( ; aPosIter != aPosEnd; ++aPosIter )
{
nDestColumn = aPosIter->first;
if ( nDestColumn == COLUMN_POSITION_NOT_FOUND )
@@ -1218,7 +1238,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
// otherwise we don't get the correct value when only the 2nd source column was selected
continue;
}
-
+
if ( bAutoIncrement && bInsertAutoIncrement )
{
xStatementParams->setInt( 1, nRowCount );
diff --git a/dbaccess/source/ui/uno/makefile.mk b/dbaccess/source/ui/uno/makefile.mk
index 8651a83fd..11a1c7c5f 100644
--- a/dbaccess/source/ui/uno/makefile.mk
+++ b/dbaccess/source/ui/uno/makefile.mk
@@ -51,8 +51,14 @@ SRC1FILES = \
copytablewizard.src
# ... object files ............................
+# workaround for issue http://qa.openoffice.org/issues/show_bug.cgi?id=102305 Linux specific
+.IF "$(COM)" == "GCC"
+NOOPTFILES=\
+ $(SLO)$/copytablewizard.obj
+.ENDIF
SLOFILES= \
+ $(SLO)$/copytablewizard.obj \
$(SLO)$/composerdialogs.obj \
$(SLO)$/unosqlmessage.obj \
$(SLO)$/unoadmin.obj \
@@ -62,13 +68,11 @@ SLOFILES= \
$(SLO)$/unoDirectSql.obj \
$(SLO)$/DBTypeWizDlg.obj \
$(SLO)$/DBTypeWizDlgSetup.obj \
- $(SLO)$/AdabasSettingsDlg.obj \
$(SLO)$/UserSettingsDlg.obj \
$(SLO)$/ColumnModel.obj \
$(SLO)$/ColumnControl.obj \
$(SLO)$/ColumnPeer.obj \
$(SLO)$/dbinteraction.obj \
- $(SLO)$/copytablewizard.obj \
$(SLO)$/textconnectionsettings_uno.obj
# --- Targets ----------------------------------
diff --git a/dbaccess/source/ui/uno/unoadmin.cxx b/dbaccess/source/ui/uno/unoadmin.cxx
index a4e71435d..31b493e3b 100644
--- a/dbaccess/source/ui/uno/unoadmin.cxx
+++ b/dbaccess/source/ui/uno/unoadmin.cxx
@@ -94,8 +94,7 @@ ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XM
{
DBG_CTOR(ODatabaseAdministrationDialog,NULL);
- m_pCollection = new ::dbaccess::ODsnTypeCollection();
- m_pCollection->initUserDriverTypes(m_aContext.getLegacyServiceFactory());
+ m_pCollection = new ::dbaccess::ODsnTypeCollection(_rxORB);
ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection);
}