summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-12-02 13:43:47 +0100
committerKurt Zenker <kz@openoffice.org>2009-12-02 13:43:47 +0100
commitb47c8e3ccee895343090b7f5962e0fa84b1f09af (patch)
treea29005f4f8489f229bf335be04cc8381deeda0bc /dbaccess
parenta6b178909a2fe68c35c98b33aa0bd4c6a0e9f0e1 (diff)
parent5992a8c1aaf4848eac2983040805c0f665a8e6b4 (diff)
CWS-TOOLING: integrate CWS dba32i_DEV300
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.hxx7
-rw-r--r--dbaccess/source/core/misc/DatabaseDataProvider.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx51
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx26
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx1
5 files changed, 77 insertions, 11 deletions
diff --git a/dbaccess/source/core/dataaccess/databasecontext.hxx b/dbaccess/source/core/dataaccess/databasecontext.hxx
index 45e6bf5b87da..658ddacac181 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.hxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.hxx
@@ -209,9 +209,10 @@ public:
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
- void registerDatabaseDocument( ODatabaseModelImpl& _rModelImpl );
- void revokeDatabaseDocument( const ODatabaseModelImpl& _rModelImpl );
- void databaseDocumentURLChange( const ::rtl::OUString& _rOldURL, const ::rtl::OUString& _rNewURL );
+ void registerPrivate(const ::rtl::OUString& _sName
+ ,const ::rtl::Reference<ODatabaseModelImpl>& _pModelImpl);
+ void deregisterPrivate(const ::rtl::OUString& _sName);
+ void nameChangePrivate(const ::rtl::OUString& _sRegisteredName,const ::rtl::OUString& _sOldName, const ::rtl::OUString& _sNewName);
void storeTransientProperties( ODatabaseModelImpl& _rModelImpl);
void appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel);
void removeFromTerminateListener(const ODatabaseModelImpl& _rDataSourceModel);
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index cd16eb68a5ee..b6aff3db3240 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -584,7 +584,8 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat
{
xChartData->setData(uno::Sequence< uno::Sequence<double> >());
xChartData->setColumnDescriptions(uno::Sequence< ::rtl::OUString >());
- m_xInternal->deleteSequence(0);
+ if ( m_xInternal->hasDataByRangeRepresentation(::rtl::OUString::valueOf(sal_Int32(0))) )
+ m_xInternal->deleteSequence(0);
}
uno::Sequence< ::rtl::OUString > aColumns;
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index a155fa0922e8..6c94d9bc869c 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -1305,6 +1305,9 @@ namespace
// first extract the inner joins conditions
GetInnerJoinCriteria(_pView,pNodeTmp);
+ // now simplify again, join are checked in ComparisonPredicate
+ ::connectivity::OSQLParseNode::absorptions(pNodeTmp);
+ pNodeTmp = pNode->getChild(1);
// it could happen that pCondition is not more valid
eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pNodeTmp, rLevel);
@@ -1315,7 +1318,7 @@ namespace
SqlParseError GetANDCriteria( OQueryDesignView* _pView,
OSelectionBrowseBox* _pSelectionBrw,
const ::connectivity::OSQLParseNode * pCondition,
- const sal_uInt16 nLevel,
+ sal_uInt16& nLevel,
sal_Bool bHaving,
bool bAddOrOnOneLine);
//------------------------------------------------------------------------------
@@ -1352,7 +1355,11 @@ namespace
if ( SQL_ISRULE(pChild,search_condition) )
eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pChild,nLevel,bHaving,bAddOrOnOneLine);
else
- eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pChild, bAddOrOnOneLine ? nLevel : nLevel++,bHaving, i == 0 ? false : bAddOrOnOneLine);
+ {
+ eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pChild, nLevel,bHaving, i == 0 ? false : bAddOrOnOneLine);
+ if ( !bAddOrOnOneLine)
+ nLevel++;
+ }
}
}
else
@@ -1386,7 +1393,7 @@ namespace
SqlParseError GetANDCriteria( OQueryDesignView* _pView,
OSelectionBrowseBox* _pSelectionBrw,
const ::connectivity::OSQLParseNode * pCondition,
- const sal_uInt16 nLevel,
+ sal_uInt16& nLevel,
sal_Bool bHaving,
bool bAddOrOnOneLine)
{
@@ -1400,10 +1407,18 @@ namespace
// Runde Klammern
if (SQL_ISRULE(pCondition,boolean_primary))
{
- sal_uInt16 nLevel2 = nLevel;
// check if we have to put the or criteria on one line.
- bool bMustAddOrOnOneLine = CheckOrCriteria(pCondition->getChild(1),NULL);
- eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pCondition->getChild(1), nLevel2,bHaving,bMustAddOrOnOneLine );
+ const ::connectivity::OSQLParseNode* pSearchCondition = pCondition->getChild(1);
+ bool bMustAddOrOnOneLine = CheckOrCriteria(pSearchCondition,NULL);
+ if ( SQL_ISRULE( pSearchCondition, search_condition) ) // we have a or
+ {
+ _pSelectionBrw->DuplicateConditionLevel( nLevel);
+ eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pSearchCondition->getChild(0), nLevel,bHaving,bMustAddOrOnOneLine );
+ ++nLevel;
+ eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pSearchCondition->getChild(2), nLevel,bHaving,bMustAddOrOnOneLine );
+ }
+ else
+ eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pSearchCondition, nLevel,bHaving,bMustAddOrOnOneLine );
}
// Das erste Element ist (wieder) eine AND-Verknuepfung
else if ( SQL_ISRULE(pCondition,boolean_term) )
@@ -1499,10 +1514,32 @@ namespace
_pSelectionBrw->AddCondition(aDragLeft, sCondition, nLevel,bAddOrOnOneLine);
}
}
+ else
+ {
+ // Funktions-Bedingung parsen
+ ::rtl::OUString sCondition = ParseCondition(rController,pCondition,sDecimal,aLocale,1);
+ Reference< XConnection> xConnection = rController.getConnection();
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ // the international doesn't matter I have a string
+ ::rtl::OUString sName;
+ pCondition->getChild(0)->parseNodeToPredicateStr(sName,
+ xConnection,
+ rController.getNumberFormatter(),
+ aLocale,
+ static_cast<sal_Char>(sDecimal.toChar()),
+ &rController.getParser().getContext());
+
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
+ aDragLeft->SetField(sName);
+ aDragLeft->SetFunctionType(FKT_OTHER);
+
+ if ( bHaving )
+ aDragLeft->SetGroupBy(sal_True);
+ _pSelectionBrw->AddCondition(aDragLeft, sCondition, nLevel,bAddOrOnOneLine);
+ }
}
else if( SQL_ISRULEOR2(pCondition,existence_test,unique_test) )
{
-
// Funktions-Bedingung parsen
::rtl::OUString aCondition = ParseCondition(rController,pCondition,sDecimal,aLocale,0);
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 6b48bc528776..05c001751fef 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1836,6 +1836,32 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo , sal_uInt
}
}
//------------------------------------------------------------------------------
+void OSelectionBrowseBox::DuplicateConditionLevel( const sal_uInt16 nLevel)
+{
+ DBG_CHKTHIS(OSelectionBrowseBox,NULL);
+ const sal_uInt16 nNewLevel = nLevel +1;
+ OTableFields& rFields = getFields();
+ OTableFields::iterator aIter = rFields.begin();
+ OTableFields::iterator aEnd = rFields.end();
+ for(;aIter != aEnd;++aIter)
+ {
+ OTableFieldDescRef pEntry = *aIter;
+
+ ::rtl::OUString sValue = pEntry->GetCriteria(nLevel);
+ if ( sValue.getLength() )
+ {
+ pEntry->SetCriteria( nNewLevel, sValue);
+ if ( nNewLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1) )
+ {
+ RowInserted( GetRowCount()-1, 1, TRUE );
+ m_bVisibleRow.push_back(sal_True);
+ ++m_nVisibleCount;
+ }
+ m_bVisibleRow[BROW_CRIT1_ROW + nNewLevel] = sal_True;
+ } // if (!pEntry->GetCriteria(nLevel).getLength() )
+ } // for(;aIter != getFields().end();++aIter)
+}
+//------------------------------------------------------------------------------
void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const String& rValue, const sal_uInt16 nLevel,bool _bAddOrOnOneLine )
{
Reference< XConnection> xConnection = static_cast<OQueryController&>(getDesignView()->getController()).getConnection();
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
index 1d4a188dab9d..c92ce7caf7f0 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
@@ -132,6 +132,7 @@ namespace dbaui
const String& rValue,
const sal_uInt16 nLevel,
bool _bAddOrOnOneLine );
+ void DuplicateConditionLevel( const sal_uInt16 nLevel);
void AddOrder(const OTableFieldDescRef& rInfo, const EOrderDir eDir, sal_uInt32 _nCurrentPos);
void ClearAll();
OTableFieldDescRef AppendNewCol( sal_uInt16 nCnt=1 );