summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/prj/d.lst7
-rw-r--r--dbaccess/source/core/api/KeySet.cxx534
-rw-r--r--dbaccess/source/core/api/KeySet.hxx27
-rw-r--r--dbaccess/source/core/api/OptimisticSet.cxx939
-rw-r--r--dbaccess/source/core/api/OptimisticSet.hxx99
-rw-r--r--dbaccess/source/core/api/PrivateRow.cxx142
-rw-r--r--dbaccess/source/core/api/PrivateRow.hxx69
-rw-r--r--dbaccess/source/core/api/RowSet.cxx3
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx26
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx4
-rw-r--r--dbaccess/source/core/api/WrappedResultSet.cxx23
-rw-r--r--dbaccess/source/core/api/makefile.mk1
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx17
-rw-r--r--dbaccess/source/core/inc/DatabaseDataProvider.hxx29
-rw-r--r--dbaccess/source/core/misc/DatabaseDataProvider.cxx126
-rw-r--r--dbaccess/source/core/misc/services.cxx22
-rw-r--r--dbaccess/source/ext/adabas/Acomponentmodule.cxx48
-rw-r--r--dbaccess/source/ext/adabas/Acomponentmodule.hxx15
-rw-r--r--dbaccess/source/ext/adabas/Aservices.cxx21
-rw-r--r--dbaccess/source/ext/adabas/adabasui.component34
-rw-r--r--dbaccess/source/ext/adabas/adabasui.dxp1
-rw-r--r--dbaccess/source/ext/adabas/exports.dxp1
-rw-r--r--dbaccess/source/ext/adabas/makefile.mk7
-rw-r--r--dbaccess/source/ext/macromigration/dbmm.component34
-rw-r--r--dbaccess/source/ext/macromigration/makefile.mk8
-rw-r--r--dbaccess/source/filter/migration/cfgservices.cxx21
-rw-r--r--dbaccess/source/filter/migration/dbacfg.component34
-rw-r--r--dbaccess/source/filter/migration/makefile.mk8
-rw-r--r--dbaccess/source/filter/xml/dbaxml.component49
-rw-r--r--dbaccess/source/filter/xml/makefile.mk8
-rw-r--r--dbaccess/source/filter/xml/xmlservices.cxx22
-rw-r--r--dbaccess/source/inc/registrationhelper.hxx10
-rw-r--r--dbaccess/source/sdbtools/misc/sdbt_services.cxx21
-rw-r--r--dbaccess/source/shared/registrationhelper.cxx48
-rw-r--r--dbaccess/source/ui/app/AppController.cxx11
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.cxx10
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.hxx3
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx1
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx4
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx2
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx2
-rw-r--r--dbaccess/source/ui/dlg/adodatalinks.cxx2
-rw-r--r--dbaccess/source/ui/dlg/odbcconfig.cxx10
-rw-r--r--dbaccess/source/ui/dlg/odbcconfig.hxx4
-rw-r--r--dbaccess/source/ui/inc/TableController.hxx2
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx2
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx4
-rw-r--r--dbaccess/source/ui/misc/uiservices.cxx22
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx3
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx15
-rw-r--r--dbaccess/util/dba.component63
-rw-r--r--dbaccess/util/dbu.component116
-rw-r--r--dbaccess/util/makefile.mk20
-rw-r--r--dbaccess/util/sdbt.component34
54 files changed, 1154 insertions, 1634 deletions
diff --git a/dbaccess/prj/d.lst b/dbaccess/prj/d.lst
index 383cc119c..4e1ab9c7f 100644
--- a/dbaccess/prj/d.lst
+++ b/dbaccess/prj/d.lst
@@ -51,3 +51,10 @@ touch: ..\%__SRC%\misc\dbaccess.hid %_DEST%\bin%_EXT%\dba.hid
..\inc\*.hxx %_DEST%\inc%_EXT%\dbaccess\*.hxx
..\inc\*.h %_DEST%\inc%_EXT%\dbaccess\*.h
+..\%__SRC%\misc\adabasui.component %_DEST%\xml%_EXT%\adabasui.component
+..\%__SRC%\misc\dba.component %_DEST%\xml%_EXT%\dba.component
+..\%__SRC%\misc\dbacfg.component %_DEST%\xml%_EXT%\dbacfg.component
+..\%__SRC%\misc\dbaxml.component %_DEST%\xml%_EXT%\dbaxml.component
+..\%__SRC%\misc\dbmm.component %_DEST%\xml%_EXT%\dbmm.component
+..\%__SRC%\misc\dbu.component %_DEST%\xml%_EXT%\dbu.component
+..\%__SRC%\misc\sdbt.component %_DEST%\xml%_EXT%\sdbt.component
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 3db4acdbc..6a7cd4087 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -53,9 +53,6 @@
#ifndef _COM_SUN_STAR_SDBC_XGENERATEDRESULTSET_HPP_
#include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
#endif
-#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_
-#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
-#endif
#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_
#include <com/sun/star/sdbc/XColumnLocate.hpp>
#endif
@@ -112,6 +109,7 @@
#endif
#include <string.h>
#include <rtl/logfile.hxx>
+#include "PrivateRow.hxx"
using namespace dbaccess;
using namespace ::connectivity;
@@ -148,134 +146,6 @@ namespace
}
}
}
- class OPrivateRow : public ::cppu::WeakImplHelper1<XRow>
- {
- ORowSetValueVector::Vector m_aRow;
- sal_Int32 m_nPos;
- public:
- OPrivateRow(const ORowSetValueVector::Vector& i_aRow) : m_aRow(i_aRow),m_nPos(0)
- {
- }
- virtual ::sal_Bool SAL_CALL wasNull( ) throw (SQLException, RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Bool SAL_CALL getBoolean( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Int8 SAL_CALL getByte( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Int16 SAL_CALL getShort( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Int32 SAL_CALL getInt( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Int64 SAL_CALL getLong( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual float SAL_CALL getFloat( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual double SAL_CALL getDouble( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Sequence< ::sal_Int8 > SAL_CALL getBytes( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Any SAL_CALL getObject( ::sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw (SQLException, RuntimeException);
- virtual Reference< XRef > SAL_CALL getRef( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< XBlob > SAL_CALL getBlob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< XClob > SAL_CALL getClob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< XArray > SAL_CALL getArray( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- };
- ::sal_Bool SAL_CALL OPrivateRow::wasNull( ) throw (SQLException, RuntimeException)
- {
- return m_aRow[m_nPos].isNull();
- }
- ::rtl::OUString SAL_CALL OPrivateRow::getString( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Bool SAL_CALL OPrivateRow::getBoolean( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Int8 SAL_CALL OPrivateRow::getByte( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Int16 SAL_CALL OPrivateRow::getShort( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Int32 SAL_CALL OPrivateRow::getInt( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Int64 SAL_CALL OPrivateRow::getLong( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- float SAL_CALL OPrivateRow::getFloat( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- double SAL_CALL OPrivateRow::getDouble( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- Sequence< ::sal_Int8 > SAL_CALL OPrivateRow::getBytes( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::com::sun::star::util::Date SAL_CALL OPrivateRow::getDate( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::com::sun::star::util::Time SAL_CALL OPrivateRow::getTime( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::com::sun::star::util::DateTime SAL_CALL OPrivateRow::getTimestamp( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OPrivateRow::getBinaryStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< ::com::sun::star::io::XInputStream >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OPrivateRow::getCharacterStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< ::com::sun::star::io::XInputStream >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Any SAL_CALL OPrivateRow::getObject( ::sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos].makeAny();
- }
- Reference< XRef > SAL_CALL OPrivateRow::getRef( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< XRef >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Reference< XBlob > SAL_CALL OPrivateRow::getBlob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< XBlob >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Reference< XClob > SAL_CALL OPrivateRow::getClob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< XClob >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Reference< XArray > SAL_CALL OPrivateRow::getArray( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< XArray >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
}
DBG_NAME(OKeySet)
// -------------------------------------------------------------------------
@@ -315,29 +185,30 @@ OKeySet::~OKeySet()
OSL_ENSURE(0,"Unknown Exception occured");
}
m_xComposer = NULL;
- delete m_pKeyColumnNames;
- delete m_pColumnNames;
- delete m_pParameterNames;
- delete m_pForeignColumnNames;
DBG_DTOR(OKeySet,NULL);
}
-// -----------------------------------------------------------------------------
-void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter)
+void OKeySet::initColumns()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::construct" );
- OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
-
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false;
- m_pKeyColumnNames = new SelectColumnsMetaData(bCase);
- m_pColumnNames = new SelectColumnsMetaData(bCase);
- m_pParameterNames = new SelectColumnsMetaData(bCase);
- m_pForeignColumnNames = new SelectColumnsMetaData(bCase);
+ m_pKeyColumnNames.reset( new SelectColumnsMetaData(bCase) );
+ m_pColumnNames.reset( new SelectColumnsMetaData(bCase) );
+ m_pParameterNames.reset( new SelectColumnsMetaData(bCase) );
+ m_pForeignColumnNames.reset( new SelectColumnsMetaData(bCase) );
+}
+void OKeySet::findTableColumnsMatching_throw(const Any& i_aTable
+ ,const Reference<XDatabaseMetaData>& i_xMeta
+ ,const Reference<XNameAccess>& i_xQueryColumns)
+{
+ // first ask the database itself for the best columns which can be used
+ Sequence< ::rtl::OUString> aBestColumnNames;
+ Reference<XNameAccess> xKeyColumns = getPrimaryKeyColumns_throw(i_aTable);
+ if ( xKeyColumns.is() )
+ aBestColumnNames = xKeyColumns->getElementNames();
- Reference<XNameAccess> xKeyColumns = getKeyColumns();
- Reference<XColumnsSupplier> xSup(m_xComposer,UNO_QUERY);
- Reference<XNameAccess> xSourceColumns = m_xTable->getColumns();
+ const Reference<XColumnsSupplier> xTblColSup(i_aTable,UNO_QUERY_THROW);
+ const Reference<XNameAccess> xTblColumns = xTblColSup->getColumns();
// locate parameter in select columns
Reference<XParametersSupplier> xParaSup(m_xComposer,UNO_QUERY);
Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters();
@@ -347,83 +218,82 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
{
Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW);
xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i];
- }
-
- ::rtl::OUString sCatalog,sSchema,sTable;
-
- Reference<XPropertySet> xTableProp(m_xTable,UNO_QUERY);
- Any aCatalog = xTableProp->getPropertyValue(PROPERTY_CATALOGNAME);
- aCatalog >>= sCatalog;
- xTableProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
- xTableProp->getPropertyValue(PROPERTY_NAME) >>= sTable;
-
- ::std::vector< ::rtl::OUString> aBestRowColumnNames;
- Reference<XResultSet> xBestRes(xMeta->getBestRowIdentifier(aCatalog,sSchema,sTable,0,sal_False));
- Reference<XRow> xBestRow(xBestRes,uno::UNO_QUERY);
- while ( xBestRes->next() )
- {
- aBestRowColumnNames.push_back(xBestRow->getString(2));
}
- Sequence< ::rtl::OUString> aBestColumnNames;
- if ( !aBestRowColumnNames.empty() )
+ if ( m_sUpdateTableName.getLength() )
{
- aBestColumnNames = Sequence< ::rtl::OUString>(&aBestRowColumnNames[0],aBestRowColumnNames.size());
- ::dbaccess::getColumnPositions(xSup->getColumns(),aBestColumnNames,m_sUpdateTableName,(*m_pKeyColumnNames));
+ ::dbaccess::getColumnPositions(i_xQueryColumns,aBestColumnNames,m_sUpdateTableName,(*m_pKeyColumnNames),true);
+ ::dbaccess::getColumnPositions(i_xQueryColumns,xTblColumns->getElementNames(),m_sUpdateTableName,(*m_pColumnNames),true);
+ ::dbaccess::getColumnPositions(i_xQueryColumns,aParameterColumns,m_sUpdateTableName,(*m_pParameterNames),true);
}
-
- if (m_pKeyColumnNames->empty() && xKeyColumns.is())
+ else
{
- aBestColumnNames = xKeyColumns->getElementNames();
- ::dbaccess::getColumnPositions(xSup->getColumns(),aBestColumnNames,m_sUpdateTableName,(*m_pKeyColumnNames));
+ ::rtl::OUString sCatalog,sSchema,sTable;
+ Reference<XPropertySet> xTableProp(i_aTable,UNO_QUERY);
+ Any aCatalog = xTableProp->getPropertyValue(PROPERTY_CATALOGNAME);
+ aCatalog >>= sCatalog;
+ xTableProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
+ xTableProp->getPropertyValue(PROPERTY_NAME) >>= sTable;
+ const ::rtl::OUString sComposedUpdateTableName = dbtools::composeTableName( i_xMeta, sCatalog, sSchema, sTable, sal_False, ::dbtools::eInDataManipulation );
+ ::dbaccess::getColumnPositions(i_xQueryColumns,aBestColumnNames,sComposedUpdateTableName,(*m_pKeyColumnNames),true);
+ ::dbaccess::getColumnPositions(i_xQueryColumns,xTblColumns->getElementNames(),sComposedUpdateTableName,(*m_pColumnNames),true);
+ ::dbaccess::getColumnPositions(i_xQueryColumns,aParameterColumns,sComposedUpdateTableName,(*m_pParameterNames),true);
}
- ::dbaccess::getColumnPositions(xSup->getColumns(),xSourceColumns->getElementNames(),m_sUpdateTableName,(*m_pColumnNames));
- ::dbaccess::getColumnPositions(xSup->getColumns(),aParameterColumns,m_sUpdateTableName,(*m_pParameterNames));
- SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
- SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
for(;aPosIter != aPosEnd;++aPosIter)
{
- if(xSourceColumns->hasByName(aPosIter->first))
+ if ( xTblColumns->hasByName(aPosIter->second.sRealName) )
{
- Reference<XPropertySet> xProp(xSourceColumns->getByName(aPosIter->first),UNO_QUERY);
- sal_Bool bAuto = sal_Bool();
+ Reference<XPropertySet> xProp(xTblColumns->getByName(aPosIter->second.sRealName),UNO_QUERY);
+ sal_Bool bAuto = sal_False;
if( (xProp->getPropertyValue(PROPERTY_ISAUTOINCREMENT) >>= bAuto) && bAuto)
m_aAutoColumns.push_back(aPosIter->first);
}
}
-
- // the first row is empty because it's now easier for us to distinguish when we are beforefirst or first
- // without extra varaible to be set
- m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow> >(0,NULL))));
-
- m_aKeyIter = m_aKeyMap.begin();
-
+}
+::rtl::OUStringBuffer OKeySet::createKeyFilter()
+{
static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
- Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData();
const ::rtl::OUString aQuote = getIdentifierQuoteString();
- m_aSelectComposedTableName = getComposedTableName(sCatalog,sSchema,sTable);
-
- ::rtl::OUString sComposedName;
- sCatalog = sSchema = sTable = ::rtl::OUString();
- ::dbtools::qualifiedNameComponents(xMetaData,m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
- sComposedName = ::dbtools::composeTableName( xMetaData, sCatalog, sSchema, sTable, sal_True, ::dbtools::eInDataManipulation );
-
::rtl::OUStringBuffer aFilter;
static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM("."));
static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
// create the where clause
- aPosEnd = (*m_pKeyColumnNames).end();
- for(aPosIter = (*m_pKeyColumnNames).begin();aPosIter != aPosEnd;)
+ Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
+ SelectColumnsMetaData::iterator aPosEnd = m_pKeyColumnNames->end();
+ for(SelectColumnsMetaData::iterator aPosIter = m_pKeyColumnNames->begin();aPosIter != aPosEnd;)
{
- aFilter.append(sComposedName);
+ aFilter.append(::dbtools::quoteTableName( xMeta,aPosIter->second.sTableName,::dbtools::eInDataManipulation));
aFilter.append(s_sDot);
- aFilter.append(::dbtools::quoteName( aQuote,aPosIter->first));
+ aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sRealName));
aFilter.append(s_sParam);
++aPosIter;
if(aPosIter != aPosEnd)
aFilter.append(aAnd);
}
+ return aFilter;
+}
+// -----------------------------------------------------------------------------
+void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::construct" );
+ OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
+ initColumns();
+
+ Reference<XNameAccess> xKeyColumns = getKeyColumns();
+ Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
+ Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY);
+ const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
+ findTableColumnsMatching_throw(makeAny(m_xTable),xMeta,xQueryColumns);
+
+ // the first row is empty because it's now easier for us to distinguish when we are beforefirst or first
+ // without extra varaible to be set
+ m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow> >(0,NULL))));
+ m_aKeyIter = m_aKeyMap.begin();
+
+ ::rtl::OUStringBuffer aFilter = createKeyFilter();
Reference< XSingleSelectQueryComposer> xSourceComposer(m_xComposer,UNO_QUERY);
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
@@ -434,6 +304,10 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
const Sequence< ::rtl::OUString> aSeq = xSelectTables->getElementNames();
if ( aSeq.getLength() > 1 ) // special handling for join
{
+ static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
+ const ::rtl::OUString aQuote = getIdentifierQuoteString();
+ static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM("."));
+ static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
const ::rtl::OUString* pIter = aSeq.getConstArray();
const ::rtl::OUString* pEnd = pIter + aSeq.getLength();
for(;pIter != pEnd;++pIter)
@@ -442,13 +316,12 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
{
connectivity::OSQLTable xSelColSup(xSelectTables->getByName(*pIter),uno::UNO_QUERY);
Reference<XPropertySet> xProp(xSelColSup,uno::UNO_QUERY);
- ::rtl::OUString sSelectTableName = ::dbtools::composeTableName( xMetaData, xProp, ::dbtools::eInDataManipulation, false, false, false );
- Reference<XNameAccess > xSelectColumns = xSup->getColumns();
+ ::rtl::OUString sSelectTableName = ::dbtools::composeTableName( xMeta, xProp, ::dbtools::eInDataManipulation, false, false, false );
- ::dbaccess::getColumnPositions(xSelectColumns,xSelColSup->getColumns()->getElementNames(),sSelectTableName,(*m_pForeignColumnNames));
+ ::dbaccess::getColumnPositions(xQueryColumns,xSelColSup->getColumns()->getElementNames(),sSelectTableName,(*m_pForeignColumnNames));
- aPosEnd = (*m_pForeignColumnNames).end();
- for(aPosIter = (*m_pForeignColumnNames).begin();aPosIter != aPosEnd;++aPosIter)
+ SelectColumnsMetaData::iterator aPosEnd = (*m_pForeignColumnNames).end();
+ for(SelectColumnsMetaData::iterator aPosIter = (*m_pForeignColumnNames).begin();aPosIter != aPosEnd;++aPosIter)
{
// look for columns not in the source columns to use them as filter as well
// if ( !xSourceColumns->hasByName(aPosIter->first) )
@@ -457,7 +330,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
aFilter.append(aAnd);
aFilter.append(::dbtools::quoteName( aQuote,sSelectTableName));
aFilter.append(s_sDot);
- aFilter.append(::dbtools::quoteName( aQuote,aPosIter->first));
+ aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sRealName));
aFilter.append(s_sParam);
}
}
@@ -465,17 +338,40 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
}
}
} // if ( aSeq.getLength() > 1 ) // special handling for join
-
- if ( i_sRowSetFilter.getLength() )
+ executeStatement(aFilter,i_sRowSetFilter,xAnalyzer);
+}
+void OKeySet::executeStatement(::rtl::OUStringBuffer& io_aFilter,const ::rtl::OUString& i_sRowSetFilter,Reference<XSingleSelectQueryComposer>& io_xAnalyzer)
+{
+ bool bFilterSet = i_sRowSetFilter.getLength() != 0;
+ if ( bFilterSet )
{
FilterCreator aFilterCreator;
aFilterCreator.append( i_sRowSetFilter );
- aFilterCreator.append( aFilter.makeStringAndClear() );
- aFilter = aFilterCreator.getComposedAndClear();
+ aFilterCreator.append( io_aFilter.makeStringAndClear() );
+ io_aFilter = aFilterCreator.getComposedAndClear();
}
- xAnalyzer->setFilter(aFilter.makeStringAndClear());
- m_xStatement = m_xConnection->prepareStatement(xAnalyzer->getQueryWithSubstitution());
- ::comphelper::disposeComponent(xAnalyzer);
+ io_xAnalyzer->setFilter(io_aFilter.makeStringAndClear());
+ if ( bFilterSet )
+ {
+ Sequence< Sequence< PropertyValue > > aFilter2 = io_xAnalyzer->getStructuredFilter();
+ const Sequence< PropertyValue >* pOr = aFilter2.getConstArray();
+ const Sequence< PropertyValue >* pOrEnd = pOr + aFilter2.getLength();
+ for(;pOr != pOrEnd;++pOr)
+ {
+ const PropertyValue* pAnd = pOr->getConstArray();
+ const PropertyValue* pAndEnd = pAnd + pOr->getLength();
+ for(;pAnd != pAndEnd;++pAnd)
+ {
+ ::rtl::OUString sValue;
+ if ( !(pAnd->Value >>= sValue) || !(sValue.equalsAscii("?") || sValue.matchAsciiL(":",1,0)) )
+ { // we have a criteria which has to be taken into account for updates
+ m_aFilterColumns.push_back(pAnd->Name);
+ }
+ }
+ }
+ }
+ m_xStatement = m_xConnection->prepareStatement(io_xAnalyzer->getQueryWithSubstitution());
+ ::comphelper::disposeComponent(io_xAnalyzer);
}
// -------------------------------------------------------------------------
Any SAL_CALL OKeySet::getBookmark() throw(SQLException, RuntimeException)
@@ -558,7 +454,7 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
for(;aIter != aPosEnd;++aIter)
{
- aCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ aCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
aCondition.append(aEqual);
aCondition.append(aAnd);
}
@@ -663,7 +559,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
//if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first))
if ( m_pKeyColumnNames->find(aIter->first) != m_pKeyColumnNames->end() )
{
- sKeyCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ sKeyCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
if((_rOrginalRow->get())[aIter->second.nPosition].isNull())
sKeyCondition.append(sIsNull);
else
@@ -678,7 +574,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
{
if((*aIndexIter)->hasByName(aIter->first))
{
- sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
if((_rOrginalRow->get())[aIter->second.nPosition].isNull())
sIndexCondition.append(sIsNull);
else
@@ -693,7 +589,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
}
if((_rInsertRow->get())[aIter->second.nPosition].isModified())
{
- aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ aSql.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
aSql.append(aPara);
}
}
@@ -727,62 +623,74 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
::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.makeStringAndClear()));
+
+ ::rtl::OUString sEmpty;
+ executeUpdate(_rInsertRow ,_rOrginalRow,aSql.makeStringAndClear(),sEmpty,aIndexColumnPositions);
+}
+// -----------------------------------------------------------------------------
+void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,const ::std::vector<sal_Int32>& _aIndexColumnPositions)
+{
+ // now create end execute the prepared statement
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
- i = 1;
- // first the set values
bool bRefetch = true;
- aIter = m_pColumnNames->begin();
- sal_uInt16 j = 0;
Reference<XRow> xRow;
+ sal_Int32 i = 1;
+ // first the set values
+ SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
+ sal_uInt16 j = 0;
for(;aIter != aEnd;++aIter,++j)
{
- sal_Int32 nPos = aIter->second.nPosition;
- if((_rInsertRow->get())[nPos].isModified())
+ if ( !i_sTableName.getLength() || aIter->second.sTableName == i_sTableName )
{
- if ( bRefetch )
+ sal_Int32 nPos = aIter->second.nPosition;
+ if((_rInsertRow->get())[nPos].isModified())
{
- bRefetch = ::std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),aIter->first) == m_aFilterColumns.end();
- if ( !bRefetch )
+ if ( bRefetch )
{
- xRow = new OPrivateRow(_rInsertRow->get());
+ bRefetch = ::std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),aIter->second.sRealName) == m_aFilterColumns.end();
}
+ impl_convertValue_throw(_rInsertRow,aIter->second);
+ (_rInsertRow->get())[nPos].setSigned((_rOrginalRow->get())[nPos].isSigned());
+ setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
}
-
- impl_convertValue_throw(_rInsertRow,aIter->second);
- (_rInsertRow->get())[nPos].setSigned((_rOrginalRow->get())[nPos].isSigned());
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
}
}
// and then the values of the where condition
- aIter = (*m_pKeyColumnNames).begin();
- aEnd = (*m_pKeyColumnNames).end();
+ aIter = m_pKeyColumnNames->begin();
+ aEnd = m_pKeyColumnNames->end();
j = 0;
- for(;aIter != aEnd;++aIter,++i,++j)
+ for(;aIter != aEnd;++aIter,++j)
{
- setParameter(i,xParameter,(_rOrginalRow->get())[aIter->second.nPosition],aIter->second.nType,aIter->second.nScale);
+ if ( !i_sTableName.getLength() || aIter->second.sTableName == i_sTableName )
+ {
+ 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;
- aIter = m_pColumnNames->begin();
- for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j,++aIter)
+ if ( !_aIndexColumnPositions.empty() )
{
- setParameter(i,xParameter,(_rOrginalRow->get())[*aIdxColIter],(_rOrginalRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
+ // now we have to set the index values
+ ::std::vector<sal_Int32>::const_iterator aIdxColIter = _aIndexColumnPositions.begin();
+ ::std::vector<sal_Int32>::const_iterator aIdxColEnd = _aIndexColumnPositions.end();
+ j = 0;
+ aIter = m_pColumnNames->begin();
+ for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j,++aIter)
+ {
+ setParameter(i,xParameter,(_rOrginalRow->get())[*aIdxColIter],(_rOrginalRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
+ }
}
-
- m_bUpdated = xPrep->executeUpdate() > 0;
+ const sal_Int32 nRowsUpdated = xPrep->executeUpdate();
+ m_bUpdated = nRowsUpdated > 0;
if(m_bUpdated)
{
const sal_Int32 nBookmark = ::comphelper::getINT32((_rInsertRow->get())[0].getAny());
m_aKeyIter = m_aKeyMap.find(nBookmark);
m_aKeyIter->second.second.first = 2;
m_aKeyIter->second.second.second = xRow;
-
copyRowValue(_rInsertRow,m_aKeyIter->second.first,nBookmark);
+ tryRefetch(_rInsertRow,bRefetch);
}
}
// -------------------------------------------------------------------------
@@ -804,12 +712,17 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
sal_Int32 j = 1;
+ bool bRefetch = true;
sal_Bool bModified = sal_False;
for(;aIter != aEnd;++aIter,++j)
{
if((_rInsertRow->get())[aIter->second.nPosition].isModified())
{
- aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ if ( bRefetch )
+ {
+ bRefetch = ::std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),aIter->second.sRealName) == m_aFilterColumns.end();
+ }
+ aSql.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
aSql.append(aComma);
aValues.append(aPara);
bModified = sal_True;
@@ -822,22 +735,33 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
aValues.setCharAt(aValues.getLength()-1,')');
aSql.append(aValues.makeStringAndClear());
// now create,fill and execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
+ ::rtl::OUString sEmpty;
+ executeInsert(_rInsertRow,aSql.makeStringAndClear(),sEmpty,bRefetch);
+}
+// -------------------------------------------------------------------------
+void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,bool bRefetch )
+{
+ // now create,fill and execute the prepared statement
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
- aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
for(sal_Int32 i = 1;aIter != aEnd;++aIter)
{
- const sal_Int32 nPos = aIter->second.nPosition;
- if((_rInsertRow->get())[nPos].isModified())
+ if ( !i_sTableName.getLength() || aIter->second.sTableName == i_sTableName )
{
- if((_rInsertRow->get())[nPos].isNull())
- xParameter->setNull(i++,(_rInsertRow->get())[nPos].getTypeKind());
- else
+ const sal_Int32 nPos = aIter->second.nPosition;
+ if((_rInsertRow->get())[nPos].isModified())
{
- impl_convertValue_throw(_rInsertRow,aIter->second);
- (_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]);
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
+ if((_rInsertRow->get())[nPos].isNull())
+ xParameter->setNull(i++,(_rInsertRow->get())[nPos].getTypeKind());
+ else
+ {
+ impl_convertValue_throw(_rInsertRow,aIter->second);
+ (_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]);
+ setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
+ }
}
}
}
@@ -888,7 +812,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
::comphelper::disposeComponent(xPrep);
- if ( !bAutoValuesFetched && m_bInserted )
+ if ( !i_sTableName.getLength() && !bAutoValuesFetched && m_bInserted )
{
// first check if all key column values were set
const ::rtl::OUString sMax(RTL_CONSTASCII_USTRINGPARAM(" MAX("));
@@ -901,10 +825,12 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
for (;aAutoIter != aAutoEnd; ++aAutoIter)
{
// we will only fetch values which are keycolumns
- if ( m_pKeyColumnNames->find(*aAutoIter) != aEnd )
+ SelectColumnsMetaData::iterator aFind = m_pKeyColumnNames->find(*aAutoIter);
+ if ( aFind != aEnd )
{
sMaxStmt += sMax;
- sMaxStmt += ::dbtools::quoteName( sQuote,*aAutoIter);
+ sMaxStmt += ::dbtools::quoteName( sQuote,aFind->second.sRealName
+);
sMaxStmt += sMaxEnd;
}
}
@@ -915,7 +841,9 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
::rtl::OUString sStmt = ::rtl::OUString::createFromAscii("SELECT ");
sStmt += sMaxStmt;
sStmt += ::rtl::OUString::createFromAscii("FROM ");
- sStmt += m_aSelectComposedTableName;
+ ::rtl::OUString sCatalog,sSchema,sTable;
+ ::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
+ sStmt += ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable );
try
{
// now fetch the autoincrement values
@@ -945,13 +873,67 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
{
OKeySetMatrix::iterator aKeyIter = m_aKeyMap.end();
--aKeyIter;
- ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >((*m_pKeyColumnNames).size());
+ ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size());
copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1);
-
m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(aKeyIter->first + 1,OKeySetValue(aKeyRow,::std::pair<sal_Int32,Reference<XRow> >(1,NULL)))).first;
// now we set the bookmark for this row
(_rInsertRow->get())[0] = makeAny((sal_Int32)m_aKeyIter->first);
+ tryRefetch(_rInsertRow,bRefetch);
+ }
+}
+void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch)
+{
+ if ( bRefetch )
+ {
+ // we just areassign the base members
+ try
+ {
+ Reference< XParameters > xParameter(m_xStatement,UNO_QUERY);
+ OSL_ENSURE(xParameter.is(),"No Parameter interface!");
+ xParameter->clearParameters();
+
+ sal_Int32 nPos=1;
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaIter;
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd;
+ OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first);
+ if ( aUpdateFind == m_aUpdatedParameter.end() )
+ {
+ aParaIter = m_aParameterValueForCache.get().begin();
+ aParaEnd = m_aParameterValueForCache.get().end();
+ }
+ else
+ {
+ aParaIter = aUpdateFind->second.get().begin();
+ aParaEnd = aUpdateFind->second.get().end();
+ }
+
+ for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
+ {
+ ::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() );
+ }
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter2 = m_aKeyIter->second.first->get().begin();
+ SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
+ SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter,++aIter2,++nPos)
+ setParameter(nPos,xParameter,*aIter2,aPosIter->second.nType,aPosIter->second.nScale);
+ aPosIter = (*m_pForeignColumnNames).begin();
+ aPosEnd = (*m_pForeignColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter,++aIter2,++nPos)
+ setParameter(nPos,xParameter,*aIter2,aPosIter->second.nType,aPosIter->second.nScale);
+
+ m_xSet = m_xStatement->executeQuery();
+ OSL_ENSURE(m_xSet.is(),"No resultset form statement!");
+ bRefetch = m_xSet->next();
+ }
+ catch(Exception)
+ {
+ bRefetch = false;
+ }
+ }
+ if ( !bRefetch )
+ {
+ m_aKeyIter->second.second.second = new OPrivateRow(_rInsertRow->get());
}
}
// -----------------------------------------------------------------------------
@@ -990,6 +972,7 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sa
for(;aPosIter != aPosEnd;++aPosIter,++aIter)
{
*aIter = (_rInsertRow->get())[aPosIter->second.nPosition];
+ impl_convertValue_throw(_rKeyRow,aPosIter->second);
aIter->setTypeKind(aPosIter->second.nType);
}
}
@@ -1031,7 +1014,7 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
{
if ( m_pKeyColumnNames->find(aIter->first) != m_pKeyColumnNames->end() )
{
- aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ aSql.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
if((_rDeleteRow->get())[aIter->second.nPosition].isNull())
{
OSL_ENSURE(0,"can a primary key be null");
@@ -1049,7 +1032,7 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
{
if((*aIndexIter)->hasByName(aIter->first))
{
- sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
if((_rDeleteRow->get())[aIter->second.nPosition].isNull())
sIndexCondition.append(::rtl::OUString::createFromAscii(" IS NULL"));
else
@@ -1213,8 +1196,8 @@ void SAL_CALL OKeySet::beforeFirst( ) throw(SQLException, RuntimeException)
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::beforeFirst" );
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
m_aKeyIter = m_aKeyMap.begin();
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
+ m_xRow = NULL;
+ ::comphelper::disposeComponent(m_xSet);
}
// -----------------------------------------------------------------------------
void SAL_CALL OKeySet::afterLast( ) throw(SQLException, RuntimeException)
@@ -1223,8 +1206,8 @@ void SAL_CALL OKeySet::afterLast( ) throw(SQLException, RuntimeException)
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
fillAllRows();
m_aKeyIter = m_aKeyMap.end();
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
+ m_xRow = NULL;
+ ::comphelper::disposeComponent(m_xSet);
}
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException)
@@ -1328,8 +1311,14 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
if(isBeforeFirst() || isAfterLast() || !m_xStatement.is())
return;
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
+ m_xRow = NULL;
+ ::comphelper::disposeComponent(m_xSet);
+
+ if ( m_aKeyIter->second.second.second.is() )
+ {
+ m_xRow = m_aKeyIter->second.second.second;
+ return;
+ }
// we just areassign the base members
Reference< XParameters > xParameter(m_xStatement,UNO_QUERY);
OSL_ENSURE(xParameter.is(),"No Parameter interface!");
@@ -1340,8 +1329,7 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd;
OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first);
if ( aUpdateFind == m_aUpdatedParameter.end() )
- {
-
+ {
aParaIter = m_aParameterValueForCache.get().begin();
aParaEnd = m_aParameterValueForCache.get().end();
}
@@ -1355,6 +1343,8 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
{
::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() );
}
+
+ // now set the primary key column values
connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->get().begin();
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
@@ -1689,7 +1679,7 @@ void OKeySet::impl_convertValue_throw(const ORowSetRow& _rInsertRow,const Select
sal_Int32 nIndex = sValue.indexOf('.');
if ( nIndex != -1 )
{
- aValue = sValue.copy(0,nIndex + (i_aMetaData.nScale > 0 ? i_aMetaData.nScale + 1 : 0));
+ aValue = sValue.copy(0,::std::min(sValue.getLength(),nIndex + (i_aMetaData.nScale > 0 ? i_aMetaData.nScale + 1 : 0)));
}
}
break;
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 947f8e161..5403a56d6 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -35,14 +35,14 @@
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
#endif
+#include <memory>
#include <map>
#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
#include <com/sun/star/lang/XUnoTunnel.hpp>
#endif
-#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYANALYZER_HPP_
#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
-#endif
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
#ifndef _COMPHELPER_STLTYPES_HXX_
#include <comphelper/stl_types.hxx>
#endif
@@ -93,17 +93,18 @@ namespace dbaccess
// is used when the source supports keys
class OKeySet : public OCacheSet
{
+ protected:
OKeySetMatrix m_aKeyMap;
OKeySetMatrix::iterator m_aKeyIter;
-
+
::std::vector< ::rtl::OUString > m_aAutoColumns; // contains all columns which are autoincrement ones
OUpdatedParameter m_aUpdatedParameter; // contains all parameter which have been updated and are needed for refetching
ORowSetValueVector m_aParameterValueForCache;
- SelectColumnsMetaData* m_pKeyColumnNames; // contains all key column names
- SelectColumnsMetaData* m_pColumnNames; // contains all column names
- SelectColumnsMetaData* m_pParameterNames; // contains all parameter names
- SelectColumnsMetaData* m_pForeignColumnNames; // contains all column names of the rest
+ ::std::auto_ptr<SelectColumnsMetaData> m_pKeyColumnNames; // contains all key column names
+ ::std::auto_ptr<SelectColumnsMetaData> m_pColumnNames; // contains all column names
+ ::std::auto_ptr<SelectColumnsMetaData> m_pParameterNames; // contains all parameter names
+ ::std::auto_ptr<SelectColumnsMetaData> m_pForeignColumnNames; // contains all column names of the rest
connectivity::OSQLTable m_xTable; // reference to our table
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xTableKeys;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement> m_xStatement;
@@ -111,7 +112,6 @@ namespace dbaccess
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow> m_xRow;
::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer > m_xComposer;
::rtl::OUString m_sUpdateTableName;
- ::rtl::OUString m_aSelectComposedTableName;
::std::vector< ::rtl::OUString > m_aFilterColumns;
sal_Bool m_bRowCountFinal;
@@ -141,7 +141,16 @@ namespace dbaccess
sal_Bool fetchRow();
void impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData);
- protected:
+ void initColumns();
+ void findTableColumnsMatching_throw( const ::com::sun::star::uno::Any& i_aTable
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& i_xMeta
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns);
+ ::rtl::OUStringBuffer createKeyFilter();
+ void tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch);
+ void executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,const ::std::vector<sal_Int32>& _aIndexColumnPositions = ::std::vector<sal_Int32>());
+ void executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName = ::rtl::OUString(),bool bRefetch = false);
+ void executeStatement(::rtl::OUStringBuffer& io_aFilter,const ::rtl::OUString& i_sRowSetFilter,::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer>& io_xAnalyzer);
+
virtual ~OKeySet();
public:
OKeySet(const connectivity::OSQLTable& _xTable,
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index 1dc198140..b68910d0f 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -84,23 +84,6 @@ using namespace ::osl;
DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUStringBuffer,TSQLStatements);
namespace
{
- void lcl_fillIndexColumns(const Reference<XIndexAccess>& _xIndexes, ::std::vector< Reference<XNameAccess> >& _rAllIndexColumns)
- {
- if ( _xIndexes.is() )
- {
- Reference<XPropertySet> xIndexColsSup;
- sal_Int32 nCount = _xIndexes->getCount();
- for(sal_Int32 j = 0 ; j < nCount ; ++j)
- {
- xIndexColsSup.set(_xIndexes->getByIndex(j),UNO_QUERY);
- if( xIndexColsSup.is()
- && comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
- && !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
- )
- _rAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY)->getColumns());
- }
- }
- }
void lcl_fillKeyCondition(const ::rtl::OUString& i_sTableName,const ::rtl::OUString& i_sQuotedColumnName,const ORowSetValue& i_aValue,TSQLStatements& io_aKeyConditions)
{
::rtl::OUStringBuffer& rKeyCondition = io_aKeyConditions[i_sTableName];
@@ -120,14 +103,9 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext,
const Reference< XConnection>& i_xConnection,
const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache)
- :m_aSqlParser( _rContext.getLegacyServiceFactory() )
+ :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache)
+ ,m_aSqlParser( _rContext.getLegacyServiceFactory() )
,m_aSqlIterator( i_xConnection, Reference<XTablesSupplier>(_xComposer,UNO_QUERY)->getTables(), m_aSqlParser, NULL )
- ,m_aParameterValueForCache(_aParameterValueForCache)
- ,m_pKeyColumnNames(NULL)
- ,m_pColumnNames(NULL)
- ,m_pParameterNames(NULL)
- ,m_xComposer(_xComposer)
- ,m_bRowCountFinal(sal_False)
,m_bResultSetChanged(false)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::OptimisticSet" );
@@ -136,20 +114,6 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext,
// -----------------------------------------------------------------------------
OptimisticSet::~OptimisticSet()
{
- try
- {
- ::comphelper::disposeComponent(m_xStatement);
- }
- catch(Exception&)
- {
- m_xStatement.clear();
- }
- catch(...)
- {
- OSL_ENSURE(0,"Unknown Exception occured");
- }
- m_xComposer.clear();
-
DBG_DTOR(OptimisticSet,NULL);
}
// -----------------------------------------------------------------------------
@@ -157,14 +121,9 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::construct" );
OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
+ initColumns();
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false;
-
- m_pKeyColumnNames.reset( new SelectColumnsMetaData(bCase) );
- m_pColumnNames.reset( new SelectColumnsMetaData(bCase) );
- m_pParameterNames.reset( new SelectColumnsMetaData(bCase) );
-
Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY);
const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
const Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY);
@@ -182,29 +141,13 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::
m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow> >(0,NULL))));
m_aKeyIter = m_aKeyMap.begin();
- static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
- const ::rtl::OUString aQuote = getIdentifierQuoteString();
- ::rtl::OUStringBuffer aFilter;
- static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM("."));
- static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
- // create the where clause
- SelectColumnsMetaData::iterator aPosEnd = m_pKeyColumnNames->end();
- for(SelectColumnsMetaData::iterator aPosIter = m_pKeyColumnNames->begin();aPosIter != aPosEnd;)
- {
- aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sTableName));
- aFilter.append(s_sDot);
- aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sRealName));
- aFilter.append(s_sParam);
- ++aPosIter;
- if(aPosIter != aPosEnd)
- aFilter.append(aAnd);
- }
+ ::rtl::OUStringBuffer aFilter = createKeyFilter();
+ Reference< XSingleSelectQueryComposer> xSourceComposer(m_xComposer,UNO_QUERY);
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
Reference<XSingleSelectQueryComposer> xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
- Reference<XSingleSelectQueryComposer> xComp2(m_xComposer,UNO_QUERY_THROW);
- ::rtl::OUString sQuery = xComp2->getQuery();
- xAnalyzer->setQuery(sQuery);
+ ::rtl::OUString sQuery = xSourceComposer->getQuery();
+ xAnalyzer->setElementaryQuery(xSourceComposer->getElementaryQuery());
// check for joins
::rtl::OUString aErrorMsg;
::std::auto_ptr<OSQLParseNode> pStatementNode( m_aSqlParser.parseTree( aErrorMsg, sQuery ) );
@@ -227,58 +170,6 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::
::comphelper::disposeComponent(xAnalyzer);
}
// -------------------------------------------------------------------------
-Any SAL_CALL OptimisticSet::getBookmark() throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBookmark" );
- OSL_ENSURE(m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(),
- "getBookmark is only possible when we stand on a valid row!");
- return makeAny(m_aKeyIter->first);
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::moveToBookmark" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32(bookmark));
- return m_aKeyIter != m_aKeyMap.end();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::moveRelativeToBookmark" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32(bookmark));
- if(m_aKeyIter != m_aKeyMap.end())
- {
- relative(rows);
- }
-
- return !isBeforeFirst() && !isAfterLast();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OptimisticSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::compareBookmarks" );
- sal_Int32 nFirst = 0, nSecond = 0;
- _first >>= nFirst;
- _second >>= nSecond;
-
- return (nFirst != nSecond) ? CompareBookmark::NOT_EQUAL : CompareBookmark::EQUAL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::hasOrderedBookmarks" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OptimisticSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::hashBookmark" );
- return ::comphelper::getINT32(bookmark);
-}
-// -------------------------------------------------------------------------
// ::com::sun::star::sdbcx::XDeleteRows
Sequence< sal_Int32 > SAL_CALL OptimisticSet::deleteRows( const Sequence< Any >& /*rows*/ ,const connectivity::OSQLTable& /*_xTable*/) throw(SQLException, RuntimeException)
{
@@ -485,202 +376,6 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn
}
}
// -------------------------------------------------------------------------
-void OptimisticSet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName )
-{
- // now create,fill and execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
- Reference< XParameters > xParameter(xPrep,UNO_QUERY);
-
- SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
- SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
- for(sal_Int32 i = 1;aIter != aEnd;++aIter)
- {
- if ( aIter->second.sTableName == i_sTableName )
- {
- const sal_Int32 nPos = aIter->second.nPosition;
- if((_rInsertRow->get())[nPos].isModified())
- {
- if((_rInsertRow->get())[nPos].isNull())
- xParameter->setNull(i++,(_rInsertRow->get())[nPos].getTypeKind());
- else
- {
- impl_convertValue_throw(_rInsertRow,aIter->second);
- (_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]);
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
- }
- }
- }
- }
-
- m_bInserted = xPrep->executeUpdate() > 0;
- sal_Bool bAutoValuesFetched = sal_False;
- if ( m_bInserted )
- {
- // first insert the default values into the insertrow
- aIter = m_pColumnNames->begin();
- for(;aIter != aEnd;++aIter)
- {
- if ( !(_rInsertRow->get())[aIter->second.nPosition].isModified() )
- (_rInsertRow->get())[aIter->second.nPosition] = aIter->second.sDefaultValue;
- }
- try
- {
- Reference< XGeneratedResultSet > xGRes(xPrep, UNO_QUERY);
- if ( xGRes.is() )
- {
- Reference< XResultSet > xRes = xGRes->getGeneratedValues();
- Reference< XRow > xRow(xRes,UNO_QUERY);
- if ( xRow.is() && xRes->next() )
- {
- Reference< XResultSetMetaDataSupplier > xMdSup(xRes,UNO_QUERY);
- Reference< XResultSetMetaData > xMd = xMdSup->getMetaData();
- sal_Int32 nColumnCount = xMd->getColumnCount();
- ::std::vector< ::rtl::OUString >::iterator aAutoIter = m_aAutoColumns.begin();
- ::std::vector< ::rtl::OUString >::iterator aAutoEnd = m_aAutoColumns.end();
- for (sal_Int32 i = 1;aAutoIter != aAutoEnd && i <= nColumnCount; ++aAutoIter,++i)
- {
-#if OSL_DEBUG_LEVEL > 1
- ::rtl::OUString sColumnName( xMd->getColumnName(i) );
-#endif
- SelectColumnsMetaData::iterator aFind = m_pKeyColumnNames->find(*aAutoIter);
- if ( aFind != m_pKeyColumnNames->end() )
- (_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,aFind->second.bNullable,xRow);
- }
- bAutoValuesFetched = sal_True;
- }
- }
- }
- catch(Exception&)
- {
- OSL_ENSURE(0,"Could not execute GeneratedKeys() stmt");
- }
- }
-
- ::comphelper::disposeComponent(xPrep);
-/*
- if ( !bAutoValuesFetched && m_bInserted )
- {
- // first check if all key column values were set
- 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();
- ::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) != aEnd )
- {
- sMaxStmt += sMax;
- sMaxStmt += ::dbtools::quoteName( sQuote,*aAutoIter);
- sMaxStmt += sMaxEnd;
- }
- }
-
- if(sMaxStmt.getLength())
- {
- sMaxStmt = sMaxStmt.replaceAt(sMaxStmt.getLength()-1,1,::rtl::OUString::createFromAscii(" "));
- ::rtl::OUString sStmt = ::rtl::OUString::createFromAscii("SELECT ");
- sStmt += sMaxStmt;
- sStmt += ::rtl::OUString::createFromAscii("FROM ");
- sStmt += m_aSelectComposedTableName;
- try
- {
- // now fetch the autoincrement values
- Reference<XStatement> xStatement = m_xConnection->createStatement();
- Reference<XResultSet> xRes = xStatement->executeQuery(sStmt);
- Reference<XRow> xRow(xRes,UNO_QUERY);
- if(xRow.is() && xRes->next())
- {
- aAutoIter = m_aAutoColumns.begin();
- 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 != aEnd )
- (_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,aFind->second.bNullable,xRow);
- }
- }
- ::comphelper::disposeComponent(xStatement);
- }
- catch(SQLException&)
- {
- OSL_ENSURE(0,"Could not fetch with MAX() ");
- }
- }
- }
- */
- if ( m_bInserted )
- {
- OKeySetMatrix::iterator aKeyIter = m_aKeyMap.end();
- --aKeyIter;
- ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size());
- copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1);
-
- m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(aKeyIter->first + 1,OKeySetValue(aKeyRow,::std::pair<sal_Int32,Reference<XRow> >(1,NULL)))).first;
- // now we set the bookmark for this row
- (_rInsertRow->get())[0] = makeAny((sal_Int32)m_aKeyIter->first);
- }
-}
-// -----------------------------------------------------------------------------
-void OptimisticSet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sal_Int32 i_nBookmark)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::copyRowValue" );
- connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = _rKeyRow->get().begin();
-
- // check the if the parameter values have been changed
- OSL_ENSURE((m_aParameterValueForCache.get().size()-1) == m_pParameterNames->size(),"OptimisticSet::copyRowValue: Parameter values and names differ!");
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaValuesIter = m_aParameterValueForCache.get().begin() +1;
-
- bool bChanged = false;
- SelectColumnsMetaData::const_iterator aParaIter = (*m_pParameterNames).begin();
- SelectColumnsMetaData::const_iterator aParaEnd = (*m_pParameterNames).end();
- for(sal_Int32 i = 1;aParaIter != aParaEnd;++aParaIter,++aParaValuesIter,++i)
- {
- ORowSetValue aValue(*aParaValuesIter);
- aValue.setSigned(m_aSignedFlags[aParaIter->second.nPosition]);
- if ( (_rInsertRow->get())[aParaIter->second.nPosition] != aValue )
- {
- ORowSetValueVector aCopy(m_aParameterValueForCache);
- (aCopy.get())[i] = (_rInsertRow->get())[aParaIter->second.nPosition];
- m_aUpdatedParameter[i_nBookmark] = aCopy;
- bChanged = true;
- }
- }
- if ( !bChanged )
- {
- m_aUpdatedParameter.erase(i_nBookmark);
- }
-
- // update the key values
- SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
- SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
- for(;aPosIter != aPosEnd;++aPosIter,++aIter)
- {
- ORowSetValue aValue((_rInsertRow->get())[aPosIter->second.nPosition]);
- switch(aPosIter->second.nType)
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- {
- ::rtl::OUString sValue = aValue.getString();
- sal_Int32 nIndex = sValue.indexOf('.');
- if ( nIndex != -1 )
- {
- aValue = sValue.copy(0,nIndex + (aPosIter->second.nScale > 0 ? aPosIter->second.nScale + 1 : 0));
- }
- }
- break;
- default:
- break;
- }
- *aIter = aValue;
- aIter->setTypeKind(aPosIter->second.nType);
- }
-}
-// -------------------------------------------------------------------------
void SAL_CALL OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException)
{
::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
@@ -754,432 +449,6 @@ void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUS
m_bDeleted = sal_True;
}
}
-// -------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::cancelRowUpdates( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::cancelRowUpdates" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::moveToInsertRow" );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::moveToCurrentRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::moveToCurrentRow" );
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::next( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::next" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
-
- if(isAfterLast())
- return sal_False;
- if(!m_bRowCountFinal) // not yet all records fetched
- {
- ++m_aKeyIter; // this is possible because we stand on begin() and this is the "beforefirst" row
- if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
- m_aKeyIter = m_aKeyMap.end();
- }
- else if(!isAfterLast())
- ++m_aKeyIter;
-
- refreshRow();
- return !isAfterLast();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::isBeforeFirst" );
- return m_aKeyIter == m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::isAfterLast" );
- return m_bRowCountFinal && m_aKeyIter == m_aKeyMap.end();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::isFirst" );
- OKeySetMatrix::iterator aTemp = m_aKeyMap.begin();
- ++aTemp;
- return m_aKeyIter == aTemp && m_aKeyIter != m_aKeyMap.end();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::isLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::isLast" );
- if(!m_bRowCountFinal)
- return sal_False;
-
- OKeySetMatrix::iterator aTemp = m_aKeyMap.end();
- --aTemp;
- return m_aKeyIter == aTemp;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::beforeFirst" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- m_aKeyIter = m_aKeyMap.begin();
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::afterLast" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- fillAllRows();
- m_aKeyIter = m_aKeyMap.end();
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::first( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::first" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- m_aKeyIter = m_aKeyMap.begin();
- ++m_aKeyIter;
- if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
- m_aKeyIter = m_aKeyMap.end();
-
- refreshRow();
- return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::last( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::last" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- fillAllRows();
-
- m_aKeyIter = m_aKeyMap.end();
- --m_aKeyIter;
- refreshRow();
- return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OptimisticSet::getRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getRow" );
- OSL_ENSURE(!isAfterLast(),"getRow is not allowed when afterlast record!");
- OSL_ENSURE(!isBeforeFirst(),"getRow is not allowed when beforefirst record!");
-
- return ::std::distance(m_aKeyMap.begin(),m_aKeyIter);
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::absolute" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- OSL_ENSURE(row,"absolute(0) isn't allowed!");
- if(row < 0)
- {
- if(!m_bRowCountFinal)
- fillAllRows();
-
- for(;row < 0 && m_aKeyIter != m_aKeyMap.begin();++row)
- m_aKeyIter--;
- }
- else
- {
- if(row >= (sal_Int32)m_aKeyMap.size())
- {
- if(!m_bRowCountFinal)
- {
- sal_Bool bNext = sal_True;
- for(sal_Int32 i=m_aKeyMap.size()-1;i < row && bNext;++i)
- bNext = fetchRow();
- }
- else
- m_aKeyIter = m_aKeyMap.end();
- }
- else
- {
- m_aKeyIter = m_aKeyMap.begin();
- for(;row > 0 && m_aKeyIter != m_aKeyMap.end();--row)
- ++m_aKeyIter;
- }
- }
- refreshRow();
-
- return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::relative" );
- if(!rows)
- {
- refreshRow();
- return sal_True;
- }
- return absolute(getRow()+rows);
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::previous( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::previous" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- if(m_aKeyIter != m_aKeyMap.begin())
- {
- --m_aKeyIter;
- refreshRow();
- }
- return m_aKeyIter != m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::refreshRow() throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::refreshRow" );
- if(isBeforeFirst() || isAfterLast() || !m_xStatement.is())
- return;
-
- m_xSet.clear();
- ::comphelper::disposeComponent(m_xRow);
- // we just reassign the base members
- Reference< XParameters > xParameter(m_xStatement,UNO_QUERY);
- OSL_ENSURE(xParameter.is(),"No Parameter interface!");
- xParameter->clearParameters();
-
- sal_Int32 nPos=1;
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaIter;
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd;
- OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first);
- if ( aUpdateFind == m_aUpdatedParameter.end() )
- {
- aParaIter = m_aParameterValueForCache.get().begin();
- aParaEnd = m_aParameterValueForCache.get().end();
- }
- else
- {
- aParaIter = aUpdateFind->second.get().begin();
- aParaEnd = aUpdateFind->second.get().end();
- }
-
- // first put the parameters set by the outer rowset
- for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
- {
- ::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() );
- }
-
- // now set the primary key column values
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->get().begin();
- SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
- SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
- for(;aPosIter != aPosEnd;++aPosIter,++aIter,++nPos)
- setParameter(nPos,xParameter,*aIter,aPosIter->second.nType,aPosIter->second.nScale);
-
- m_xSet = m_xStatement->executeQuery();
- OSL_ENSURE(m_xSet.is(),"No resultset form statement!");
- sal_Bool bOK = m_xSet->next();
- if ( !bOK )
- m_aKeyIter = m_aKeyMap.end();
- m_xRow.set(m_xSet,UNO_QUERY);
- OSL_ENSURE(m_xRow.is(),"No row form statement!");
-}
-// -----------------------------------------------------------------------------
-sal_Bool OptimisticSet::fetchRow()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::fetchRow" );
- // fetch the next row and append on the OptimisticSet
- sal_Bool bRet = sal_False;
- if ( !m_bRowCountFinal )
- bRet = m_xDriverSet->next();
- if ( bRet )
- {
- ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size());
- connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = aKeyRow->get().begin();
- // first fetch the values needed for the key column
- SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
- SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
- for(;aPosIter != aPosEnd;++aPosIter,++aIter)
- {
- const SelectColumnDescription& rColDesc = aPosIter->second;
- aIter->fill(rColDesc.nPosition,rColDesc.nType,rColDesc.bNullable,m_xDriverRow);
- }
- m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(m_aKeyMap.rbegin()->first+1,OKeySetValue(aKeyRow,::std::pair<sal_Int32,Reference<XRow> >(0,NULL)))).first;
- }
- else
- m_bRowCountFinal = sal_True;
- return bRet;
-}
-// -------------------------------------------------------------------------
-void OptimisticSet::fillAllRows()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::fillAllRows" );
- if(!m_bRowCountFinal)
- {
- while(fetchRow())
- ;
- }
-}
-// XRow
-sal_Bool SAL_CALL OptimisticSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::wasNull" );
- return m_xRow->wasNull();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OptimisticSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getString" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getString(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBoolean" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getBoolean(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Int8 SAL_CALL OptimisticSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getByte" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getByte(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Int16 SAL_CALL OptimisticSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getShort" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getShort(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OptimisticSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getInt" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getInt(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Int64 SAL_CALL OptimisticSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getLong" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getLong(columnIndex);
-}
-// -------------------------------------------------------------------------
-float SAL_CALL OptimisticSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getFloat" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getFloat(columnIndex);
-}
-// -------------------------------------------------------------------------
-double SAL_CALL OptimisticSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getDouble" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getDouble(columnIndex);
-}
-// -------------------------------------------------------------------------
-Sequence< sal_Int8 > SAL_CALL OptimisticSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBytes" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getBytes(columnIndex);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::Date SAL_CALL OptimisticSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getDate" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getDate(columnIndex);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::Time SAL_CALL OptimisticSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getTime" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getTime(columnIndex);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::DateTime SAL_CALL OptimisticSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getTimestamp" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getTimestamp(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OptimisticSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBinaryStream" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getBinaryStream(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OptimisticSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getCharacterStream" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getCharacterStream(columnIndex);
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OptimisticSet::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", "OptimisticSet::getObject" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getObject(columnIndex,typeMap);
-}
-// -------------------------------------------------------------------------
-Reference< XRef > SAL_CALL OptimisticSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getRef" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getRef(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL OptimisticSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBlob" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getBlob(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL OptimisticSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getClob" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getClob(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL OptimisticSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getArray" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getArray(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::rowUpdated" );
- return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 2;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::rowInserted( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::rowInserted" );
- return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 1;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::rowDeleted" );
- sal_Bool bDeleted = m_bDeleted;
- m_bDeleted = sal_False;
- return bDeleted;
-}
// -----------------------------------------------------------------------------
::rtl::OUString OptimisticSet::getComposedTableName(const ::rtl::OUString& /*_sCatalog*/,
const ::rtl::OUString& /*_sSchema*/,
@@ -1215,200 +484,6 @@ sal_Bool SAL_CALL OptimisticSet::rowDeleted( ) throw(SQLException, RuntimeExcep
return aComposedName;
}
// -----------------------------------------------------------------------------
-/*
-namespace dbaccess
-{
- void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns,
- const Sequence< ::rtl::OUString>& _aColumnNames,
- const ::rtl::OUString& _rsUpdateTableName,
- SelectColumnsMetaData& _rColumnNames)
- {
- // get the real name of the columns
- Sequence< ::rtl::OUString> aSelNames(_rxQueryColumns->getElementNames());
- const ::rtl::OUString* pSelBegin = aSelNames.getConstArray();
- const ::rtl::OUString* pSelEnd = pSelBegin + aSelNames.getLength();
-
- const ::rtl::OUString* pColumnIter = _aColumnNames.getConstArray();
- const ::rtl::OUString* pColumnEnd = pColumnIter + _aColumnNames.getLength();
-
- ::comphelper::UStringMixLess aTmp(_rColumnNames.key_comp());
- ::comphelper::UStringMixEqual bCase(static_cast< ::comphelper::UStringMixLess*>(&aTmp)->isCaseSensitive());
-
- for(sal_Int32 nPos = 1;pSelBegin != pSelEnd;++pSelBegin,++nPos)
- {
- Reference<XPropertySet> xColumnProp(_rxQueryColumns->getByName(*pSelBegin),UNO_QUERY);
- ::rtl::OUString sRealName,sTableName;
- OSL_ENSURE(xColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME),"Property REALNAME not available!");
- OSL_ENSURE(xColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_TABLENAME),"Property TABLENAME not available!");
- xColumnProp->getPropertyValue(PROPERTY_REALNAME) >>= sRealName;
- xColumnProp->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName;
-
- for(;pColumnIter != pColumnEnd;++pColumnIter)
- {
- if(bCase(sRealName,*pColumnIter) && bCase(_rsUpdateTableName,sTableName) && _rColumnNames.find(*pColumnIter) == _rColumnNames.end())
- {
- sal_Int32 nType = 0;
- xColumnProp->getPropertyValue(PROPERTY_TYPE) >>= nType;
- sal_Int32 nScale = 0;
- xColumnProp->getPropertyValue(PROPERTY_SCALE) >>= nScale;
- ::rtl::OUString sColumnDefault;
- if ( xColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE) )
- xColumnProp->getPropertyValue(PROPERTY_DEFAULTVALUE) >>= sColumnDefault;
-
- sal_Int32 bNullable = sal_False;
- xColumnProp->getPropertyValue(PROPERTY_ISNULLABLE) >>= bNullable;
-
-
- _rColumnNames[sRealName] = SelectColumnDescription( nPos, nType,nScale,bNullable != sdbc::ColumnValue::NO_NULLS, sColumnDefault );
- break;
- }
- }
- pColumnIter = _aColumnNames.getConstArray();
- }
- }
-}
-*/
-// -----------------------------------------------------------------------------
-void OptimisticSet::impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData)
-{
- ORowSetValue& aValue((_rInsertRow->get())[i_aMetaData.nPosition]);
- switch(i_aMetaData.nType)
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- {
- ::rtl::OUString sValue = aValue.getString();
- sal_Int32 nIndex = sValue.indexOf('.');
- if ( nIndex != -1 )
- {
- aValue = sValue.copy(0,nIndex + (i_aMetaData.nScale > 0 ? i_aMetaData.nScale + 1 : 0));
- }
- }
- break;
- default:
- break;
- }
-}
-// -----------------------------------------------------------------------------
-void OptimisticSet::findTableColumnsMatching_throw(const Any& i_aTable
- ,const Reference<XDatabaseMetaData>& i_xMeta
- ,const Reference<XNameAccess>& i_xQueryColumns)
-{
- ::rtl::OUString sCatalog,sSchema,sTable;
- Reference<XPropertySet> xTableProp(i_aTable,UNO_QUERY);
- Any aCatalog = xTableProp->getPropertyValue(PROPERTY_CATALOGNAME);
- aCatalog >>= sCatalog;
- xTableProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
- xTableProp->getPropertyValue(PROPERTY_NAME) >>= sTable;
-
- // first ask the database itself for the best columns which can be used
- ::std::vector< ::rtl::OUString> aBestRowColumnNames;
- Reference<XResultSet> xBestRes(i_xMeta->getBestRowIdentifier(aCatalog,sSchema,sTable,0,sal_False));
- Reference<XRow> xBestRow(xBestRes,uno::UNO_QUERY);
- while ( xBestRes->next() )
- {
- aBestRowColumnNames.push_back(xBestRow->getString(2));
- }
-
- Sequence< ::rtl::OUString> aBestColumnNames;
- if ( aBestRowColumnNames.empty() )
- {
- Reference<XNameAccess> xKeyColumns = getPrimaryKeyColumns_throw(i_aTable);
- if ( xKeyColumns.is() )
- aBestColumnNames = xKeyColumns->getElementNames();
- }
- else
- aBestColumnNames = Sequence< ::rtl::OUString>(&aBestRowColumnNames[0],aBestRowColumnNames.size());
-
- const Reference<XColumnsSupplier> xTblColSup(i_aTable,UNO_QUERY_THROW);
- const Reference<XNameAccess> xTblColumns = xTblColSup->getColumns();
- const ::rtl::OUString sComposedUpdateTableName = dbtools::composeTableName( i_xMeta, sCatalog, sSchema, sTable, sal_False, ::dbtools::eInDataManipulation );
- ::dbaccess::getColumnPositions(i_xQueryColumns,aBestColumnNames,sComposedUpdateTableName,(*m_pKeyColumnNames),true);
- ::dbaccess::getColumnPositions(i_xQueryColumns,xTblColumns->getElementNames(),sComposedUpdateTableName,(*m_pColumnNames),true);
-
- // locate parameter in select columns
- Reference<XParametersSupplier> xParaSup(m_xComposer,UNO_QUERY);
- Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters();
- const sal_Int32 nParaCount = xQueryParameters->getCount();
- Sequence< ::rtl::OUString> aParameterColumns(nParaCount);
- for(sal_Int32 i = 0; i< nParaCount;++i)
- {
- Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW);
- xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i];
- }
- ::dbaccess::getColumnPositions(i_xQueryColumns,aParameterColumns,sComposedUpdateTableName,(*m_pParameterNames),true);
-
- SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
- SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
- for(;aPosIter != aPosEnd;++aPosIter)
- {
- if ( xTblColumns->hasByName(aPosIter->second.sRealName) )
- {
- Reference<XPropertySet> xProp(xTblColumns->getByName(aPosIter->second.sRealName),UNO_QUERY);
- sal_Bool bAuto = sal_False;
- if( (xProp->getPropertyValue(PROPERTY_ISAUTOINCREMENT) >>= bAuto) && bAuto)
- m_aAutoColumns.push_back(aPosIter->first);
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OptimisticSet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName)
-{
- // now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
- Reference< XParameters > xParameter(xPrep,UNO_QUERY);
-
- sal_Int32 i = 1;
- // first the set values
- SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
- SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
- sal_uInt16 j = 0;
- for(;aIter != aEnd;++aIter,++j)
- {
- if ( aIter->second.sTableName == i_sTableName )
- {
- sal_Int32 nPos = aIter->second.nPosition;
- if((_rInsertRow->get())[nPos].isModified())
- {
- impl_convertValue_throw(_rInsertRow,aIter->second);
- (_rInsertRow->get())[nPos].setSigned((_rOrginalRow->get())[nPos].isSigned());
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
- }
- }
- }
- // and then the values of the where condition
- aIter = m_pKeyColumnNames->begin();
- aEnd = m_pKeyColumnNames->end();
- j = 0;
- for(;aIter != aEnd;++aIter,++j)
- {
- if ( aIter->second.sTableName == i_sTableName )
- {
- 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;
- aIter = m_pColumnNames->begin();
- for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j,++aIter)
- {
- setParameter(i,xParameter,(_rOrginalRow->get())[*aIdxColIter],(_rOrginalRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
- }
-*/
- const sal_Int32 nRowsUpdated = xPrep->executeUpdate();
- m_bUpdated = nRowsUpdated > 0;
- if(m_bUpdated)
- {
- const sal_Int32 nBookmark = ::comphelper::getINT32((_rInsertRow->get())[0].getAny());
- m_aKeyIter = m_aKeyMap.find(nBookmark);
- m_aKeyIter->second.second.first = 2;
- copyRowValue(_rInsertRow,m_aKeyIter->second.first,nBookmark);
- }
-}
-// -----------------------------------------------------------------------------
void OptimisticSet::fillJoinedColumns_throw(const ::std::vector< TNodePair >& i_aJoinColumns)
{
::std::vector< TNodePair >::const_iterator aIter = i_aJoinColumns.begin();
diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx
index 1f42bebdf..fd1b304a7 100644
--- a/dbaccess/source/core/api/OptimisticSet.hxx
+++ b/dbaccess/source/core/api/OptimisticSet.hxx
@@ -31,11 +31,9 @@
#ifndef DBACCESS_CORE_API_OPTIMISTICSET_HXX
#define DBACCESS_CORE_API_OPTIMISTICSET_HXX
-#include "CacheSet.hxx"
#include "KeySet.hxx"
#include <cppuhelper/implbase1.hxx>
-#include <map>
-#include <memory>
+
#include <connectivity/sqlparse.hxx>
#include <connectivity/sqliterator.hxx>
@@ -47,29 +45,15 @@
namespace dbaccess
{
// is used when the source supports keys
- class OptimisticSet : public OCacheSet
+ class OptimisticSet : public OKeySet
{
::connectivity::OSQLParser m_aSqlParser;
::connectivity::OSQLParseTreeIterator m_aSqlIterator;
- OKeySetMatrix m_aKeyMap;
- OKeySetMatrix::iterator m_aKeyIter;
- ::std::vector< ::rtl::OUString > m_aAutoColumns; // contains all columns which are autoincrement ones
::std::map<sal_Int32,sal_Int32> m_aJoinedColumns;
- ::std::map<sal_Int32,sal_Int32> m_aJoinedKeyColumns;
-
- OUpdatedParameter m_aUpdatedParameter; // contains all parameter which have been updated and are needed for refetching
- ORowSetValueVector m_aParameterValueForCache;
- ::std::auto_ptr<SelectColumnsMetaData> m_pKeyColumnNames; // contains all key column names
- ::std::auto_ptr<SelectColumnsMetaData> m_pColumnNames; // contains all column names
- ::std::auto_ptr<SelectColumnsMetaData> m_pParameterNames; // contains all parameter names
- connectivity::OSQLTable m_xTable; // reference to our table
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement> m_xStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xSet;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow> m_xRow;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer > m_xComposer;
+ ::std::map<sal_Int32,sal_Int32> m_aJoinedKeyColumns;
+
- sal_Bool m_bRowCountFinal;
mutable bool m_bResultSetChanged;
/**
@@ -83,24 +67,9 @@ namespace dbaccess
::rtl::OUString getComposedTableName( const ::rtl::OUString& _sCatalog,
const ::rtl::OUString& _sSchema,
const ::rtl::OUString& _sTable);
-
- /** copies the values from the insert row into the key row
- *
- * \param _rInsertRow the row which was inserted
- * \param _rKeyRow The current key row of the row set.
- + \param i_nBookmark The bookmark is used to update the parameter
- */
- void copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sal_Int32 i_nBookmark);
-
- void fillAllRows();
- sal_Bool fetchRow();
-
+
void impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData);
- void findTableColumnsMatching_throw( const ::com::sun::star::uno::Any& i_aTable
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& i_xMeta
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns);
- void executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName);
- void executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName);
+
void executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName);
void fillJoinedColumns_throw(const ::std::vector< ::connectivity::TNodePair>& i_aJoinColumns);
void fillJoinedColumns_throw(const ::rtl::OUString& i_sLeftColumn,const ::rtl::OUString& i_sRightColumn);
@@ -115,59 +84,6 @@ namespace dbaccess
// late ctor which can throw exceptions
virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter);
- // ::com::sun::star::sdbc::XRow
- virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
-
- virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::sdbc::XResultSet
- virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::sdbcx::XRowLocate
- virtual ::com::sun::star::uno::Any SAL_CALL getBookmark() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// -------------------------------------------------------------------------
// ::com::sun::star::sdbcx::XDeleteRows
virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ,const connectivity::OSQLTable& _xTable) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
@@ -175,9 +91,6 @@ namespace dbaccess
virtual void SAL_CALL updateRow(const ORowSetRow& _rInsertRow,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// CacheSet
virtual bool isResultSetChanged() const;
diff --git a/dbaccess/source/core/api/PrivateRow.cxx b/dbaccess/source/core/api/PrivateRow.cxx
new file mode 100644
index 000000000..2d3baedc4
--- /dev/null
+++ b/dbaccess/source/core/api/PrivateRow.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle andor its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+#include "PrivateRow.hxx"
+
+using namespace dbaccess;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star;
+
+::sal_Bool SAL_CALL OPrivateRow::wasNull( ) throw (SQLException, RuntimeException)
+ {
+ return m_aRow[m_nPos].isNull();
+ }
+ ::rtl::OUString SAL_CALL OPrivateRow::getString( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ ::sal_Bool SAL_CALL OPrivateRow::getBoolean( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ ::sal_Int8 SAL_CALL OPrivateRow::getByte( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ ::sal_Int16 SAL_CALL OPrivateRow::getShort( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ ::sal_Int32 SAL_CALL OPrivateRow::getInt( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ ::sal_Int64 SAL_CALL OPrivateRow::getLong( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ float SAL_CALL OPrivateRow::getFloat( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ double SAL_CALL OPrivateRow::getDouble( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ Sequence< ::sal_Int8 > SAL_CALL OPrivateRow::getBytes( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ ::com::sun::star::util::Date SAL_CALL OPrivateRow::getDate( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ ::com::sun::star::util::Time SAL_CALL OPrivateRow::getTime( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ ::com::sun::star::util::DateTime SAL_CALL OPrivateRow::getTimestamp( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos];
+ }
+ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OPrivateRow::getBinaryStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return Reference< ::com::sun::star::io::XInputStream >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
+ }
+ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OPrivateRow::getCharacterStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return Reference< ::com::sun::star::io::XInputStream >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
+ }
+ Any SAL_CALL OPrivateRow::getObject( ::sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return m_aRow[m_nPos].makeAny();
+ }
+ Reference< XRef > SAL_CALL OPrivateRow::getRef( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return Reference< XRef >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
+ }
+ Reference< XBlob > SAL_CALL OPrivateRow::getBlob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return Reference< XBlob >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
+ }
+ Reference< XClob > SAL_CALL OPrivateRow::getClob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return Reference< XClob >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
+ }
+ Reference< XArray > SAL_CALL OPrivateRow::getArray( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
+ {
+ m_nPos = columnIndex;
+ return Reference< XArray >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
+ }
+
diff --git a/dbaccess/source/core/api/PrivateRow.hxx b/dbaccess/source/core/api/PrivateRow.hxx
new file mode 100644
index 000000000..aabcb0d4a
--- /dev/null
+++ b/dbaccess/source/core/api/PrivateRow.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * 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: OptimisticSet.cxx,v $
+ * $Revision: 1.73 $
+ *
+ * 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 PRIVATE_ROW_HXX
+#define PRIVATE_ROW_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include "RowSetRow.hxx"
+
+namespace dbaccess
+{
+ class OPrivateRow : public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XRow>
+ {
+ ORowSetValueVector::Vector m_aRow;
+ sal_Int32 m_nPos;
+ public:
+ OPrivateRow(const ORowSetValueVector::Vector& i_aRow) : m_aRow(i_aRow),m_nPos(0)
+ {
+ }
+ virtual ::sal_Bool SAL_CALL wasNull( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getString( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getBoolean( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int8 SAL_CALL getByte( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getShort( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getInt( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getLong( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual float SAL_CALL getFloat( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getDouble( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getBytes( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::util::Date SAL_CALL getDate( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::util::Time SAL_CALL getTime( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getObject( ::sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( ::sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+} // dbaccess
+#endif // PRIVATE_ROW_HXX
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 20483cff0..1f7c0294f 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -580,6 +580,9 @@ void ORowSet::freeResources( bool _bComplete )
m_xComposer = NULL;
}
+ // let our warnings container forget the reference to the (possibly disposed) old result set
+ m_aWarnings.setExternalWarnings( NULL );
+
DELETEZ(m_pCache);
impl_resetTables_nothrow();
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 295e29ebe..d42c8d20f 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -158,17 +158,25 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
try
{
Reference< XResultSetUpdate> xUp(_xRs,UNO_QUERY_THROW);
- xUp->moveToInsertRow();
- xUp->cancelRowUpdates();
- _xRs->beforeFirst();
- m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE;
- m_pCacheSet = new WrappedResultSet();
- m_xCacheSet = m_pCacheSet;
- m_pCacheSet->construct(_xRs,i_sRowSetFilter);
- return;
+ Reference< XPropertySet> xProp(_xRs,UNO_QUERY);
+ Reference< XPropertySetInfo > xPropInfo = xProp->getPropertySetInfo();
+ sal_Bool bBookmarkable = xPropInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
+ any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is();
+ if ( bBookmarkable )
+ {
+ xUp->moveToInsertRow();
+ xUp->cancelRowUpdates();
+ _xRs->beforeFirst();
+ m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE;
+ m_pCacheSet = new WrappedResultSet();
+ m_xCacheSet = m_pCacheSet;
+ m_pCacheSet->construct(_xRs,i_sRowSetFilter);
+ return;
+ }
}
- catch(const Exception&)
+ catch(const Exception& ex)
{
+ (void)ex;
}
_xRs->beforeFirst();
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index fc8013413..eea07de9d 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -1266,13 +1266,13 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon
// Feldnamen
sal_uInt16 i;
for (i=0;i< pLhs->count();i++)
- pCondition->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pLhs->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
// Kriterium
aItem.Handle = pCondition->getChild(1)->getNodeType();
aValue = pCondition->getChild(1)->getTokenValue();
for(i=0;i< pRhs->count();i++)
- pCondition->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pRhs->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
aItem.Name = aName;
aItem.Value <<= aValue;
diff --git a/dbaccess/source/core/api/WrappedResultSet.cxx b/dbaccess/source/core/api/WrappedResultSet.cxx
index 6e8175b2e..0b9c6b6c2 100644
--- a/dbaccess/source/core/api/WrappedResultSet.cxx
+++ b/dbaccess/source/core/api/WrappedResultSet.cxx
@@ -64,43 +64,41 @@ void WrappedResultSet::construct(const Reference< XResultSet>& _xDriverSet,const
Any SAL_CALL WrappedResultSet::getBookmark() throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::getBookmark" );
+ if ( m_xRowLocate.is() )
+ {
+ return m_xRowLocate->getBookmark( );
+ }
return makeAny(m_xDriverSet->getRow());
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL WrappedResultSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::moveToBookmark" );
- sal_Int32 nPos = 1;
- bookmark >>= nPos;
- return m_xDriverSet->absolute(nPos);
+ return m_xRowLocate->moveToBookmark( bookmark );
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL WrappedResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::moveRelativeToBookmark" );
- sal_Int32 nPos = 1;
- bookmark >>= nPos;
- return m_xDriverSet->absolute(nPos + rows);
+ return m_xRowLocate->moveRelativeToBookmark( bookmark,rows );
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL WrappedResultSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::compareBookmarks" );
- return _first != _second;
+ return m_xRowLocate->compareBookmarks( _first,_second );
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL WrappedResultSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::hasOrderedBookmarks" );
- return sal_True;
+ return m_xRowLocate->hasOrderedBookmarks();
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL WrappedResultSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::hashBookmark" );
- sal_Int32 nPos = 1;
- bookmark >>= nPos;
- return nPos;
+ return m_xRowLocate->hashBookmark(bookmark);
}
// -------------------------------------------------------------------------
// ::com::sun::star::sdbcx::XDeleteRows
@@ -128,7 +126,7 @@ void SAL_CALL WrappedResultSet::insertRow( const ORowSetRow& _rInsertRow,const c
updateColumn(i,m_xUpdRow,*aIter);
}
m_xUpd->insertRow();
- (*_rInsertRow->get().begin()) = m_xDriverSet->getRow();
+ (*_rInsertRow->get().begin()) = getBookmark();
}
// -------------------------------------------------------------------------
void SAL_CALL WrappedResultSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException)
@@ -166,6 +164,7 @@ void SAL_CALL WrappedResultSet::moveToInsertRow( ) throw(SQLException, RuntimeE
void SAL_CALL WrappedResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::moveToCurrentRow" );
+ m_xUpd->moveToCurrentRow();
}
// -------------------------------------------------------------------------
void WrappedResultSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition)
diff --git a/dbaccess/source/core/api/makefile.mk b/dbaccess/source/core/api/makefile.mk
index 7af260080..9a4dc9d8e 100644
--- a/dbaccess/source/core/api/makefile.mk
+++ b/dbaccess/source/core/api/makefile.mk
@@ -73,6 +73,7 @@ SLOFILES= \
$(SLO)$/View.obj \
$(SLO)$/WrappedResultSet.obj \
$(SLO)$/OptimisticSet.obj \
+ $(SLO)$/PrivateRow.obj \
$(SLO)$/columnsettings.obj
# --- Targets ----------------------------------
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 98c88aaf2..ef8fc20ae 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -1569,16 +1569,7 @@ sal_Bool ODocumentDefinition::saveAs()
Reference<XNameContainer> xNC(pDocuSave->getContent(),UNO_QUERY);
if ( xNC.is() )
{
- if ( m_pImpl->m_aProps.aTitle == pDocuSave->getName() )
- {
- Reference<XEmbedPersist> xPersist(m_xEmbeddedObject,UNO_QUERY);
- if ( xPersist.is() )
- {
- xPersist->storeOwn();
- notifyDataSourceModified();
- }
- }
- else
+ if ( m_pImpl->m_aProps.aTitle != pDocuSave->getName() )
{
try
{
@@ -1618,6 +1609,12 @@ sal_Bool ODocumentDefinition::saveAs()
DBG_UNHANDLED_EXCEPTION();
}
}
+ Reference<XEmbedPersist> xPersist(m_xEmbeddedObject,UNO_QUERY);
+ if ( xPersist.is() )
+ {
+ xPersist->storeOwn();
+ notifyDataSourceModified();
+ }
}
}
}
diff --git a/dbaccess/source/core/inc/DatabaseDataProvider.hxx b/dbaccess/source/core/inc/DatabaseDataProvider.hxx
index c29b487f2..dae466e92 100644
--- a/dbaccess/source/core/inc/DatabaseDataProvider.hxx
+++ b/dbaccess/source/core/inc/DatabaseDataProvider.hxx
@@ -33,11 +33,12 @@
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/chart2/data/XDatabaseDataProvider.hpp"
#include "com/sun/star/chart2/XInternalDataProvider.hpp"
+#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/sdbc/XParameters.hpp>
#include <com/sun/star/container/XChild.hpp>
-#include "cppuhelper/compbase3.hxx"
+#include "cppuhelper/compbase4.hxx"
#include "cppuhelper/basemutex.hxx"
#include "cppuhelper/propertysetmixin.hxx"
#include <cppuhelper/implementationentry.hxx>
@@ -52,8 +53,9 @@ namespace dbaccess
{
class DatabaseDataSource;
-typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::chart2::data::XDatabaseDataProvider
+typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::chart2::data::XDatabaseDataProvider
, ::com::sun::star::container::XChild
+ , ::com::sun::star::chart::XComplexDescriptionAccess
, ::com::sun::star::lang::XServiceInfo > TDatabaseDataProvider;
class DatabaseDataProvider: private ::cppu::BaseMutex,
@@ -187,6 +189,26 @@ private:
// conatiner::XChild
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+ // ____ XComplexDescriptionAccess ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexRowDescriptions( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aRowDescriptions ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexColumnDescriptions( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aColumnDescriptions ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& aData ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRowDescriptions ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aColumnDescriptions ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartData (base of XChartDataArray) ____
+ virtual void SAL_CALL addChartDataChangeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChartDataChangeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getNotANumber()throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isNotANumber(double nNumber )throw (::com::sun::star::uno::RuntimeException);
private:
DatabaseDataProvider(DatabaseDataProvider &); // not defined
void operator =(DatabaseDataProvider &); // not defined
@@ -201,7 +223,7 @@ private:
void impl_fillRowSet_throw();
void impl_executeRowSet_throw(::osl::ResettableMutexGuard& _rClearForNotifies);
bool impl_fillParameters_nothrow( ::osl::ResettableMutexGuard& _rClearForNotifies);
- void impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories);
+ void impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories,const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >& i_aColumnNames);
void impl_invalidateParameter_nothrow();
::com::sun::star::uno::Any impl_getNumberFormatKey_nothrow(const ::rtl::OUString & _sRangeRepresentation) const;
@@ -229,6 +251,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xActiveConnection;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet;
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > m_xInternal;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XComplexDescriptionAccess > m_xComplexDescriptionAccess;
::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeXMLConversion> m_xRangeConversion;
::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> m_xHandler;
// the object doin' most of the work - an SDB-rowset
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index ec6f6cbb9..0ede9ff23 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/XChartDataArray.hpp>
@@ -72,6 +73,7 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex
{
m_xInternal.set( m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.chart.InternalDataProvider")),m_xContext ), uno::UNO_QUERY );
m_xRangeConversion.set(m_xInternal,uno::UNO_QUERY);
+ m_xComplexDescriptionAccess.set(m_xInternal,uno::UNO_QUERY);
osl_incrementInterlockedCount( &m_refCount );
{
@@ -204,6 +206,7 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat
if ( createDataSourcePossible(_aArguments) )
{
sal_Bool bHasCategories = sal_True;
+ uno::Sequence< uno::Sequence< ::rtl::OUString > > aColumnNames;
const beans::PropertyValue* pArgIter = _aArguments.getConstArray();
const beans::PropertyValue* pArgEnd = pArgIter + _aArguments.getLength();
for(;pArgIter != pArgEnd;++pArgIter)
@@ -211,7 +214,11 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat
if ( pArgIter->Name.equalsAscii("HasCategories") )
{
pArgIter->Value >>= bHasCategories;
- break;
+
+ }
+ else if ( pArgIter->Name.equalsAscii("ComplexColumnDescriptions") )
+ {
+ pArgIter->Value >>= aColumnNames;
}
}
bool bRet = false;
@@ -221,7 +228,7 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat
{
impl_fillRowSet_throw();
impl_executeRowSet_throw(aClearForNotifies);
- impl_fillInternalDataProvider_throw(bHasCategories);
+ impl_fillInternalDataProvider_throw(bHasCategories,aColumnNames);
bRet = true;
}
catch(const uno::Exception& /*e*/)
@@ -310,6 +317,75 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::cre
}
return xData;
}
+
+uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL DatabaseDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getComplexRowDescriptions();
+}
+void SAL_CALL DatabaseDataProvider::setComplexRowDescriptions( const uno::Sequence< uno::Sequence< ::rtl::OUString > >& aRowDescriptions ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setComplexRowDescriptions(aRowDescriptions);
+}
+uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL DatabaseDataProvider::getComplexColumnDescriptions() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getComplexColumnDescriptions();
+}
+void SAL_CALL DatabaseDataProvider::setComplexColumnDescriptions( const uno::Sequence< uno::Sequence< rtl::OUString > >& aColumnDescriptions ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setComplexColumnDescriptions(aColumnDescriptions);
+}
+// ____ XChartDataArray ____
+uno::Sequence< uno::Sequence< double > > SAL_CALL DatabaseDataProvider::getData() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getData();
+}
+
+void SAL_CALL DatabaseDataProvider::setData( const uno::Sequence< uno::Sequence< double > >& rDataInRows ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setData(rDataInRows);
+}
+
+void SAL_CALL DatabaseDataProvider::setRowDescriptions( const uno::Sequence< rtl::OUString >& aRowDescriptions ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setRowDescriptions(aRowDescriptions);
+}
+
+void SAL_CALL DatabaseDataProvider::setColumnDescriptions( const uno::Sequence< rtl::OUString >& aColumnDescriptions ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setColumnDescriptions(aColumnDescriptions);
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL DatabaseDataProvider::getRowDescriptions() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getRowDescriptions();
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL DatabaseDataProvider::getColumnDescriptions() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getColumnDescriptions();
+}
+
+// ____ XChartData (base of XChartDataArray) ____
+void SAL_CALL DatabaseDataProvider::addChartDataChangeEventListener(const uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& x) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->addChartDataChangeEventListener(x);
+}
+
+void SAL_CALL DatabaseDataProvider::removeChartDataChangeEventListener(const uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& x) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->removeChartDataChangeEventListener(x);
+}
+
+double SAL_CALL DatabaseDataProvider::getNotANumber() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getNotANumber();
+}
+
+::sal_Bool SAL_CALL DatabaseDataProvider::isNotANumber( double nNumber ) throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->isNotANumber(nNumber);
+}
+
// -----------------------------------------------------------------------------
uno::Reference< sheet::XRangeSelection > SAL_CALL DatabaseDataProvider::getRangeSelection() throw (uno::RuntimeException)
@@ -574,7 +650,7 @@ void DatabaseDataProvider::impl_executeRowSet_throw(::osl::ResettableMutexGuard&
m_xRowSet->execute();
}
// -----------------------------------------------------------------------------
-void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories)
+void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories,const uno::Sequence< uno::Sequence< ::rtl::OUString > >& i_aColumnNames)
{
// clear the data before fill the new one
uno::Reference< chart::XChartDataArray> xChartData(m_xInternal,uno::UNO_QUERY);
@@ -586,35 +662,53 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat
m_xInternal->deleteSequence(0);
}
- uno::Sequence< ::rtl::OUString > aColumns;
uno::Reference< sdbcx::XColumnsSupplier> xColSup(m_xRowSet,uno::UNO_QUERY_THROW);
uno::Reference< container::XNameAccess > xColumns = xColSup->getColumns();
- if ( xColumns.is() )
+ uno::Sequence< ::rtl::OUString > aColumns;
+ if ( i_aColumnNames.getLength() )
+ {
+ aColumns.realloc(1);
+ aColumns[0] = xColumns->getElementNames()[0];
+ for(sal_Int32 i = 0 ; i < i_aColumnNames.getLength();++i)
+ {
+ if ( i_aColumnNames[i].getLength() )
+ {
+ sal_Int32 nCount = aColumns.getLength();
+ aColumns.realloc(nCount+1);
+ aColumns[nCount] = i_aColumnNames[i][0];
+ }
+ }
+ }
+ else
+ {
aColumns = xColumns->getElementNames();
+ }
// fill the data
uno::Reference< sdbc::XResultSet> xRes(m_xRowSet,uno::UNO_QUERY_THROW);
uno::Reference< sdbc::XRow> xRow(m_xRowSet,uno::UNO_QUERY_THROW);
uno::Reference< sdbc::XResultSetMetaData> xResultSetMetaData = uno::Reference< sdbc::XResultSetMetaDataSupplier>(m_xRowSet,uno::UNO_QUERY)->getMetaData();
+ uno::Reference< sdbc::XColumnLocate> xColumnLocate(m_xRowSet,uno::UNO_QUERY_THROW);
::std::vector<sal_Int32> aColumnTypes;
uno::Sequence< uno::Any > aLabelArgs(1);
const sal_Int32 nCount = aColumns.getLength();
if ( nCount )
aColumnTypes.push_back(xResultSetMetaData->getColumnType(1));
- for (sal_Int32 i = 1; i < nCount; ++i)
- {
- aColumnTypes.push_back(xResultSetMetaData->getColumnType(i+1));
- } // for (sal_Int32 i = 1; i < nCount; ++i)
+ ::std::vector< sal_Int32 > aColumnPositions;
const ::rtl::OUString* pIter = aColumns.getConstArray();
const ::rtl::OUString* pEnd = pIter + aColumns.getLength();
for(sal_Int32 k = 0;pIter != pEnd;++pIter,++k)
{
+ aColumnPositions.push_back(xColumnLocate->findColumn(*pIter));
uno::Reference< beans::XPropertySet> xColumn(xColumns->getByName(*pIter),uno::UNO_QUERY);
+ sal_Int32 nType = sdbc::DataType::VARCHAR;
if ( xColumn.is() )
{
m_aNumberFormats.insert( ::std::map< ::rtl::OUString,uno::Any>::value_type(::rtl::OUString::valueOf(k),xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT)));
+ xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
}
+ aColumnTypes.push_back(nType);
}
::std::vector< ::rtl::OUString > aRowLabels;
@@ -628,9 +722,17 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat
aValue.fill(1,aColumnTypes[0],xRow);
aRowLabels.push_back(aValue.getString());
::std::vector< double > aRow;
- for (sal_Int32 j = _bHasCategories ? 2 : 1,i = 0; j <= nCount; ++j,++i)
+ ::std::vector< sal_Int32 >::iterator aColumnPosIter = aColumnPositions.begin();
+ ::std::vector< sal_Int32 >::iterator aColumnPosEnd = aColumnPositions.end();
+ sal_Int32 i = 0;
+ if ( _bHasCategories )
{
- aValue.fill(j,aColumnTypes[j-1],xRow);
+ ++aColumnPosIter;
+ ++i;
+ }
+ for (; aColumnPosIter != aColumnPosEnd; ++aColumnPosIter,++i)
+ {
+ aValue.fill(*aColumnPosIter,aColumnTypes[i],xRow);
if ( aValue.isNull() )
{
double nValue;
@@ -639,7 +741,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat
}
else
aRow.push_back(aValue.getDouble());
- } // for (sal_Int32 j = 2,i = 0; j <= nCount; ++j,++i)
+ }
aDataValues.push_back(aRow);
} // while( xRes->next() && (!m_RowLimit || nRowCount < m_RowLimit) )
diff --git a/dbaccess/source/core/misc/services.cxx b/dbaccess/source/core/misc/services.cxx
index 7b3ea6a54..ac3d69e67 100644
--- a/dbaccess/source/core/misc/services.cxx
+++ b/dbaccess/source/core/misc/services.cxx
@@ -94,28 +94,6 @@ extern "C" OOO_DLLPUBLIC_DBA void SAL_CALL component_getImplementationEnvironmen
}
//---------------------------------------------------------------------------------------
-extern "C" OOO_DLLPUBLIC_DBA sal_Bool SAL_CALL component_writeInfo(
- void* pServiceManager,
- void* pRegistryKey
- )
-{
- if (pRegistryKey)
- try
- {
- return ::dba::DbaModule::getInstance().writeComponentInfos(
- static_cast< XMultiServiceFactory* >( pServiceManager ),
- static_cast< XRegistryKey* >( pRegistryKey ) )
- && cppu::component_writeInfoHelper(pServiceManager, pRegistryKey, dba::entries);
- }
- catch (InvalidRegistryException& )
- {
- OSL_ENSURE( false, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !" );
- }
-
- return sal_False;
-}
-
-//---------------------------------------------------------------------------------------
extern "C" OOO_DLLPUBLIC_DBA void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
diff --git a/dbaccess/source/ext/adabas/Acomponentmodule.cxx b/dbaccess/source/ext/adabas/Acomponentmodule.cxx
index 1c34c2652..bceba0388 100644
--- a/dbaccess/source/ext/adabas/Acomponentmodule.cxx
+++ b/dbaccess/source/ext/adabas/Acomponentmodule.cxx
@@ -248,54 +248,6 @@ namespace COMPMOD_NAMESPACE
}
//--------------------------------------------------------------------------
- sal_Bool OModule::writeComponentInfos(
- const Reference< XMultiServiceFactory >& /*_rxServiceManager*/,
- const Reference< XRegistryKey >& _rxRootKey)
- {
- OSL_ENSURE(_rxRootKey.is(), "OModule::writeComponentInfos : invalid argument !");
-
- if (!s_pImplementationNames)
- {
- OSL_ASSERT("OModule::writeComponentInfos : have no class infos ! Are you sure called this method at the right time ?");
- return sal_True;
- }
- OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers,
- "OModule::writeComponentInfos : inconsistent state (the pointers) !");
- OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength())
- && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength())
- && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()),
- "OModule::writeComponentInfos : inconsistent state !");
-
- sal_Int32 nLen = s_pImplementationNames->getLength();
- const ::rtl::OUString* pImplName = s_pImplementationNames->getConstArray();
- const Sequence< ::rtl::OUString >* pServices = s_pSupportedServices->getConstArray();
-
- ::rtl::OUString sRootKey("/", 1, RTL_TEXTENCODING_ASCII_US);
- for (sal_Int32 i=0; i<nLen; ++i, ++pImplName, ++pServices)
- {
- ::rtl::OUString aMainKeyName(sRootKey);
- aMainKeyName += *pImplName;
- aMainKeyName += ::rtl::OUString::createFromAscii("/UNO/SERVICES");
-
- try
- {
- Reference< XRegistryKey > xNewKey( _rxRootKey->createKey(aMainKeyName) );
-
- const ::rtl::OUString* pService = pServices->getConstArray();
- for (sal_Int32 j=0; j<pServices->getLength(); ++j, ++pService)
- xNewKey->createKey(*pService);
- }
- catch(Exception&)
- {
- OSL_ASSERT("OModule::writeComponentInfos : something went wrong while creating the keys !");
- return sal_False;
- }
- }
-
- return sal_True;
- }
-
- //--------------------------------------------------------------------------
Reference< XInterface > OModule::getComponentFactory(
const ::rtl::OUString& _rImplementationName,
const Reference< XMultiServiceFactory >& _rxServiceManager)
diff --git a/dbaccess/source/ext/adabas/Acomponentmodule.hxx b/dbaccess/source/ext/adabas/Acomponentmodule.hxx
index a9211527f..0a6d531cf 100644
--- a/dbaccess/source/ext/adabas/Acomponentmodule.hxx
+++ b/dbaccess/source/ext/adabas/Acomponentmodule.hxx
@@ -137,21 +137,6 @@ typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleService
static void revokeComponent(
const ::rtl::OUString& _rImplementationName);
- /** write the registration information of all known components
- <p>writes the registration information of all components which are currently registered into the
- specified registry.<p/>
- <p>Usually used from within component_writeInfo.<p/>
- @param _rxServiceManager
- the service manager
- @param _rRootKey
- the registry key under which the information will be stored
- @return
- sal_True if the registration of all implementations was successfull, sal_False otherwise
- */
- static sal_Bool writeComponentInfos(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey >& _rRootKey);
-
/** creates a Factory for the component with the given implementation name.
<p>Usually used from within component_getFactory.<p/>
@param _rxServiceManager
diff --git a/dbaccess/source/ext/adabas/Aservices.cxx b/dbaccess/source/ext/adabas/Aservices.cxx
index 2009147b7..a879e5fb4 100644
--- a/dbaccess/source/ext/adabas/Aservices.cxx
+++ b/dbaccess/source/ext/adabas/Aservices.cxx
@@ -74,27 +74,6 @@ component_getImplementationEnvironment(
}
//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
- void* pServiceManager,
- void* pRegistryKey
- )
-{
- if (pRegistryKey)
- try
- {
- return OModule::writeComponentInfos(
- static_cast<XMultiServiceFactory*>(pServiceManager),
- static_cast<XRegistryKey*>(pRegistryKey));
- }
- catch (InvalidRegistryException& )
- {
- OSL_ASSERT("DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
- }
-
- return sal_False;
-}
-
-//---------------------------------------------------------------------------------------
extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
diff --git a/dbaccess/source/ext/adabas/adabasui.component b/dbaccess/source/ext/adabas/adabasui.component
new file mode 100644
index 000000000..e547a0cff
--- /dev/null
+++ b/dbaccess/source/ext/adabas/adabasui.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.openoffice.comp.adabasui.AdabasCreateDialog">
+ <service name="com.sun.star.sdb.AdabasCreationDialog"/>
+ </implementation>
+</component>
diff --git a/dbaccess/source/ext/adabas/adabasui.dxp b/dbaccess/source/ext/adabas/adabasui.dxp
index db9c0a52f..926e49f5f 100644
--- a/dbaccess/source/ext/adabas/adabasui.dxp
+++ b/dbaccess/source/ext/adabas/adabasui.dxp
@@ -1,4 +1,3 @@
component_getImplementationEnvironment
-component_writeInfo
component_getFactory
diff --git a/dbaccess/source/ext/adabas/exports.dxp b/dbaccess/source/ext/adabas/exports.dxp
index 9630d7e06..f0e1c6993 100644
--- a/dbaccess/source/ext/adabas/exports.dxp
+++ b/dbaccess/source/ext/adabas/exports.dxp
@@ -1,3 +1,2 @@
component_getImplementationEnvironment
-component_writeInfo
component_getFactory
diff --git a/dbaccess/source/ext/adabas/makefile.mk b/dbaccess/source/ext/adabas/makefile.mk
index e23310ac9..8dbbe7abc 100644
--- a/dbaccess/source/ext/adabas/makefile.mk
+++ b/dbaccess/source/ext/adabas/makefile.mk
@@ -91,3 +91,10 @@ RESLIB1SRSFILES=$(RES1FILELIST)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/adabasui.component
+
+$(MISC)/adabasui.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ adabasui.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt adabasui.component
diff --git a/dbaccess/source/ext/macromigration/dbmm.component b/dbaccess/source/ext/macromigration/dbmm.component
new file mode 100644
index 000000000..a74e94510
--- /dev/null
+++ b/dbaccess/source/ext/macromigration/dbmm.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.dbaccess.macromigration.MacroMigrationDialogService">
+ <service name="com.sun.star.sdb.application.MacroMigrationWizard"/>
+ </implementation>
+</component>
diff --git a/dbaccess/source/ext/macromigration/makefile.mk b/dbaccess/source/ext/macromigration/makefile.mk
index 41898091c..b71330f17 100644
--- a/dbaccess/source/ext/macromigration/makefile.mk
+++ b/dbaccess/source/ext/macromigration/makefile.mk
@@ -99,3 +99,11 @@ RESLIB1SRSFILES=$(RES1FILELIST)
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/dbmm.component
+
+$(MISC)/dbmm.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ dbmm.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt dbmm.component
diff --git a/dbaccess/source/filter/migration/cfgservices.cxx b/dbaccess/source/filter/migration/cfgservices.cxx
index 57b529960..695edf554 100644
--- a/dbaccess/source/filter/migration/cfgservices.cxx
+++ b/dbaccess/source/filter/migration/cfgservices.cxx
@@ -74,27 +74,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(
}
//---------------------------------------------------------------------------------------
-extern "C" sal_Bool SAL_CALL component_writeInfo(
- void* pServiceManager,
- void* pRegistryKey
- )
-{
- if (pRegistryKey)
- try
- {
- return ::dbacfg::OModuleRegistration::writeComponentInfos(
- static_cast<XMultiServiceFactory*>(pServiceManager),
- static_cast<XRegistryKey*>(pRegistryKey));
- }
- catch (InvalidRegistryException& )
- {
- OSL_ENSURE(sal_False, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
- }
-
- return sal_False;
-}
-
-//---------------------------------------------------------------------------------------
extern "C" void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
diff --git a/dbaccess/source/filter/migration/dbacfg.component b/dbaccess/source/filter/migration/dbacfg.component
new file mode 100644
index 000000000..65e92d0f5
--- /dev/null
+++ b/dbaccess/source/filter/migration/dbacfg.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.sdb.DataSourceMigration">
+ <service name="com.sun.star.sdb.DataSourceMigration"/>
+ </implementation>
+</component>
diff --git a/dbaccess/source/filter/migration/makefile.mk b/dbaccess/source/filter/migration/makefile.mk
index 7bb53208d..3a8a37e07 100644
--- a/dbaccess/source/filter/migration/makefile.mk
+++ b/dbaccess/source/filter/migration/makefile.mk
@@ -72,3 +72,11 @@ DEF1NAME=$(SHL1TARGET)
# --- Targets ----------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/dbacfg.component
+
+$(MISC)/dbacfg.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ dbacfg.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt dbacfg.component
diff --git a/dbaccess/source/filter/xml/dbaxml.component b/dbaccess/source/filter/xml/dbaxml.component
new file mode 100644
index 000000000..23b3a5c1a
--- /dev/null
+++ b/dbaccess/source/filter/xml/dbaxml.component
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.sdb.DBExportFilter">
+ <service name="com.sun.star.document.ExportFilter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.sdb.DBFilter">
+ <service name="com.sun.star.document.ImportFilter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.sdb.XMLFullExporter">
+ <service name="com.sun.star.document.ExportFilter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.sdb.XMLSettingsExporter">
+ <service name="com.sun.star.document.ExportFilter"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbflt.DBContentLoader2">
+ <service name="com.sun.star.frame.FrameLoader"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbflt.DBTypeDetection">
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+</component>
diff --git a/dbaccess/source/filter/xml/makefile.mk b/dbaccess/source/filter/xml/makefile.mk
index 6c6091c5f..e36173f5a 100644
--- a/dbaccess/source/filter/xml/makefile.mk
+++ b/dbaccess/source/filter/xml/makefile.mk
@@ -112,3 +112,11 @@ DEF1NAME=$(SHL1TARGET)
# --- Targets ----------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/dbaxml.component
+
+$(MISC)/dbaxml.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ dbaxml.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt dbaxml.component
diff --git a/dbaccess/source/filter/xml/xmlservices.cxx b/dbaccess/source/filter/xml/xmlservices.cxx
index 852fd3625..dbc373e05 100644
--- a/dbaccess/source/filter/xml/xmlservices.cxx
+++ b/dbaccess/source/filter/xml/xmlservices.cxx
@@ -84,28 +84,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(
}
//---------------------------------------------------------------------------------------
-extern "C" sal_Bool SAL_CALL component_writeInfo(
- void* pServiceManager,
- void* pRegistryKey
- )
-{
- if (pRegistryKey)
- try
- {
- writeDBLoaderInfo2(pRegistryKey);
- return ::dbaxml::OModuleRegistration::writeComponentInfos(
- static_cast<XMultiServiceFactory*>(pServiceManager),
- static_cast<XRegistryKey*>(pRegistryKey));
- }
- catch (InvalidRegistryException& )
- {
- OSL_ENSURE(sal_False, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
- }
-
- return sal_False;
-}
-
-//---------------------------------------------------------------------------------------
extern "C" void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
diff --git a/dbaccess/source/inc/registrationhelper.hxx b/dbaccess/source/inc/registrationhelper.hxx
index 7399ff861..fdb21f3e9 100644
--- a/dbaccess/source/inc/registrationhelper.hxx
+++ b/dbaccess/source/inc/registrationhelper.hxx
@@ -73,16 +73,6 @@ public:
static void revokeComponent(
const ::rtl::OUString& _rImplementationName);
- /** writes the registration information of all components which are currently registered into the specified registry.
- Usually used from within component_writeInfo.
- @param _rxServiceManager the service manager
- @param _rRootKey the registry key under which the information will be stored
- @return sal_True if the registration of all implementations was successfull, sal_False otherwise
- */
- static sal_Bool writeComponentInfos(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey >& _rRootKey);
-
/** creates a Factory for the component with the given implementation name. Usually used from within component_getFactory.
@param _rxServiceManager a pointer to an XMultiServiceFactory interface as got in component_getFactory
@param _pImplementationName the implementation name of the component
diff --git a/dbaccess/source/sdbtools/misc/sdbt_services.cxx b/dbaccess/source/sdbtools/misc/sdbt_services.cxx
index f62574b3e..150282e95 100644
--- a/dbaccess/source/sdbtools/misc/sdbt_services.cxx
+++ b/dbaccess/source/sdbtools/misc/sdbt_services.cxx
@@ -66,27 +66,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(
}
//---------------------------------------------------------------------------------------
-extern "C" sal_Bool SAL_CALL component_writeInfo(
- void* pServiceManager,
- void* pRegistryKey
- )
-{
- if (pRegistryKey)
- try
- {
- return ::sdbtools::SdbtModule::getInstance().writeComponentInfos(
- static_cast<XMultiServiceFactory*>(pServiceManager),
- static_cast<XRegistryKey*>(pRegistryKey));
- }
- catch (const InvalidRegistryException& )
- {
- OSL_ASSERT("sdbt::component_writeInfo: could not create a registry key (InvalidRegistryException) !");
- }
-
- return sal_False;
-}
-
-//---------------------------------------------------------------------------------------
extern "C" void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
diff --git a/dbaccess/source/shared/registrationhelper.cxx b/dbaccess/source/shared/registrationhelper.cxx
index d96d6250f..f36ec97e2 100644
--- a/dbaccess/source/shared/registrationhelper.cxx
+++ b/dbaccess/source/shared/registrationhelper.cxx
@@ -116,54 +116,6 @@ void OModuleRegistration::revokeComponent(const ::rtl::OUString& _rImplementatio
}
//--------------------------------------------------------------------------
-sal_Bool OModuleRegistration::writeComponentInfos(
- const uno::Reference< lang::XMultiServiceFactory >& /*_rxServiceManager*/,
- const uno::Reference< registry::XRegistryKey >& _rxRootKey)
-{
- OSL_ENSURE(_rxRootKey.is(), "OModuleRegistration::writeComponentInfos : invalid argument !");
-
- if (!s_pImplementationNames)
- {
- OSL_ENSURE(sal_False, "OModuleRegistration::writeComponentInfos : have no class infos ! Are you sure called this method at the right time ?");
- return sal_True;
- }
- OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers,
- "OModuleRegistration::writeComponentInfos : inconsistent state (the pointers) !");
- OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength())
- && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength())
- && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()),
- "OModuleRegistration::writeComponentInfos : inconsistent state !");
-
- sal_Int32 nLen = s_pImplementationNames->getLength();
- const ::rtl::OUString* pImplName = s_pImplementationNames->getConstArray();
- const uno::Sequence< ::rtl::OUString >* pServices = s_pSupportedServices->getConstArray();
-
- ::rtl::OUString sRootKey("/", 1, RTL_TEXTENCODING_ASCII_US);
- for (sal_Int32 i=0; i<nLen; ++i, ++pImplName, ++pServices)
- {
- ::rtl::OUString aMainKeyName(sRootKey);
- aMainKeyName += *pImplName;
- aMainKeyName += ::rtl::OUString::createFromAscii("/UNO/SERVICES");
-
- try
- {
- uno::Reference< registry::XRegistryKey > xNewKey( _rxRootKey->createKey(aMainKeyName) );
-
- const ::rtl::OUString* pService = pServices->getConstArray();
- for (sal_Int32 j=0; j<pServices->getLength(); ++j, ++pService)
- xNewKey->createKey(*pService);
- }
- catch(uno::Exception const&)
- {
- OSL_ENSURE(sal_False, "OModuleRegistration::writeComponentInfos : something went wrong while creating the keys !");
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
-//--------------------------------------------------------------------------
uno::Reference< uno::XInterface > OModuleRegistration::getComponentFactory(
const ::rtl::OUString& _rImplementationName,
const uno::Reference< lang::XMultiServiceFactory >& _rxServiceManager)
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 94bbb23d7..001105bc1 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -1347,7 +1347,9 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
InvalidateAll();
break;
case SID_DB_APP_DSRELDESIGN:
- if ( !m_pSubComponentManager->activateSubFrame( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN ) )
+ {
+ Reference< XComponent > xRelationDesigner;
+ if ( !m_pSubComponentManager->activateSubFrame( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xRelationDesigner ) )
{
SharedConnection xConnection( ensureConnection() );
if ( xConnection.is() )
@@ -1359,7 +1361,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
onDocumentOpened( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, NULL );
}
}
- break;
+ }
+ break;
case SID_DB_APP_DSUSERADMIN:
{
SharedConnection xConnection( ensureConnection() );
@@ -1844,7 +1847,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
case E_REPORT:
case E_FORM:
{
- if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode ) )
+ if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode, xRet ) )
{
::std::auto_ptr< OLinkedDocumentsAccess > aHelper = getDocumentsAccess( _eType );
if ( !aHelper->isConnected() )
@@ -1861,7 +1864,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
case E_QUERY:
case E_TABLE:
{
- if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode ) )
+ if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode, xRet ) )
{
SharedConnection xConnection( ensureConnection() );
if ( !xConnection.is() )
diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx
index 251ba9b8d..ea37fcf96 100644
--- a/dbaccess/source/ui/app/subcomponentmanager.cxx
+++ b/dbaccess/source/ui/app/subcomponentmanager.cxx
@@ -529,7 +529,8 @@ namespace dbaui
}
//------------------------------------------------------------------------------------------------------------------
- bool SubComponentManager::activateSubFrame( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType, const ElementOpenMode _eOpenMode ) const
+ bool SubComponentManager::activateSubFrame( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType,
+ const ElementOpenMode _eOpenMode, Reference< XComponent >& o_rComponent ) const
{
::osl::MutexGuard aGuard( m_pData->getMutex() );
@@ -546,6 +547,13 @@ namespace dbaui
const Reference< XTopWindow > xTopWindow( xFrame->getContainerWindow(), UNO_QUERY_THROW );
xTopWindow->toFront();
+ if ( pos->xModel.is() )
+ o_rComponent = pos->xModel.get();
+ else if ( pos->xController.is() )
+ o_rComponent = pos->xController.get();
+ else
+ o_rComponent = pos->xFrame.get();
+
return true;
}
diff --git a/dbaccess/source/ui/app/subcomponentmanager.hxx b/dbaccess/source/ui/app/subcomponentmanager.hxx
index d84cef286..a0dd80b65 100644
--- a/dbaccess/source/ui/app/subcomponentmanager.hxx
+++ b/dbaccess/source/ui/app/subcomponentmanager.hxx
@@ -90,7 +90,8 @@ namespace dbaui
bool activateSubFrame(
const ::rtl::OUString& _rName,
const sal_Int32 _nComponentType,
- const ElementOpenMode _eOpenMode
+ const ElementOpenMode _eOpenMode,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rComponent
) const;
/** closes all frames of the given component
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 41bb28651..23bd7bd99 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -2751,6 +2751,7 @@ void SbaXDataBrowserController::unloading(const EventObject& /*aEvent*/) throw(
void SbaXDataBrowserController::unloaded(const EventObject& /*aEvent*/) throw( RuntimeException )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::unloaded" );
+ m_xParser.clear();
InvalidateAll();
// do this asynchron, there are other listeners reacting on this message ...
// (it's a little hack : the grid columns are listening to this event, too, and their bound field may
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index bdd31895a..451840e9a 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1106,9 +1106,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS
// expand if required so
if (_bExpandAncestors)
{
- m_sToBeLoaded = _rCommand;
m_pTreeView->getListBox().Expand(pCommandType);
- m_sToBeLoaded = ::rtl::OUString();
}
// look for the object
@@ -2054,7 +2052,7 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce
const ::rtl::OUString* pEnd = pIter + aNames.getLength();
for (; pIter != pEnd; ++pIter)
{
- if( (!m_sToBeLoaded.getLength() || m_sToBeLoaded == *pIter) && !m_pTreeView->getListBox().GetEntryPosByName(*pIter,_pParent))
+ if( !m_pTreeView->getListBox().GetEntryPosByName(*pIter,_pParent))
{
Reference<XNameAccess> xChild(_xNameAccess->getByName(*pIter),UNO_QUERY);
DBTreeListUserData* pEntryData = new DBTreeListUserData;
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 088d97cfb..5e234a3d9 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -147,7 +147,7 @@
#ifndef _SFX_DOCFILT_HACK_HXX
#include <sfx2/docfilt.hxx>
#endif
-#if !defined(WINDOWS_VISTA_PSDK) && (defined(WIN) || defined(WNT))
+#if !defined(WINDOWS_VISTA_PSDK) && defined(WNT)
#define _ADO_DATALINK_BROWSE_
#endif
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index 3fd7b6df0..f87cbe29a 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -153,7 +153,7 @@
#include <sfx2/docfilt.hxx>
#endif
#include "dsnItem.hxx"
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
#define _ADO_DATALINK_BROWSE_
#endif
diff --git a/dbaccess/source/ui/dlg/adodatalinks.cxx b/dbaccess/source/ui/dlg/adodatalinks.cxx
index 97942a04c..91370a031 100644
--- a/dbaccess/source/ui/dlg/adodatalinks.cxx
+++ b/dbaccess/source/ui/dlg/adodatalinks.cxx
@@ -29,7 +29,7 @@
#include "precompiled_dbaccess.hxx"
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
#if defined _MSC_VER
#pragma warning(push, 1)
#pragma warning(disable: 4917)
diff --git a/dbaccess/source/ui/dlg/odbcconfig.cxx b/dbaccess/source/ui/dlg/odbcconfig.cxx
index 27d5176d6..270571ed9 100644
--- a/dbaccess/source/ui/dlg/odbcconfig.cxx
+++ b/dbaccess/source/ui/dlg/odbcconfig.cxx
@@ -56,7 +56,7 @@
#ifdef HAVE_ODBC_SUPPORT
-#if defined(WIN) || defined(OS2)
+#if defined(OS2)
#define ODBC_LIBRARY "ODBC.DLL"
#define ODBC_UI_LIBRARY "ODBCINST.DLL"
#endif
@@ -78,7 +78,7 @@
// just to go with calling convention of windows
// so don't touch this
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
#define SQL_API __stdcall
// At least under some circumstances, the below #include <odbc/sqlext.h> re-
// defines SQL_API to an empty string, leading to a compiler warning on MSC; to
@@ -88,7 +88,7 @@
#pragma warning(push)
#pragma warning(disable: 4005)
#endif
-#endif // defined(WIN) || defined(WNT)
+#endif // defined(WNT)
#if defined(OS2)
#define ALLREADY_HAVE_OS2_TYPES
@@ -103,13 +103,13 @@
#endif
#endif
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
#if defined _MSC_VER
#pragma warning(pop)
#endif
#undef SQL_API
#define SQL_API __stdcall
-#endif // defined(WIN) || defined(WNT)
+#endif // defined(WNT)
// from here on you can do what you want to
#if defined(OS2)
diff --git a/dbaccess/source/ui/dlg/odbcconfig.hxx b/dbaccess/source/ui/dlg/odbcconfig.hxx
index 1b15435db..dd63c3155 100644
--- a/dbaccess/source/ui/dlg/odbcconfig.hxx
+++ b/dbaccess/source/ui/dlg/odbcconfig.hxx
@@ -30,11 +30,11 @@
#include "commontypes.hxx"
-#if defined(WIN) || defined(WNT) || defined (UNX) || defined (OS2)
+#if defined(WNT) || defined (UNX) || defined (OS2)
#define HAVE_ODBC_SUPPORT
#endif
-#if ( defined(WIN) || defined(WNT) || defined (OS2) ) && defined(HAVE_ODBC_SUPPORT)
+#if ( defined(WNT) || defined (OS2) ) && defined(HAVE_ODBC_SUPPORT)
#define HAVE_ODBC_ADMINISTRATION
#endif
diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx
index 19e6a07dd..6aeb1415e 100644
--- a/dbaccess/source/ui/inc/TableController.hxx
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -135,7 +135,7 @@ namespace dbaui
inline ::std::vector< ::boost::shared_ptr<OTableRow> >* getRows() { return &m_vRowList; }
/// returns the postion of the the first empty row
- sal_Int32 getFirstEmptyRowPosition() const;
+ sal_Int32 getFirstEmptyRowPosition();
inline const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo; }
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 0fb37b65d..e87f1caf1 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -157,7 +157,7 @@ namespace dbaui
OTableCopyHelper m_aTableCopyHelper;
::rtl::OUString m_sQueryCommand; // the command of the query currently loaded (if any)
- ::rtl::OUString m_sToBeLoaded; // contains the element name which should be loaded if any
+ //::rtl::OUString m_sToBeLoaded; // contains the element name which should be loaded if any
DBTreeView* m_pTreeView;
Splitter* m_pSplitter;
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index a4ccd6883..6de15f1ce 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -100,7 +100,7 @@ ODatabaseImportExport::ODatabaseImportExport(const ::svx::ODataAccessDescriptor&
const Reference< XMultiServiceFactory >& _rM,
const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
const String& rExchange)
- :m_bBookmarkSelection(sal_False)
+ :m_bBookmarkSelection( sal_False )
,m_xFormatter(_rxNumberF)
,m_xFactory(_rM)
,m_nCommandType(CommandType::TABLE)
@@ -131,7 +131,7 @@ ODatabaseImportExport::ODatabaseImportExport(const ::svx::ODataAccessDescriptor&
// import data
ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& _rxConnection,
const Reference< XNumberFormatter >& _rxNumberF, const Reference< XMultiServiceFactory >& _rM )
- :m_bBookmarkSelection(sal_False)
+ :m_bBookmarkSelection( sal_False )
,m_xConnection(_rxConnection)
,m_xFormatter(_rxNumberF)
,m_xFactory(_rM)
diff --git a/dbaccess/source/ui/misc/uiservices.cxx b/dbaccess/source/ui/misc/uiservices.cxx
index 019c9853a..792b3a686 100644
--- a/dbaccess/source/ui/misc/uiservices.cxx
+++ b/dbaccess/source/ui/misc/uiservices.cxx
@@ -125,28 +125,6 @@ extern "C" DBACCESS_DLLPUBLIC void SAL_CALL component_getImplementationEnvironme
}
//---------------------------------------------------------------------------------------
-extern "C" DBACCESS_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo(
- void* pServiceManager,
- void* pRegistryKey
- )
-{
- if (pRegistryKey)
- try
- {
- writeDBLoaderInfo(pRegistryKey);
- return ::dbaui::OModuleRegistration::writeComponentInfos(
- static_cast<XMultiServiceFactory*>(pServiceManager),
- static_cast<XRegistryKey*>(pRegistryKey));
- }
- catch (InvalidRegistryException& )
- {
- OSL_ENSURE(sal_False, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
- }
-
- return sal_False;
-}
-
-//---------------------------------------------------------------------------------------
extern "C" DBACCESS_DLLPUBLIC void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 8aab21720..6990143f8 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -136,9 +136,6 @@ DBG_NAME(OTableEditorCtrl)
#define HANDLE_ID 0
-// Anzahl Spalten beim Neuanlegen
-#define NEWCOLS 128
-
// default Spaltenbreiten
#define FIELDNAME_WIDTH 100
#define FIELDTYPE_WIDTH 150
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 05b72dc89..180019a8e 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -108,6 +108,9 @@ using namespace ::dbtools;
using namespace ::dbaui;
using namespace ::comphelper;
+// Anzahl Spalten beim Neuanlegen
+#define NEWCOLS 128
+
namespace
{
void dropTable(const Reference<XNameAccess>& _rxTable,const ::rtl::OUString& _sTableName)
@@ -958,7 +961,7 @@ void OTableController::loadData()
OSL_ENSURE(aTypeIter != m_aTypeInfo.end(),"We have no type infomation!");
bool bReadRow = !isAddAllowed();
- for(sal_Int32 i=m_vRowList.size(); i<128; i++ )
+ for(sal_Int32 i=m_vRowList.size(); i < NEWCOLS; i++ )
{
pTabEdRow.reset(new OTableRow());
pTabEdRow->SetReadOnly(bReadRow);
@@ -1579,7 +1582,7 @@ void OTableController::reload()
static_cast<OTableDesignView*>(getView())->Invalidate();
}
// -----------------------------------------------------------------------------
-sal_Int32 OTableController::getFirstEmptyRowPosition() const
+sal_Int32 OTableController::getFirstEmptyRowPosition()
{
sal_Int32 nRet = -1;
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_vRowList.begin();
@@ -1592,6 +1595,14 @@ sal_Int32 OTableController::getFirstEmptyRowPosition() const
break;
}
}
+ if ( nRet == -1 )
+ {
+ bool bReadRow = !isAddAllowed();
+ ::boost::shared_ptr<OTableRow> pTabEdRow(new OTableRow());
+ pTabEdRow->SetReadOnly(bReadRow);
+ nRet = m_vRowList.size();
+ m_vRowList.push_back( pTabEdRow);
+ }
return nRet;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/util/dba.component b/dbaccess/util/dba.component
new file mode 100644
index 000000000..b25768dbf
--- /dev/null
+++ b/dbaccess/util/dba.component
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.chart2.data.DatabaseDataProvider">
+ <service name="com.sun.star.chart2.data.DatabaseDataProvider"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dba.DataAccessDescriptorFactory">
+ <service name="com.sun.star.sdb.DataAccessDescriptorFactory"/>
+ <singleton name="com.sun.star.sdb.DataAccessDescriptorFactory"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dba.OCommandDefinition">
+ <service name="com.sun.star.sdb.CommandDefinition"/>
+ <service name="com.sun.star.sdb.QueryDefinition"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dba.OComponentDefinition">
+ <service name="com.sun.star.sdb.TableDefinition"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dba.ODatabaseContext">
+ <service name="com.sun.star.sdb.DatabaseContext"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dba.ODatabaseDocument">
+ <service name="com.sun.star.document.OfficeDocument"/>
+ <service name="com.sun.star.sdb.OfficeDatabaseDocument"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dba.ODatabaseSource">
+ <service name="com.sun.star.sdb.DataSource"/>
+ <service name="com.sun.star.sdb.DocumentDataSource"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dba.ORowSet">
+ <service name="com.sun.star.sdb.ResultSet"/>
+ <service name="com.sun.star.sdb.RowSet"/>
+ <service name="com.sun.star.sdbc.ResultSet"/>
+ <service name="com.sun.star.sdbc.RowSet"/>
+ <service name="com.sun.star.sdbcx.ResultSet"/>
+ </implementation>
+</component>
diff --git a/dbaccess/util/dbu.component b/dbaccess/util/dbu.component
new file mode 100644
index 000000000..ce0dc45cf
--- /dev/null
+++ b/dbaccess/util/dbu.component
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.dbaccess.DatabaseInteractionHandler">
+ <service name="com.sun.star.sdb.DatabaseInteractionHandler"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dbaccess.LegacyInteractionHandler">
+ <service name="com.sun.star.sdb.InteractionHandler"/>
+ </implementation>
+ <implementation
+ name="com.sun.star.comp.dbaccess.OTextConnectionSettingsDialog">
+ <service name="com.sun.star.sdb.TextConnectionSettings"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dbu.OColumnControl">
+ <service name="com.sun.star.sdb.ColumnDescriptorControl"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dbu.OColumnControlModel">
+ <service name="com.sun.star.sdb.ColumnDescriptorControlModel"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.dbu.SbaXGridControl">
+ <service name="com.sun.star.form.control.GridControl"/>
+ <service name="com.sun.star.form.control.InteractionGridControl"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.sdb.DirectSQLDialog">
+ <service name="org.openoffice.comp.dbu.DirectSqlDialog"/>
+ </implementation>
+ <implementation name="com.sun.star.sdb.ApplicationStatusbarController">
+ <service name="com.sun.star.frame.StatusbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.sdb.ApplicationToolboxController">
+ <service name="com.sun.star.frame.ToolboxController"/>
+ </implementation>
+ <implementation name="com.sun.star.uno.comp.sdb.RowsetFilterDialog">
+ <service name="com.sun.star.sdb.FilterDialog"/>
+ </implementation>
+ <implementation name="com.sun.star.uno.comp.sdb.RowsetOrderDialog">
+ <service name="com.sun.star.sdb.OrderDialog"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.CopyTableWizard">
+ <service name="com.sun.star.sdb.application.CopyTableWizard"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.DBContentLoader">
+ <service name="com.sun.star.frame.FrameLoader"/>
+ <service name="com.sun.star.sdb.ContentLoader"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.OAdvancedSettingsDialog">
+ <service name="com.sun.star.sdb.AdvancedDatabaseSettingsDialog"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.OApplicationController">
+ <service name="com.sun.star.sdb.application.DefaultViewController"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.ODBTypeWizDialog">
+ <service name="com.sun.star.sdb.DataSourceTypeChangeDialog"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.ODBTypeWizDialogSetup">
+ <service name="com.sun.star.sdb.DatabaseWizardDialog"/>
+ </implementation>
+ <implementation
+ name="org.openoffice.comp.dbu.ODatasourceAdministrationDialog">
+ <service name="com.sun.star.sdb.DatasourceAdministrationDialog"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.ODatasourceBrowser">
+ <service name="com.sun.star.sdb.DataSourceBrowser"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.OFormGridView">
+ <service name="com.sun.star.sdb.FormGridView"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.OQueryDesign">
+ <service name="com.sun.star.sdb.QueryDesign"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.ORelationDesign">
+ <service name="com.sun.star.sdb.RelationDesign"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.OSQLMessageDialog">
+ <service name="com.sun.star.sdb.ErrorMessageDialog"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.OTableDesign">
+ <service name="com.sun.star.sdb.TableDesign"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.OTableFilterDialog">
+ <service name="com.sun.star.sdb.TableFilterDialog"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.OUserSettingsDialog">
+ <service name="com.sun.star.sdb.UserAdministrationDialog"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.dbu.OViewDesign">
+ <service name="com.sun.star.sdb.ViewDesign"/>
+ </implementation>
+</component>
diff --git a/dbaccess/util/makefile.mk b/dbaccess/util/makefile.mk
index 8430b5edf..d59855961 100644
--- a/dbaccess/util/makefile.mk
+++ b/dbaccess/util/makefile.mk
@@ -239,3 +239,23 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk
.ENDIF
.ENDIF
+
+ALLTAR : $(MISC)/dba.component $(MISC)/dbu.component $(MISC)/sdbt.component
+
+$(MISC)/dba.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ dba.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt dba.component
+
+$(MISC)/dbu.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ dbu.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL2TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt dbu.component
+
+$(MISC)/sdbt.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ sdbt.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL3TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt sdbt.component
diff --git a/dbaccess/util/sdbt.component b/dbaccess/util/sdbt.component
new file mode 100644
index 000000000..0038c0cad
--- /dev/null
+++ b/dbaccess/util/sdbt.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.dbaccess.ConnectionTools">
+ <service name="com.sun.star.sdb.tools.ConnectionTools"/>
+ </implementation>
+</component>