diff options
author | Ocke.Janssen <Ocke.Janssen@oracle.com> | 2010-11-25 14:56:27 +0100 |
---|---|---|
committer | Ocke.Janssen <Ocke.Janssen@oracle.com> | 2010-11-25 14:56:27 +0100 |
commit | 7da3a0be8c1535c7f8b392a98e8d1a29e5cd62a6 (patch) | |
tree | 9fa4a31d6e804541d79af75015b64284858ba12a /dbaccess | |
parent | ec99f8427269c43926e15d039b204525269dbc17 (diff) | |
parent | b02e3bd428c662e7b3326982d1996f56a547761e (diff) |
Automated merge with http://hg.services.openoffice.org/cws/dba34b
Diffstat (limited to 'dbaccess')
27 files changed, 131 insertions, 39 deletions
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc index 6bbf59dfc7e4..29094bee1882 100644 --- a/dbaccess/inc/dbaccess_helpid.hrc +++ b/dbaccess/inc/dbaccess_helpid.hrc @@ -292,6 +292,7 @@ #define HID_DSADMIN_ADVANCED "DBACCESS_HID_DSADMIN_ADVANCED" #define HID_DSADMIN_BOOLEANCOMPARISON "DBACCESS_HID_DSADMIN_BOOLEANCOMPARISON" #define HID_DSADMIN_ORACLE_DATABASE "DBACCESS_HID_DSADMIN_ORACLE_DATABASE" +#define HID_DSADMIN_MAXROWSCAN "DBACCESS_HID_DSADMIN_MAXROWSCAN" #define UID_APP_VIEW "DBACCESS_UID_APP_VIEW" #define HID_APP_TABLE_TREE "DBACCESS_HID_APP_TABLE_TREE" diff --git a/dbaccess/qa/complex/dbaccess/makefile.mk b/dbaccess/qa/complex/dbaccess/makefile.mk index 7778222349ab..b96faa01d605 100755 --- a/dbaccess/qa/complex/dbaccess/makefile.mk +++ b/dbaccess/qa/complex/dbaccess/makefile.mk @@ -64,8 +64,8 @@ JAVATESTFILES = \ RowSet.java \ SingleSelectQueryComposer.java \ UISettings.java \ + CopyTableWizard.java -# CopyTableWizard.java # disable for now (#i115753#) # put here all other files diff --git a/dbaccess/source/core/api/BookmarkSet.hxx b/dbaccess/source/core/api/BookmarkSet.hxx index 36d3c90c7969..2bf9b4cfd0fa 100644 --- a/dbaccess/source/core/api/BookmarkSet.hxx +++ b/dbaccess/source/core/api/BookmarkSet.hxx @@ -44,7 +44,7 @@ namespace dbaccess void updateColumn(sal_Int32 nPos,::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate > _xParameter,const connectivity::ORowSetValue& _rValue); public: - OBookmarkSet() + OBookmarkSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows) {} ~OBookmarkSet() { diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index dd64e835adb4..783c93f56593 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -106,8 +106,9 @@ using namespace ::osl; DBG_NAME(OCacheSet) // ------------------------------------------------------------------------- -OCacheSet::OCacheSet() - :m_bInserted(sal_False) +OCacheSet::OCacheSet(sal_Int32 i_nMaxRows) + :m_nMaxRows(i_nMaxRows) + ,m_bInserted(sal_False) ,m_bUpdated(sal_False) ,m_bDeleted(sal_False) { diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx index ef3503fa5e4e..70905c444610 100644 --- a/dbaccess/source/core/api/CacheSet.hxx +++ b/dbaccess/source/core/api/CacheSet.hxx @@ -83,11 +83,12 @@ namespace dbaccess ::com::sun::star::uno::Sequence<sal_Int32> m_aColumnTypes; ORowSetRow m_aInsertRow; ::rtl::OUString m_aComposedTableName; + sal_Int32 m_nMaxRows; sal_Bool m_bInserted; sal_Bool m_bUpdated; sal_Bool m_bDeleted; - OCacheSet(); + OCacheSet(sal_Int32 i_nMaxRows); virtual ~OCacheSet(); void setParameter(sal_Int32 nPos diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 81b097af79ee..8df84766575c 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -153,8 +153,10 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, const Reference< XIndexAccess>& _xTableKeys, const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name const Reference< XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache) - :m_aParameterValueForCache(_aParameterValueForCache) + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows) + :OCacheSet(i_nMaxRows) + ,m_aParameterValueForCache(_aParameterValueForCache) ,m_pKeyColumnNames(NULL) ,m_pColumnNames(NULL) ,m_pParameterNames(NULL) @@ -191,7 +193,7 @@ OKeySet::~OKeySet() void OKeySet::initColumns() { Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false; + bool bCase = (xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()) ? true : false; m_pKeyColumnNames.reset( new SelectColumnsMetaData(bCase) ); m_pColumnNames.reset( new SelectColumnsMetaData(bCase) ); m_pParameterNames.reset( new SelectColumnsMetaData(bCase) ); @@ -1382,7 +1384,7 @@ sal_Bool OKeySet::fetchRow() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::fetchRow" ); // fetch the next row and append on the keyset sal_Bool bRet = sal_False; - if ( !m_bRowCountFinal ) + if ( !m_bRowCountFinal && (!m_nMaxRows || sal_Int32(m_aKeyMap.size()) < m_nMaxRows) ) bRet = m_xDriverSet->next(); if ( bRet ) { diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index ecb56d7c88b4..597f659f1d94 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -159,7 +159,8 @@ namespace dbaccess const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xTableKeys, const ::rtl::OUString& _rUpdateTableName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache); + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows); // 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); diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 837824751f0f..d984ca2c78c6 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -102,8 +102,9 @@ DBG_NAME(OptimisticSet) OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext, const Reference< XConnection>& i_xConnection, const Reference< XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache) - :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache) + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows) + :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows) ,m_aSqlParser( _rContext.getLegacyServiceFactory() ) ,m_aSqlIterator( i_xConnection, Reference<XTablesSupplier>(_xComposer,UNO_QUERY)->getTables(), m_aSqlParser, NULL ) ,m_bResultSetChanged(false) @@ -124,7 +125,7 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const :: initColumns(); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false; + bool bCase = (xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()) ? true : false; Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY); const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns(); const Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY); diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx index ba0a04c8b773..da73eaeee8c5 100644 --- a/dbaccess/source/core/api/OptimisticSet.hxx +++ b/dbaccess/source/core/api/OptimisticSet.hxx @@ -79,7 +79,8 @@ namespace dbaccess OptimisticSet(const ::comphelper::ComponentContext& _rContext, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& i_xConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache); + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows); // 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); diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 829155709119..11ca26823a6a 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -348,7 +348,7 @@ void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const case PROPERTY_ID_FETCHSIZE: if(m_pCache) { - m_pCache->setMaxRowSize(m_nFetchSize); + m_pCache->setFetchSize(m_nFetchSize); fireRowcount(); } break; @@ -1661,6 +1661,8 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() try { xStatementProps->setPropertyValue( PROPERTY_USEBOOKMARKS, makeAny( sal_True ) ); + xStatementProps->setPropertyValue( PROPERTY_MAXROWS, makeAny( m_nMaxRows ) ); + setStatementResultSetType( xStatementProps, m_nResultSetType, m_nResultSetConcurrency ); } catch ( const Exception& ) @@ -1817,13 +1819,13 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn: creating cache" ); - m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter ); + m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter,m_nMaxRows ); if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY ) { m_nPrivileges = Privilege::SELECT; m_pCache->m_nPrivileges = Privilege::SELECT; } - m_pCache->setMaxRowSize(m_nFetchSize); + m_pCache->setFetchSize(m_nFetchSize); m_aCurrentRow = m_pCache->createIterator(this); m_aOldRow = m_pCache->registerOldRow(); } @@ -2241,7 +2243,7 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() try { Reference<XDatabaseMetaData> xMeta = m_xActiveConnection->getMetaData(); - bCase = xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers(); + bCase = xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(); } catch(SQLException&) { diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index e4e468b13779..0ca34e11b66b 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -91,7 +91,8 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, sal_Bool& _bModified, sal_Bool& _bNew, const ORowSetValueVector& _aParameterValueForCache, - const ::rtl::OUString& i_sRowSetFilter) + const ::rtl::OUString& i_sRowSetFilter, + sal_Int32 i_nMaxRows) :m_xSet(_xRs) ,m_xMetaData(Reference< XResultSetMetaDataSupplier >(_xRs,UNO_QUERY)->getMetaData()) ,m_aContext( _rContext ) @@ -128,7 +129,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, xUp->cancelRowUpdates(); _xRs->beforeFirst(); m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; - m_pCacheSet = new WrappedResultSet(); + m_pCacheSet = new WrappedResultSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); return; @@ -175,7 +176,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, if ( aTableNames.getLength() > 1 && !_rUpdateTableName.getLength() && bNeedKeySet ) {// here we have a join or union and nobody told us which table to update, so we update them all m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; - OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache); + OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows); m_pCacheSet = pCursor; m_xCacheSet = m_pCacheSet; try @@ -237,7 +238,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, { try { - m_pCacheSet = new OBookmarkSet(); + m_pCacheSet = new OBookmarkSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); @@ -271,7 +272,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, // oj removed because keyset uses only the next// || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETTYPE) && comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) == ResultSetType::FORWARD_ONLY) if(!bAllKeysFound ) { - m_pCacheSet = new OStaticSet(); + m_pCacheSet = new OStaticSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); m_nPrivileges = Privilege::SELECT; @@ -308,7 +309,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, } } - OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache); + OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows); try { m_pCacheSet = pKeySet; @@ -335,7 +336,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, if ( m_pCacheSet ) m_pCacheSet = NULL; m_xCacheSet = NULL; - m_pCacheSet = new OStaticSet(); + m_pCacheSet = new OStaticSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); m_nPrivileges = Privilege::SELECT; @@ -373,9 +374,8 @@ ORowSetCache::~ORowSetCache() } // ------------------------------------------------------------------------- -void ORowSetCache::setMaxRowSize(sal_Int32 _nSize) +void ORowSetCache::setFetchSize(sal_Int32 _nSize) { - if(_nSize == m_nFetchSize) return; diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx index 76e1d7145752..bf9dc1500d56 100644 --- a/dbaccess/source/core/api/RowSetCache.hxx +++ b/dbaccess/source/core/api/RowSetCache.hxx @@ -202,7 +202,8 @@ namespace dbaccess sal_Bool& _bModified, sal_Bool& _bNew, const ORowSetValueVector& _aParameterValueForCache, - const ::rtl::OUString& i_sRowSetFilter); + const ::rtl::OUString& i_sRowSetFilter, + sal_Int32 i_nMaxRows); ~ORowSetCache(); @@ -211,7 +212,7 @@ namespace dbaccess ORowSetCacheIterator createIterator(ORowSetBase* _pRowSet); void deleteIterator(const ORowSetBase* _pRowSet); // sets the size of the matrix - void setMaxRowSize(sal_Int32 _nSize); + void setFetchSize(sal_Int32 _nSize); TORowSetOldRowHelperRef registerOldRow(); void deregisterOldRow(const TORowSetOldRowHelperRef& _rRow); diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 2f9a58c975b7..fa67a3d8cfdb 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -1088,7 +1088,7 @@ sal_Bool OSingleSelectQueryComposer::setANDCriteria( OSQLParseNode * pCondition, } else if (SQL_ISRULE(pCondition,test_for_null)) { - if (SQL_ISTOKEN(pCondition->getChild(1)->getChild(2),NOT) ) + if (SQL_ISTOKEN(pCondition->getChild(1)->getChild(1),NOT) ) aItem.Handle = SQLFilterOperator::NOT_SQLNULL; else aItem.Handle = SQLFilterOperator::SQLNULL; diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx index de768b6ceb8e..216ccf08eb5d 100644 --- a/dbaccess/source/core/api/StaticSet.cxx +++ b/dbaccess/source/core/api/StaticSet.cxx @@ -122,7 +122,7 @@ sal_Bool OStaticSet::fetchRow() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fetchRow" ); sal_Bool bRet = sal_False; - if ( !m_bEnd ) + if ( !m_bEnd && (!m_nMaxRows || sal_Int32(m_aSet.size()) < m_nMaxRows) ) bRet = m_xDriverSet->next(); if ( bRet ) { @@ -141,9 +141,10 @@ void OStaticSet::fillAllRows() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fillAllRows" ); if(!m_bEnd) { + sal_Int32 nColumnCount = m_xSetMetaData->getColumnCount(); while(m_xDriverSet->next()) { - ORowSetRow pRow = new connectivity::ORowVector< connectivity::ORowSetValue >(m_xSetMetaData->getColumnCount()); + ORowSetRow pRow = new connectivity::ORowVector< connectivity::ORowSetValue >(nColumnCount); m_aSet.push_back(pRow); m_aSetIter = m_aSet.end() - 1; (pRow->get())[0] = getRow(); diff --git a/dbaccess/source/core/api/StaticSet.hxx b/dbaccess/source/core/api/StaticSet.hxx index 676044cb61f9..19d0d3023402 100644 --- a/dbaccess/source/core/api/StaticSet.hxx +++ b/dbaccess/source/core/api/StaticSet.hxx @@ -44,8 +44,8 @@ namespace dbaccess sal_Bool fetchRow(); void fillAllRows(); public: - OStaticSet() - : m_aSetIter(m_aSet.end()) + OStaticSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows) + , m_aSetIter(m_aSet.end()) , m_bEnd(sal_False) { m_aSet.push_back(NULL); // this is the beforefirst record diff --git a/dbaccess/source/core/api/WrappedResultSet.hxx b/dbaccess/source/core/api/WrappedResultSet.hxx index 082811748e6a..34860e0da390 100644 --- a/dbaccess/source/core/api/WrappedResultSet.hxx +++ b/dbaccess/source/core/api/WrappedResultSet.hxx @@ -48,7 +48,7 @@ namespace dbaccess void updateColumn(sal_Int32 nPos,::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate > _xParameter,const connectivity::ORowSetValue& _rValue); public: - WrappedResultSet() + WrappedResultSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows) {} ~WrappedResultSet() { diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index f4cc3cf34714..75c56c65e0e3 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -228,7 +228,7 @@ void OQuery::rebuildColumns() ::vos::ORef< OSQLColumns > aParseColumns( ::connectivity::parse::OParseColumn::createColumnsForResultSet( xResultSetMeta, xDBMeta,xColumnDefinitions ) ); xColumns = OPrivateColumns::createWithIntrinsicNames( - aParseColumns, xDBMeta->storesMixedCaseQuotedIdentifiers(), *this, m_aMutex ); + aParseColumns, xDBMeta->supportsMixedCaseQuotedIdentifiers(), *this, m_aMutex ); if ( !xColumns.is() ) throw RuntimeException(); } diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src index dc7023ca6fba..dd1ca4c8a184 100644 --- a/dbaccess/source/core/resource/strings.src +++ b/dbaccess/source/core/resource/strings.src @@ -273,7 +273,7 @@ String RID_STR_ROW_ALREADY_DELETED }; String RID_STR_UPDATE_FAILED { - Text [ en-US ] = "Current row could be updated."; + Text [ en-US ] = "Current row could not be updated."; }; //------------------------------------------------------------------------- String RID_STR_NO_INSERT_PRIVILEGE diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index a2e82e50757d..1516c735f009 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -97,9 +97,12 @@ namespace dbaui ,m_pPrimaryKeySupport(NULL) ,m_pBooleanComparisonModeLabel( NULL ) ,m_pBooleanComparisonMode( NULL ) + ,m_pMaxRowScanLabel( NULL ) + ,m_pMaxRowScan( NULL ) ,m_aControlDependencies() ,m_aBooleanSettings() ,m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) ) + ,m_bHasMaxRowScan( _rDSMeta.getFeatureSet().has( DSID_MAX_ROW_SCAN ) ) { impl_initBooleanSettings(); @@ -164,6 +167,21 @@ namespace dbaui m_pBooleanComparisonModeLabel->SetPosPixel( Point( aLabelPos.X(), aLabelPos.Y() - nMoveUp ) ); m_pBooleanComparisonMode->SetPosPixel( Point( aControlPos.X(), aControlPos.Y() - nMoveUp ) ); } + // create the controls for the max row scan + if ( m_bHasMaxRowScan ) + { + m_pMaxRowScanLabel = new FixedText( this, ModuleRes( FT_MAXROWSCAN ) ); + m_pMaxRowScan = new NumericField( this, ModuleRes( NF_MAXROWSCAN ) ); + m_pMaxRowScan->SetModifyHdl(getControlModifiedLink()); + m_pMaxRowScan->SetUseThousandSep(sal_False); + + Point aLabelPos( m_pMaxRowScanLabel->GetPosPixel() ); + Point aControlPos( m_pMaxRowScan->GetPosPixel() ); + long nMoveUp = aControlPos.Y() - aPos.Y(); + + m_pMaxRowScanLabel->SetPosPixel( Point( aLabelPos.X(), aLabelPos.Y() - nMoveUp ) ); + m_pMaxRowScan->SetPosPixel( Point( aControlPos.X(), aControlPos.Y() - nMoveUp ) ); + } FreeResource(); } @@ -190,6 +208,8 @@ namespace dbaui DELETEZ( m_pPrimaryKeySupport ); DELETEZ( m_pBooleanComparisonModeLabel ); DELETEZ( m_pBooleanComparisonMode ); + DELETEZ( m_pMaxRowScanLabel ); + DELETEZ( m_pMaxRowScan ); } // ----------------------------------------------------------------------- @@ -230,6 +250,10 @@ namespace dbaui { _rControlList.push_back( new ODisableWrapper< FixedText >( m_pBooleanComparisonModeLabel ) ); } + if ( m_bHasMaxRowScan ) + { + _rControlList.push_back( new ODisableWrapper< FixedText >( m_pMaxRowScanLabel ) ); + } } // ----------------------------------------------------------------------- @@ -248,6 +272,8 @@ namespace dbaui if ( m_bHasBooleanComparisonMode ) _rControlList.push_back( new OSaveValueWrapper< ListBox >( m_pBooleanComparisonMode ) ); + if ( m_bHasMaxRowScan ) + _rControlList.push_back(new OSaveValueWrapper<NumericField>(m_pMaxRowScan)); } // ----------------------------------------------------------------------- @@ -306,6 +332,12 @@ namespace dbaui m_pBooleanComparisonMode->SelectEntryPos( static_cast< USHORT >( pBooleanComparison->GetValue() ) ); } + if ( m_bHasMaxRowScan ) + { + SFX_ITEMSET_GET(_rSet, pMaxRowScan, SfxInt32Item, DSID_MAX_ROW_SCAN, sal_True); + m_pMaxRowScan->SetValue(pMaxRowScan->GetValue()); + } + OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue); } @@ -334,6 +366,10 @@ namespace dbaui bChangedSomething = sal_True; } } + if ( m_bHasMaxRowScan ) + { + fillInt32(_rSet,m_pMaxRowScan,DSID_MAX_ROW_SCAN,bChangedSomething); + } return bChangedSomething; } diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc index 8abc5d8810d2..193fdf5f3853 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hrc +++ b/dbaccess/source/ui/dlg/advancedsettings.hrc @@ -69,7 +69,9 @@ #define FT_AUTOINCREMENTVALUE 1 #define FT_RETRIEVE_AUTO 2 #define FT_BOOLEANCOMPARISON 3 +#define FT_MAXROWSCAN 4 #define LB_BOOLEANCOMPARISON 1 +#define NF_MAXROWSCAN 1 #endif // DBAUI_ADVANCEDSETTINGS_HRC diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx index 7e58f260f4e6..07620496b11f 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hxx +++ b/dbaccess/source/ui/dlg/advancedsettings.hxx @@ -37,6 +37,7 @@ #include <svtools/dialogcontrolling.hxx> #include <vcl/lstbox.hxx> +#include <vcl/field.hxx> #include <vector> @@ -76,12 +77,16 @@ namespace dbaui FixedText* m_pBooleanComparisonModeLabel; ListBox* m_pBooleanComparisonMode; + FixedText* m_pMaxRowScanLabel; + NumericField* m_pMaxRowScan; + ::svt::ControlDependencyManager m_aControlDependencies; BooleanSettingDescs m_aBooleanSettings; bool m_bHasBooleanComparisonMode; + bool m_bHasMaxRowScan; public: virtual BOOL FillItemSet ( SfxItemSet& _rCoreAttrs ); diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src index f37c67148e18..6d144890b415 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.src +++ b/dbaccess/source/ui/dlg/advancedsettings.src @@ -249,6 +249,24 @@ WORKAROUND \ }; \ +#define AUTO_MAXROWSCAN(AUTO_Y) \ + FixedText FT_MAXROWSCAN \ + { \ + Pos = MAP_APPFONT ( START_X , AUTO_Y + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) ; \ + Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ); \ + Text [ en-US ] = "Rows to scan column types"; \ + }; \ + NumericField NF_MAXROWSCAN \ + { \ + Pos = MAP_APPFONT ( START_X + 100, AUTO_Y ) ; \ + Size = MAP_APPFONT ( 60 , EDIT_HEIGHT ) ; \ + TabStop = TRUE ; \ + NoThousandSep = TRUE; \ + Border = TRUE; \ + HelpId = HID_DSADMIN_MAXROWSCAN; \ + }; \ + + //------------------------------------------------------------------------- TabPage PAGE_GENERATED_VALUES @@ -334,6 +352,7 @@ TabPage PAGE_ADVANCED_SETTINGS_SPECIAL AUTO_ESCAPE_DATETIME( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_PRIMARY_KEY_SUPPORT( 15*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_BOOLEANCOMPARISON( 16*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) + AUTO_MAXROWSCAN( 17*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) }; //------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 1d5bb1cb167c..1c1b945854ed 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -410,6 +410,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True); *pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, String()); *pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT ); + *pCounter++ = new SfxInt32Item(DSID_MAX_ROW_SCAN, 100); // create the pool static SfxItemInfo __READONLY_DATA aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] = @@ -472,6 +473,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp {0,0}, {0,0}, {0,0}, + {0,0}, {0,0} }; diff --git a/dbaccess/source/ui/inc/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx index cb08be7812d5..6b87bee2a61a 100644 --- a/dbaccess/source/ui/inc/dsitems.hxx +++ b/dbaccess/source/ui/inc/dsitems.hxx @@ -92,6 +92,7 @@ typedef sal_Int32 ItemID; #define DSID_ESCAPE_DATETIME 57 #define DSID_NAMED_PIPE 58 #define DSID_PRIMARY_KEY_SUPPORT 59 +#define DSID_MAX_ROW_SCAN 60 // don't forget to adjust DSID_LAST_ITEM_ID below! @@ -99,7 +100,7 @@ typedef sal_Int32 ItemID; //= item range. Adjust this if you introduce new items above #define DSID_FIRST_ITEM_ID DSID_NAME -#define DSID_LAST_ITEM_ID DSID_PRIMARY_KEY_SUPPORT +#define DSID_LAST_ITEM_ID DSID_MAX_ROW_SCAN #endif // _DBAUI_DATASOURCEITEMS_HXX_ diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx index 551ba4fe40b7..87a93244cd3f 100644 --- a/dbaccess/source/ui/inc/dsmeta.hxx +++ b/dbaccess/source/ui/inc/dsmeta.hxx @@ -132,6 +132,7 @@ namespace dbaui || has( DSID_IGNORECURRENCY ) || has( DSID_ESCAPE_DATETIME ) || has( DSID_PRIMARY_KEY_SUPPORT ) + || has( DSID_MAX_ROW_SCAN ) ; } diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx index 08b5ea49f2bd..052d013f47a4 100644 --- a/dbaccess/source/ui/misc/dsmeta.cxx +++ b/dbaccess/source/ui/misc/dsmeta.cxx @@ -93,6 +93,7 @@ namespace dbaui { DSID_IGNORECURRENCY, "IgnoreCurrency" }, { DSID_ESCAPE_DATETIME, "EscapeDateTime" }, { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" }, + { DSID_MAX_ROW_SCAN, "MaxRowScan" }, { 0, NULL } }; return s_aMappings; diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index be1cf5288b21..d3620aea4901 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1178,8 +1178,15 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou aSourceColTypes.reserve( nCount + 1 ); aSourceColTypes.push_back( -1 ); // just to avoid a everytime i-1 call + ::std::vector< sal_Int32 > aSourcePrec; + aSourcePrec.reserve( nCount + 1 ); + aSourcePrec.push_back( -1 ); // just to avoid a everytime i-1 call + for ( sal_Int32 k=1; k <= nCount; ++k ) + { aSourceColTypes.push_back( xMeta->getColumnType( k ) ); + aSourcePrec.push_back( xMeta->getPrecision( k ) ); + } // now create, fill and execute the prepared statement Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatment( xDestMetaData, _rxDestTable, aColumnMapping ), UNO_SET_THROW ); @@ -1291,7 +1298,6 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou case DataType::LONGVARBINARY: case DataType::BINARY: case DataType::VARBINARY: - case DataType::BIT: aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes ); break; @@ -1307,6 +1313,13 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou aTransfer.transferComplexValue( &XRow::getTimestamp, &XParameters::setTimestamp ); break; + case DataType::BIT: + if ( aSourcePrec[nSourceColumn] > 1 ) + { + aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes ); + break; + } + // run through case DataType::BOOLEAN: aTransfer.transferValue( &XRow::getBoolean, &XParameters::setBoolean ); break; |