summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-09-27 05:19:05 +0000
committerOcke Janssen <oj@openoffice.org>2001-09-27 05:19:05 +0000
commit7548d773fdf47d1b35e94233f7f959328228c8c7 (patch)
treead0a995c7c346a469abf8e1ad3e43b3cc239b769 /dbaccess
parent139a81d38af7ea45640fcdf1a8e70a43fdc52cfe (diff)
#92325# impl new sql functions
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/inc/QueryDesignView.hxx14
-rw-r--r--dbaccess/source/ui/inc/QueryTextView.hxx6
-rw-r--r--dbaccess/source/ui/inc/querycontainerwindow.hxx8
-rw-r--r--dbaccess/source/ui/inc/querycontroller.hxx6
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx201
-rw-r--r--dbaccess/source/ui/querydesign/QueryTextView.cxx10
-rw-r--r--dbaccess/source/ui/querydesign/QueryViewSwitch.cxx11
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx388
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx6
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx52
10 files changed, 413 insertions, 289 deletions
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx
index 8004bfbd0517..18d15f21ade3 100644
--- a/dbaccess/source/ui/inc/QueryDesignView.hxx
+++ b/dbaccess/source/ui/inc/QueryDesignView.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryDesignView.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: fs $ $Date: 2001-08-23 14:23:57 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,6 +79,9 @@
#ifndef DBAUI_ENUMTYPES_HXX
#include "QEnumTypes.hxx"
#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
namespace connectivity
{
@@ -186,6 +189,8 @@ namespace dbaui
virtual void clear();
// set the view readonly or not
virtual void setReadOnly(sal_Bool _bReadOnly);
+ // check if the statement is correct when not returning false
+ virtual sal_Bool checkStatement();
// set the statement for representation
virtual void setStatement(const ::rtl::OUString& _rsStatement);
// returns the current sql statement
@@ -219,6 +224,11 @@ namespace dbaui
void SaveUIConfig();
void stopTimer();
void startTimer();
+
+ ::connectivity::OSQLParseNode* getPredicateTreeFromEntry( OTableFieldDesc* pEntry,
+ const String& _sCriteria,
+ ::rtl::OUString& _rsErrorMessage,
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn);
protected:
// return the Rectangle where I can paint myself
virtual void resizeDocumentView(Rectangle& rRect);
diff --git a/dbaccess/source/ui/inc/QueryTextView.hxx b/dbaccess/source/ui/inc/QueryTextView.hxx
index a12f230d846d..e3f321afa5bb 100644
--- a/dbaccess/source/ui/inc/QueryTextView.hxx
+++ b/dbaccess/source/ui/inc/QueryTextView.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryTextView.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: fs $ $Date: 2001-08-23 14:23:57 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -92,6 +92,8 @@ namespace dbaui
virtual void clear();
// set the view readonly or not
virtual void setReadOnly(sal_Bool _bReadOnly);
+ // check if the statement is correct when not returning false
+ virtual sal_Bool checkStatement();
// set the statement for representation
virtual void setStatement(const ::rtl::OUString& _rsStatement);
virtual ::rtl::OUString getStatement();
diff --git a/dbaccess/source/ui/inc/querycontainerwindow.hxx b/dbaccess/source/ui/inc/querycontainerwindow.hxx
index d3dbeb4ed7e1..8316b34d2f43 100644
--- a/dbaccess/source/ui/inc/querycontainerwindow.hxx
+++ b/dbaccess/source/ui/inc/querycontainerwindow.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: querycontainerwindow.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: fs $ $Date: 2001-08-23 14:25:36 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -142,6 +142,7 @@ namespace dbaui
void setReadOnly( sal_Bool _bReadOnly ) { m_pViewSwitch->setReadOnly( _bReadOnly ); }
+ sal_Bool checkStatement() { return m_pViewSwitch->checkStatement( ); }
::rtl::OUString getStatement() { return m_pViewSwitch->getStatement( ); }
void setStatement( const ::rtl::OUString& _rsStatement ) { m_pViewSwitch->setStatement( _rsStatement ); }
@@ -169,6 +170,9 @@ namespace dbaui
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.1 2001/08/23 14:25:36 fs
+ * initial checkin - outsourced from QueryTextView.hxx (the container window for the query design)
+ *
*
* Revision 1.0 23.08.01 12:08:57 fs
************************************************************************/
diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx
index 77ccffab04ff..c98359cc5694 100644
--- a/dbaccess/source/ui/inc/querycontroller.hxx
+++ b/dbaccess/source/ui/inc/querycontroller.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: querycontroller.hxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: fs $ $Date: 2001-08-23 14:23:57 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -224,7 +224,7 @@ namespace dbaui
protected:
virtual OTableWindowData* createTableWindowData();
- virtual OJoinDesignView* getJoinView();
+ virtual OJoinDesignView* getJoinView();
};
}
#endif // DBAUI_QUERYCONTROLLER_HXX
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index a72d6da980f5..fd87c4ef35b4 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryDesignView.cxx,v $
*
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
*
- * last change: $Author: hr $ $Date: 2001-09-13 09:14:06 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -121,6 +121,12 @@
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _CONNECTIVITY_PCOLUMN_HXX_
+#include <connectivity/PColumn.hxx>
+#endif
#ifndef DBAUI_QUERYTABLECONNECTION_HXX
#include "QTableConnection.hxx"
#endif
@@ -145,6 +151,9 @@
#ifndef DBAUI_QUERYCONTAINERWINDOW_HXX
#include "querycontainerwindow.hxx"
#endif
+#ifndef _ISOLANG_HXX
+#include <tools/isolang.hxx>
+#endif
using namespace ::dbaui;
using namespace ::utl;
@@ -163,8 +172,12 @@ OQueryDesignView::OQueryDesignView(OQueryContainerWindow* _pParent, OQueryContro
{
try
{
- Any aValue = ConfigManager::GetDirectConfigProperty(ConfigManager::LOCALE);
- m_aLocale.Language = ::comphelper::getString(aValue);
+// Any aValue = ConfigManager::GetDirectConfigProperty(ConfigManager::LOCALE);
+// m_aLocale.Language = ::comphelper::getString(aValue);
+ String sLanguage, sCountry;
+ ConvertLanguageToIsoNames(Window::GetSettings().GetLanguage(), sLanguage, sCountry);
+ m_aLocale = Locale(sLanguage, sCountry, ::rtl::OUString());
+
Reference< XLocaleData> xLocaleData = Reference<XLocaleData>(_rFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.i18n.LocaleData")),UNO_QUERY);
LocaleDataItem aData = xLocaleData->getLocaleItem(m_aLocale);
m_sDecimalSep = aData.decimalSeparator;
@@ -679,7 +692,10 @@ extern ::rtl::OUString ConvertAlias(const ::rtl::OUString& rName);
aTmpStr = aTmpStr2;
}
- if(rFieldAlias.getLength() && rFieldName.toChar() != '*' )
+ if( rFieldAlias.getLength() &&
+ (rFieldName.toChar() != '*' ||
+ pEntryField->GetFunctionType() == FKT_AGGREGATE ||
+ pEntryField->GetFunctionType() == FKT_OTHER))
{
aTmpStr += ::rtl::OUString::createFromAscii(" AS ");
aTmpStr += ::dbtools::quoteName(aQuote, rFieldAlias);
@@ -869,11 +885,15 @@ void OQueryDesignView::GetNextJoin(OQueryTableConnection* pEntryConn,::rtl::OUSt
aTableListStr = aTableListStr.replaceAt(aTableListStr.getLength()-1,1, ::rtl::OUString() );
return aTableListStr;
}
+// -----------------------------------------------------------------------------
+// check if the statement is correct when not returning false
+sal_Bool OQueryDesignView::checkStatement()
+{
+ return m_pSelectionBox->Save(); // a error occured so we return no
+}
//------------------------------------------------------------------------------
::rtl::OUString OQueryDesignView::getStatement()
{
- m_pSelectionBox->Save(); // Aktuelle eingabe uebernehmen
-
// ----------------- Feldliste aufbauen ----------------------
// erst die Felder zaehlen
sal_uInt32 nFieldcount = 0;
@@ -1026,9 +1046,9 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS
aCriteria = pEntryField->GetCriteria( i );
if (aCriteria.getLength())
{
- if (aFieldName.toChar() == '*') // * darf keine Filter besitzen
+ if (aFieldName.toChar() == '*' && pEntryField->GetFunctionType() == FKT_NONE) // * darf keine Filter besitzen
{
- // die entsprechende MessageBox nur beim ersten mal anzeigen
+ // only show the messagebox the first time
if (!bCritsOnAsterikWarning)
ErrorBox((OQueryDesignView*)this, ModuleRes( ERR_QRY_CRITERIA_ON_ASTERISK)).Execute();
bCritsOnAsterikWarning = sal_True;
@@ -1036,12 +1056,20 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS
}
aWork = ::rtl::OUString();
+
if (bMulti)
{
- aWork += ::dbtools::quoteName(aQuote, ConvertAlias(pEntryField->GetAlias()));
+ if(pEntryField->GetFunctionType() == FKT_OTHER || (aFieldName.toChar() == '*'))
+ aWork += aFieldName;
+ else
+ aWork += ::dbtools::quoteName(aQuote, ConvertAlias(pEntryField->GetAlias()));
aWork += ::rtl::OUString('.');
}
- aWork += ::dbtools::quoteName(aQuote, aFieldName).getStr();
+ if(pEntryField->GetFunctionType() == FKT_OTHER || (aFieldName.toChar() == '*'))
+ aWork += aFieldName;
+ else
+ aWork += ::dbtools::quoteName(aQuote, aFieldName).getStr();
+
if(pEntryField->GetFunctionType() == FKT_AGGREGATE || pEntryField->IsGroupBy())
{
if (!aHavingStr.getLength()) // noch keine Kriterien
@@ -1071,20 +1099,11 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS
aWhereStr += ::rtl::OUString(' ');
// aCriteria could have some german numbers so I have to be sure here
::rtl::OUString aTmp = ::rtl::OUString::createFromAscii(" = ");
- aTmp += aCriteria;
- OQueryTableWindow* pWin = static_cast<OQueryTableWindow*>(pEntryField->GetTabWindow());
+ aTmp = aCriteria;
- Reference<XPropertySet> xColumn;
- if (pWin)
- {
- Reference<XNameAccess> xColumns = pWin->GetOriginalColumns();
- if(xColumns.is() && xColumns->hasByName(aFieldName))
- xColumns->getByName(aFieldName) >>= xColumn;
- }
::rtl::OUString aErrorMsg;
- ::connectivity::OSQLParser* pParser = static_cast<OQueryController*>(getController())->getParser();
- ::connectivity::OSQLParseNode* pParseNode = pParser->predicateTree(aErrorMsg, aTmp, static_cast<OQueryController*>(getController())->getNumberFormatter(), xColumn);
-
+ Reference<XPropertySet> xColumn;
+ ::connectivity::OSQLParseNode* pParseNode = getPredicateTreeFromEntry(pEntryField,aTmp,aErrorMsg,xColumn);
if (pParseNode)
{
if (bMulti)
@@ -1092,8 +1111,9 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS
::rtl::OUString aWhere = aWhereStr;
pParseNode->parseNodeToStr( aWhere,
xMetaData,
- &(static_cast<OQueryController*>(getController())->getParser()->getContext())
- ,sal_False,sal_True);
+ &(static_cast<OQueryController*>(getController())->getParser()->getContext()),
+ sal_False,
+ pEntryField->GetFunctionType() != FKT_OTHER);
aWhereStr = aWhere;
delete pParseNode;
}
@@ -1677,6 +1697,8 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
aCondition;
OTableFieldDesc aDragLeft;
+ OSQLParseNode* pFunction = pCondition->getChild(0);
+
::rtl::OUString aColumnName;
Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
if(xConnection.is())
@@ -1687,40 +1709,47 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
static_cast<OQueryController*>(getController())->getNumberFormatter(),
m_aLocale,
m_sDecimalSep.toChar());
- pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName,
+ pFunction->parseNodeToPredicateStr(aColumnName,
xMetaData,
static_cast<OQueryController*>(getController())->getNumberFormatter(),
m_aLocale,
m_sDecimalSep.toChar());
- }
+ // don't display the column name
+ aCondition = aCondition.copy(aColumnName.getLength());
+ aCondition = aCondition.trim();
+ if(aCondition.indexOf('=',0) == 1) // ignore the equal sign
+ aCondition = aCondition.copy(1);
- // don't display the column name
- aCondition = aCondition.copy(aColumnName.getLength());
- aCondition = aCondition.trim();
- if(SQL_ISRULE(pCondition->getChild(0), general_set_fct ))
- {
- String aPara(aColumnName);
- if(!FillDragInfo(pCondition->getChild(0)->getChild(3),aDragLeft))
+ if(SQL_ISRULE(pFunction, general_set_fct ))
{
- aPara = aPara.GetToken(1,'(');
- aDragLeft.SetField(aPara.GetToken(aPara.GetTokenCount()-1,')'));
+ if(!FillDragInfo(pFunction->getChild(pFunction->count()-2),aDragLeft))
+ {
+ OSL_ENSURE(pFunction->count() > 3,"Invalid format for general_set_fct!");
+ ::rtl::OUString sParameterValue;
+ pFunction->getChild(pFunction->count()-2)->parseNodeToPredicateStr(sParameterValue,
+ xMetaData,
+ static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ m_aLocale,
+ m_sDecimalSep.toChar());
+ aDragLeft.SetField(sParameterValue);
+ }
+ aDragLeft.SetFunctionType(FKT_AGGREGATE);
+ if(bHaving)
+ aDragLeft.SetGroupBy(sal_True);
+ sal_Int32 nIndex = 0;
+ aDragLeft.SetFunction(aColumnName.getToken(0,'(',nIndex));
}
- aDragLeft.SetFunctionType(FKT_AGGREGATE);
- if(bHaving)
- aDragLeft.SetGroupBy(sal_True);
- aPara = aPara.GetToken(0,'(');
- aDragLeft.SetFunction(aPara);
- }
- else
- {
- // bei unbekannten Funktionen wird der gesamte Text in das Field gechrieben
- aDragLeft.SetField(aColumnName);
- if(bHaving)
- aDragLeft.SetGroupBy(sal_True);
- aDragLeft.SetFunctionType(FKT_OTHER);
+ else
+ {
+ // bei unbekannten Funktionen wird der gesamte Text in das Field gechrieben
+ aDragLeft.SetField(aColumnName);
+ if(bHaving)
+ aDragLeft.SetGroupBy(sal_True);
+ aDragLeft.SetFunctionType(FKT_OTHER);
+ }
+ m_pSelectionBox->AddCondition(aDragLeft, aCondition, nLevel);
}
- m_pSelectionBox->AddCondition(aDragLeft, aCondition, nLevel);
}
else // kann sich nur um einen Expr. Ausdruck handeln
{
@@ -2128,7 +2157,7 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode,
xMetaData,
&static_cast<OQueryController*>(getController())->getParser()->getContext(),
sal_True,
- sal_False);
+ sal_True); // quote is to true because we need quoted elements inside the function
::connectivity::OSQLParseNode * pParamRef = pColumnRef->getChild(pColumnRef->count()-2);
if (SQL_ISRULE(pColumnRef,general_set_fct)
@@ -2151,17 +2180,22 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode,
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
if (pTabWin->ExistsField( ::rtl::OUString::createFromAscii("*"), aInfo ))
+ {
+ aInfo.SetAlias(String());
+ aInfo.SetTable(String());
break;
+ }
}
}
else
{
aInfo.SetDataType(DataType::DOUBLE);
aInfo.SetFieldType(TAB_NORMAL_FIELD);
- aInfo.SetTabWindow(NULL);
aInfo.SetField(aColumns);
- aInfo.SetFieldAlias(aColumnAlias);
+
}
+ aInfo.SetTabWindow(NULL);
+ aInfo.SetFieldAlias(aColumnAlias);
}
if(SQL_ISRULE(pColumnRef,general_set_fct))
@@ -2463,8 +2497,69 @@ void OQueryDesignView::SaveUIConfig()
}
}
// -----------------------------------------------------------------------------
+OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(OTableFieldDesc* pEntry,
+ const String& _sCriteria,
+ ::rtl::OUString& _rsErrorMessage,
+ Reference<XPropertySet>& _rxColumn)
+{
+ OSL_ENSURE(pEntry,"Entry is null!");
+ if(!pEntry)
+ return NULL;
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(!xConnection.is())
+ return NULL;
+ ::connectivity::OSQLParser* pParser = static_cast<OQueryController*>(getController())->getParser();
+ OQueryTableWindow* pWin = static_cast<OQueryTableWindow*>(pEntry->GetTabWindow());
+ String sTest(_sCriteria);
+ // special handling for functions
+ if(pEntry->GetFunctionType() == FKT_OTHER || pEntry->GetFunctionType() == FKT_AGGREGATE)
+ {
+ // we have a function here so we have to distinguish the type of return value
+ String sFunction;
+ if(pEntry->GetFunctionType() == FKT_AGGREGATE)
+ sFunction = pEntry->GetFunction();
+ else
+ sFunction = pEntry->GetField();
+
+ if(sFunction.GetTokenCount('(') > 1)
+ sFunction = sFunction.GetToken(0,'('); // this should be the name of the function
+ OSL_ENSURE(sFunction.Len(),"Function name is empty!");
+
+ sal_Int32 nType = ::connectivity::OSQLParser::getFunctionReturnType(sFunction,&pParser->getContext());
+
+ parse::OParseColumn* pColumn = new parse::OParseColumn( pEntry->GetField(),
+ ::rtl::OUString(),
+ ::rtl::OUString(),
+ ColumnValue::NULLABLE_UNKNOWN,
+ 0,
+ 0,
+ nType,
+ sal_False,
+ sal_False,
+ xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
+ _rxColumn = pColumn;
+ pColumn->setFunction(sal_True);
+ pColumn->setRealName(pEntry->GetField());
+ }
+ else
+ {
+ if (pWin)
+ {
+ Reference<XNameAccess> xColumns = pWin->GetOriginalColumns();
+ if (xColumns.is() && xColumns->hasByName(pEntry->GetField()))
+ xColumns->getByName(pEntry->GetField()) >>= _rxColumn;
+ }
+ }
+
+ OSQLParseNode* pParseNode = pParser->predicateTree( _rsErrorMessage,
+ sTest,
+ static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ _rxColumn);
+ return pParseNode;
+}
+// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx
index 92f565d8d7d7..406d834ecd22 100644
--- a/dbaccess/source/ui/querydesign/QueryTextView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryTextView.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: oj $ $Date: 2001-09-20 12:56:16 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -147,6 +147,12 @@ void OQueryTextView::Resize()
m_pEdit->SetSizePixel( GetOutputSizePixel() );
}
// -----------------------------------------------------------------------------
+// check if the statement is correct when not returning false
+sal_Bool OQueryTextView::checkStatement()
+{
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
::rtl::OUString OQueryTextView::getStatement()
{
return m_pEdit->GetText();
diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
index 012e2d5aa14e..2c617544c77e 100644
--- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
+++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryViewSwitch.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: fs $ $Date: 2001-08-23 14:39:09 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -142,6 +142,13 @@ void OQueryViewSwitch::resizeDocumentView(Rectangle& _rPlayground)
_rPlayground.SetSize( Size( 0, 0 ) );
}
// -----------------------------------------------------------------------------
+sal_Bool OQueryViewSwitch::checkStatement()
+{
+ if(m_pTextView->IsVisible())
+ return m_pTextView->checkStatement();
+ return m_pDesignView->checkStatement();
+}
+// -----------------------------------------------------------------------------
::rtl::OUString OQueryViewSwitch::getStatement()
{
if(m_pTextView->IsVisible())
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index e002453bcbcc..4ba5b0ac7172 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: SelectionBrowseBox.cxx,v $
*
- * $Revision: 1.31 $
+ * $Revision: 1.32 $
*
- * last change: $Author: oj $ $Date: 2001-08-30 13:35:55 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,7 +91,9 @@
#ifndef _DBU_RESOURCE_HRC_
#include "dbu_resource.hrc"
#endif
+#ifndef _DBA_DBACCESS_HELPID_HRC_
#include "dbaccess_helpid.hrc"
+#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
@@ -628,144 +630,73 @@ sal_Bool OSelectionBrowseBox::SaveModified()
case BROW_FIELD_ROW:
{
String aFieldName(m_pFieldCell->GetText());
-
- sal_Bool bIsPredicate = sal_False;
- // wenn das Ergebnis ein Praedikat -> OK
- String aTest(aFieldName);
-
- OQueryTableWindow* pWin = static_cast<OQueryTableWindow*>(pEntry->GetTabWindow());
-
- if (!pWin && (aFieldName.GetTokenCount('.') == 2))
- pWin = static_cast<OQueryTableWindow*>(getDesignView()->getTableView()->GetWindow(aFieldName.GetToken(0, '.')));
-
- Reference<XPropertySet> xColumn;
- sal_Bool bAsterix = sal_False;
- if (pWin)
+ if (!aFieldName.Len())
{
- Reference<XNameAccess> xColumns = pWin->GetOriginalColumns();
- if(xColumns.is())
- {
- if (aFieldName.GetTokenCount('.') == 2 && xColumns->hasByName(aFieldName.GetToken(1,'.'))) // falls alias.Feld angegeben
- ::cppu::extractInterface(xColumn,xColumns->getByName(aFieldName.GetToken(1,'.')));
- else if(xColumns->hasByName(aFieldName))
- ::cppu::extractInterface(xColumn,xColumns->getByName(aFieldName));
- else if(aFieldName.GetTokenCount('.') == 2 && aFieldName.GetToken(1,'.').GetChar(0) == '*')
- bAsterix = sal_True;
- }
+ ::std::replace(getFields()->begin(),getFields()->end(),pEntry,new OTableFieldDesc);
+ sal_uInt16 nCol = GetCurColumnId();
+ for (int i = 0; i < m_nVisibleCount; i++) // Spalte neu zeichnen
+ RowModified(i,nCol);
}
-
- if(!xColumn.is() && !bAsterix) // only when text not a column of the table
+ else
{
- ::rtl::OUString aErrorMsg;
- bIsPredicate = sal_True; // #72670#
- OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
-
- ::connectivity::OSQLParser* pParser = pController->getParser();
- OSQLParseNode* pParseNode = pParser->predicateTree(aErrorMsg, aTest,
- pController->getNumberFormatter(),
- xColumn);
- if (pParseNode)
- {
+ sal_Bool bIsPredicate = sal_False;
+ // wenn das Ergebnis ein Praedikat -> OK
+ String aTest(aFieldName);
- bListAction = sal_True;
- static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
- appendUndoAction(pEntry->IsVisible() ? g_strOne : g_strZero,g_strZero,BROW_VIS_ROW);
+ OQueryTableWindow* pWin = static_cast<OQueryTableWindow*>(pEntry->GetTabWindow());
- pEntry->SetVisible(sal_False);
- bWasEmpty = sal_False; // XXXXX
- delete pParseNode;
- pEntry->SetFunctionType(FKT_CONDITION);
- RowModified(GetBrowseRow(BROW_VIS_ROW), GetCurColumnId());
- }
- else
- pEntry->SetFunctionType(FKT_OTHER);
- }
+ if (!pWin && (aFieldName.GetTokenCount('.') == 2))
+ pWin = static_cast<OQueryTableWindow*>(getDesignView()->getTableView()->GetWindow(aFieldName.GetToken(0, '.')));
- xub_StrLen nCount(aFieldName.GetTokenCount('('));
- if(nCount < 2 && !bIsPredicate) // keine Funktion
- {
- if (aFieldName.GetTokenCount('.') == 2) // falls alias.Feld angegeben
+ Reference<XPropertySet> xColumn;
+ sal_Bool bAsterix = sal_False;
+ if (pWin)
{
- String sTableAlias(aFieldName.GetToken(0, '.'));
- aFieldName = aFieldName.GetToken(1,'.');
-
- // das erste Token in das Tabellenfeld eintragen (und entsprechend den Entry anpassen)
- if(!bListAction)
- {
- bListAction = sal_True;
- static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
- }
- appendUndoAction(pEntry->GetAlias(),sTableAlias,BROW_TABLE_ROW);
-
- pEntry->SetAlias(sTableAlias);
- if(m_bVisibleRow[BROW_TABLE_ROW])
- RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId());
-
- OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
- if (pTabWinList)
+ Reference<XNameAccess> xColumns = pWin->GetOriginalColumns();
+ if(xColumns.is())
{
- OJoinTableView::OTableWindowMapIterator aIter = pTabWinList->find(sTableAlias);
- if(aIter != pTabWinList->end())
- {
- OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second);
- if (pEntryTab)
- {
- // appendUndoAction(pEntry->GetDatabase(),sTableAlias,GetBrowseRow(BROW_TABLE_ROW));
- pEntry->SetDatabase(pEntryTab->GetComposedName());
- pEntry->SetTable(pEntryTab->GetTableName());
- pEntry->SetTabWindow(pEntryTab);
- }
- }
+ if (aFieldName.GetTokenCount('.') == 2 && xColumns->hasByName(aFieldName.GetToken(1,'.'))) // falls alias.Feld angegeben
+ ::cppu::extractInterface(xColumn,xColumns->getByName(aFieldName.GetToken(1,'.')));
+ else if(xColumns->hasByName(aFieldName))
+ ::cppu::extractInterface(xColumn,xColumns->getByName(aFieldName));
+ else if(aFieldName.GetTokenCount('.') == 2 && aFieldName.GetToken(1,'.').GetChar(0) == '*')
+ bAsterix = sal_True;
}
}
- strOldCellContents = pEntry->GetField();
- pEntry->SetField(aFieldName);
- sNewValue = aFieldName;
-
- // Falls nur COUNT(*) erlaubt wird
- Reference< XConnection> xConnection = static_cast<OQueryController*>(getDesignView()->getController())->getConnection();
- if(!xConnection.is())
- break;
- Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
- if(aFieldName.GetChar(0) != '*' && pEntry->GetFunction().getLength())
+ if(!xColumn.is() && !bAsterix) // only when text not a column of the table
{
- if(!bListAction)
+ ::rtl::OUString aErrorMsg;
+ bIsPredicate = sal_True; // #72670#
+ OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
+
+ ::connectivity::OSQLParser* pParser = pController->getParser();
+ OSQLParseNode* pParseNode = pParser->predicateTree(aErrorMsg, aTest,
+ pController->getNumberFormatter(),
+ xColumn);
+ if (pParseNode)
{
bListAction = sal_True;
static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
+ appendUndoAction(pEntry->IsVisible() ? g_strOne : g_strZero,g_strZero,BROW_VIS_ROW);
+
+ pEntry->SetVisible(sal_False);
+ bWasEmpty = sal_False; // XXXXX
+ delete pParseNode;
+ pEntry->SetFunctionType(FKT_CONDITION);
+ RowModified(GetBrowseRow(BROW_VIS_ROW), GetCurColumnId());
}
- appendUndoAction(pEntry->GetFunction(),String(),BROW_FUNCTION_ROW);
- pEntry->SetFunction(::rtl::OUString());
- m_pFunctionCell->SelectEntryPos(0);
- if(!m_bVisibleRow[BROW_FUNCTION_ROW])
- {
- SetRowVisible(BROW_FUNCTION_ROW, sal_True);
- }
- RowModified(GetBrowseRow(BROW_FUNCTION_ROW), GetCurColumnId());
+ else
+ pEntry->SetFunctionType(FKT_OTHER);
}
- pEntry->SetFunctionType(FKT_NONE);
- }
- else
- { // Funktion eingegeben
- // m_pFieldCell auf Inhalt der Funktion setzen und pEntry mit ganzem Wert setzen
- // BROW_FUNCTION_ROW setzen
- strOldCellContents = pEntry->GetField();
-
- String aFkt(aFieldName.GetToken(0,'('));
- if(pEntry->GetFunctionType() != FKT_CONDITION && GetFunktionName(aFkt))
+ xub_StrLen nCount(aFieldName.GetTokenCount('('));
+ if(nCount < 2 && !bIsPredicate) // keine Funktion
{
- // ist Aggregatefuntkion
- pEntry->SetFunction(aFkt);
- String aParameter(aFieldName.GetToken(1,'('));
- aParameter = aParameter.GetToken(aParameter.GetTokenCount()-1,')');
- pEntry->SetField(aParameter); // nur die Parameter einf"ugen
- pEntry->SetFunctionType(FKT_AGGREGATE);
- if (aParameter.GetTokenCount('.') == 2) // falls alias.Feld angegeben
+ if (aFieldName.GetTokenCount('.') == 2) // falls alias.Feld angegeben
{
- String sTableAlias(aParameter.GetToken(0, '.'));
- aParameter = aParameter.GetToken(1,'.');
+ String sTableAlias(aFieldName.GetToken(0, '.'));
+ aFieldName = aFieldName.GetToken(1,'.');
// das erste Token in das Tabellenfeld eintragen (und entsprechend den Entry anpassen)
if(!bListAction)
@@ -774,6 +705,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
}
appendUndoAction(pEntry->GetAlias(),sTableAlias,BROW_TABLE_ROW);
+
pEntry->SetAlias(sTableAlias);
if(m_bVisibleRow[BROW_TABLE_ROW])
RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId());
@@ -785,78 +717,148 @@ sal_Bool OSelectionBrowseBox::SaveModified()
if(aIter != pTabWinList->end())
{
OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second);
- pEntry->SetDatabase(pEntryTab->GetComposedName());
- pEntry->SetTable(pEntryTab->GetTableName());
- pEntry->SetTabWindow(pEntryTab);
+ if (pEntryTab)
+ {
+ // appendUndoAction(pEntry->GetDatabase(),sTableAlias,GetBrowseRow(BROW_TABLE_ROW));
+ pEntry->SetDatabase(pEntryTab->GetComposedName());
+ pEntry->SetTable(pEntryTab->GetTableName());
+ pEntry->SetTabWindow(pEntryTab);
+ }
}
}
}
- else
+ strOldCellContents = pEntry->GetField();
+ pEntry->SetField(aFieldName);
+ sNewValue = aFieldName;
+
+ // Falls nur COUNT(*) erlaubt wird
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getDesignView()->getController())->getConnection();
+ if(!xConnection.is())
+ break;
+
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ if(aFieldName.GetChar(0) != '*' && pEntry->GetFunction().getLength())
{
- // nur eine Tabelle vorhanden oder der Benutzer hat vergessen diese anzugeben
- // also einfach die erst beste nehmen
- OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
- if(pTabWinList)
+ if(!bListAction)
+ {
+ bListAction = sal_True;
+ static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
+ }
+ appendUndoAction(pEntry->GetFunction(),String(),BROW_FUNCTION_ROW);
+ pEntry->SetFunction(::rtl::OUString());
+ m_pFunctionCell->SelectEntryPos(0);
+ if(!m_bVisibleRow[BROW_FUNCTION_ROW])
{
- OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(pTabWinList->begin()->second);
- if (pEntryTab)
+ SetRowVisible(BROW_FUNCTION_ROW, sal_True);
+ }
+ RowModified(GetBrowseRow(BROW_FUNCTION_ROW), GetCurColumnId());
+ }
+ pEntry->SetFunctionType(FKT_NONE);
+ }
+ else
+ { // Funktion eingegeben
+ // m_pFieldCell auf Inhalt der Funktion setzen und pEntry mit ganzem Wert setzen
+ // BROW_FUNCTION_ROW setzen
+ strOldCellContents = pEntry->GetField();
+
+ String aFkt(aFieldName.GetToken(0,'('));
+
+ if(pEntry->GetFunctionType() != FKT_CONDITION && GetFunktionName(aFkt))
+ {
+ // ist Aggregatefuntkion
+ pEntry->SetFunction(aFkt);
+ String aParameter(aFieldName.GetToken(1,'('));
+ aParameter = aParameter.GetToken(aParameter.GetTokenCount()-1,')');
+ pEntry->SetField(aParameter); // nur die Parameter einf"ugen
+ pEntry->SetFunctionType(FKT_AGGREGATE);
+ if (aParameter.GetTokenCount('.') == 2) // falls alias.Feld angegeben
+ {
+ String sTableAlias(aParameter.GetToken(0, '.'));
+ aParameter = aParameter.GetToken(1,'.');
+
+ // das erste Token in das Tabellenfeld eintragen (und entsprechend den Entry anpassen)
+ if(!bListAction)
{
- pEntry->SetDatabase(pEntryTab->GetComposedName());
- if(!bListAction)
+ bListAction = sal_True;
+ static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
+ }
+ appendUndoAction(pEntry->GetAlias(),sTableAlias,BROW_TABLE_ROW);
+ pEntry->SetAlias(sTableAlias);
+ if(m_bVisibleRow[BROW_TABLE_ROW])
+ RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId());
+
+ OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
+ if (pTabWinList)
+ {
+ OJoinTableView::OTableWindowMapIterator aIter = pTabWinList->find(sTableAlias);
+ if(aIter != pTabWinList->end())
{
- bListAction = sal_True;
- static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
+ OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second);
+ pEntry->SetDatabase(pEntryTab->GetComposedName());
+ pEntry->SetTable(pEntryTab->GetTableName());
+ pEntry->SetTabWindow(pEntryTab);
+ }
+ }
+ }
+ else
+ {
+ // nur eine Tabelle vorhanden oder der Benutzer hat vergessen diese anzugeben
+ // also einfach die erst beste nehmen
+ OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
+ if(pTabWinList)
+ {
+ OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(pTabWinList->begin()->second);
+ if (pEntryTab)
+ {
+ pEntry->SetDatabase(pEntryTab->GetComposedName());
+ if(!bListAction)
+ {
+ bListAction = sal_True;
+ static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
+ }
+ appendUndoAction(pEntry->GetTable(),pEntryTab->GetTableName(),BROW_TABLE_ROW);
+
+ pEntry->SetTable(pEntryTab->GetTableName());
+ pEntry->SetAlias(pEntry->GetTable());
+ pEntry->SetTabWindow(pEntryTab);
}
- appendUndoAction(pEntry->GetTable(),pEntryTab->GetTableName(),BROW_TABLE_ROW);
-
- pEntry->SetTable(pEntryTab->GetTableName());
- pEntry->SetAlias(pEntry->GetTable());
- pEntry->SetTabWindow(pEntryTab);
}
}
- }
- if(!bListAction)
- {
- bListAction = sal_True;
- static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
- }
- appendUndoAction(pEntry->GetFunction(),aFkt,BROW_FUNCTION_ROW);
- m_pFieldCell->SetText(aParameter);
- m_pFunctionCell->SelectEntry(aFkt);
- if(!m_bVisibleRow[BROW_FUNCTION_ROW])
- SetRowVisible(BROW_FUNCTION_ROW, sal_True);
+ if(!bListAction)
+ {
+ bListAction = sal_True;
+ static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
+ }
+ appendUndoAction(pEntry->GetFunction(),aFkt,BROW_FUNCTION_ROW);
+ m_pFieldCell->SetText(aParameter);
+ m_pFunctionCell->SelectEntry(aFkt);
+ if(!m_bVisibleRow[BROW_FUNCTION_ROW])
+ SetRowVisible(BROW_FUNCTION_ROW, sal_True);
- RowModified(GetBrowseRow(BROW_FUNCTION_ROW), GetCurColumnId());
- RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId());
- }
- else
- {
- pEntry->SetField(aFieldName);
- pEntry->SetAlias(String());
- if(!bListAction)
+ RowModified(GetBrowseRow(BROW_FUNCTION_ROW), GetCurColumnId());
+ RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId());
+ }
+ else
{
- bListAction = sal_True;
- static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
+ pEntry->SetField(aFieldName);
+ pEntry->SetAlias(String());
+ if(!bListAction)
+ {
+ bListAction = sal_True;
+ static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->EnterListAction(String(),String());
+ }
+ appendUndoAction(pEntry->GetTable(),String(),BROW_TABLE_ROW);
+ pEntry->SetTable(String());
+ pEntry->SetTabWindow(NULL);
+ m_pFieldCell->SetText(aFieldName);
+ m_pFunctionCell->SelectEntryPos(0);
+ if(m_bVisibleRow[BROW_TABLE_ROW])
+ RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId());
}
- appendUndoAction(pEntry->GetTable(),String(),BROW_TABLE_ROW);
- pEntry->SetTable(String());
- pEntry->SetTabWindow(NULL);
- m_pFieldCell->SetText(aFieldName);
- m_pFunctionCell->SelectEntryPos(0);
- if(m_bVisibleRow[BROW_TABLE_ROW])
- RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId());
}
}
-
- if (!aFieldName.Len())
- {
- ::std::replace(getFields()->begin(),getFields()->end(),pEntry,new OTableFieldDesc);
- sal_uInt16 nCol = GetCurColumnId();
- for (int i = 0; i < m_nVisibleCount; i++) // Spalte neu zeichnen
- RowModified(i,nCol);
- }
sNewValue = pEntry->GetField();
pController->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE );
}
@@ -965,21 +967,10 @@ sal_Bool OSelectionBrowseBox::SaveModified()
::rtl::OUString aCrit;
if(aText.Len())
{
- ::connectivity::OSQLParser* pParser = static_cast<OQueryController*>(getDesignView()->getController())->getParser();
- OQueryTableWindow* pWin = static_cast<OQueryTableWindow*>(pEntry->GetTabWindow());
-
- String aTest(aText);
-
+ ::rtl::OUString aErrorMsg;
Reference<XPropertySet> xColumn;
- if (pWin)
- {
- Reference<XNameAccess> xColumns = pWin->GetOriginalColumns();
- if (xColumns.is() && xColumns->hasByName(pEntry->GetField()))
- ::cppu::extractInterface(xColumn,xColumns->getByName(pEntry->GetField()));
- }
+ OSQLParseNode* pParseNode = getDesignView()->getPredicateTreeFromEntry(pEntry,aText,aErrorMsg,xColumn);
- ::rtl::OUString aErrorMsg;
- OSQLParseNode* pParseNode = pParser->predicateTree(aErrorMsg, aTest, static_cast<OQueryController*>(getDesignView()->getController())->getNumberFormatter(), xColumn);
if (pParseNode)
{
pParseNode->parseNodeToPredicateStr(aCrit,
@@ -1002,18 +993,22 @@ sal_Bool OSelectionBrowseBox::SaveModified()
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
- if(aTest.GetChar(0) != '\'' || aTest.GetChar(aTest.Len() -1) != '\'')
+ if(aText.GetChar(0) != '\'' || aText.GetChar(aText.Len() -1) != '\'')
{
- aTest.SearchAndReplaceAll(String::CreateFromAscii("'"),String::CreateFromAscii("''"));
+ aText.SearchAndReplaceAll(String::CreateFromAscii("'"),String::CreateFromAscii("''"));
String aTmp(String::CreateFromAscii("'"));
- (aTmp += aTest) += String::CreateFromAscii("'");
- aTest = aTmp;
+ (aTmp += aText) += String::CreateFromAscii("'");
+ aText = aTmp;
}
break;
default:
;
}
- pParseNode = pParser->predicateTree(aErrorMsg, aTest, static_cast<OQueryController*>(getDesignView()->getController())->getNumberFormatter(), xColumn);
+ ::connectivity::OSQLParser* pParser = static_cast<OQueryController*>(getDesignView()->getController())->getParser();
+ pParseNode = pParser->predicateTree(aErrorMsg,
+ aText,
+ static_cast<OQueryController*>(getDesignView()->getController())->getNumberFormatter(),
+ xColumn);
if (pParseNode)
{
pParseNode->parseNodeToPredicateStr(aCrit,
@@ -1041,6 +1036,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
bError = sal_True;
}
}
+ // }
}
strOldCellContents = pEntry->GetCriteria(nIdx);
pEntry->SetCriteria(nIdx, aCrit);
@@ -1726,11 +1722,13 @@ void OSelectionBrowseBox::ArrangeControls(sal_uInt16& nX, sal_uInt16 nY)
}
//------------------------------------------------------------------------------
-void OSelectionBrowseBox::Save()
+sal_Bool OSelectionBrowseBox::Save()
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
+ sal_Bool bRet = sal_True;
if (IsModified())
- SaveModified();
+ bRet = SaveModified();
+ return bRet;
}
//------------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
index 72abbb957bda..b68c4dfa5df7 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: SelectionBrowseBox.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: fs $ $Date: 2001-06-29 08:40:31 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -152,7 +152,7 @@ namespace dbaui
void AddOrder(const OTableFieldDesc& rInfo, const EOrderDir eDir, sal_uInt16& nPos);
void ClearAll();
OTableFieldDesc* AppendNewCol( sal_uInt16 nCnt=1 );
- void Save();
+ sal_Bool Save();
OQueryDesignView* getDesignView();
OQueryDesignView* getDesignView() const;
void SetColWidth();
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index c8e2c0198376..9ea3b5e2ef61 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: querycontroller.cxx,v $
*
- * $Revision: 1.55 $
+ * $Revision: 1.56 $
*
- * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $
+ * last change: $Author: oj $ $Date: 2001-09-27 06:19:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -401,6 +401,7 @@ void OQueryController::Execute(sal_uInt16 _nId)
getContainer()->paste();
break;
case ID_BROWSER_SQL:
+ if(getContainer()->checkStatement())
{
try
{
@@ -487,10 +488,8 @@ void OQueryController::Execute(sal_uInt16 _nId)
setModified(sal_True);
break;
case ID_BROWSER_QUERY_EXECUTE:
- {
+ if(getContainer()->checkStatement())
executeQuery();
-
- }
break;
case ID_QUERY_ZOOM_IN:
{
@@ -638,36 +637,39 @@ void SAL_CALL OQueryController::initialize( const Sequence< Any >& aArguments )
{
}
setQueryComposer();
- ::rtl::OUString aErrorMsg;
- ::connectivity::OSQLParseNode* pNode = m_pSqlParser->parseTree(aErrorMsg,m_sStatement,m_bDesign);
- // m_pParseNode = pNode;
- if(pNode)
+ if(m_bEsacpeProcessing)
{
- if(m_pSqlIterator)
+ ::rtl::OUString aErrorMsg;
+ ::connectivity::OSQLParseNode* pNode = m_pSqlParser->parseTree(aErrorMsg,m_sStatement,m_bDesign);
+ // m_pParseNode = pNode;
+ if(pNode)
{
- delete m_pSqlIterator->getParseTree();
- m_pSqlIterator->setParseTree(pNode);
- m_pSqlIterator->traverseAll();
- SQLWarning aWarning = m_pSqlIterator->getWarning();
- if(aWarning.Message.getLength())
+ if(m_pSqlIterator)
{
- showError(SQLExceptionInfo(aWarning));
+ delete m_pSqlIterator->getParseTree();
+ m_pSqlIterator->setParseTree(pNode);
+ m_pSqlIterator->traverseAll();
+ SQLWarning aWarning = m_pSqlIterator->getWarning();
+ if(aWarning.Message.getLength())
+ {
+ showError(SQLExceptionInfo(aWarning));
+ m_bDesign = sal_False;
+ }
+ }
+ else
+ {
+ delete pNode;
m_bDesign = sal_False;
}
}
else
{
- delete pNode;
- m_bDesign = sal_False;
+ String aTitle(ModuleRes(STR_SVT_SQL_SYNTAX_ERROR));
+ OSQLMessageBox aDlg(getView(),aTitle,aErrorMsg);
+ aDlg.Execute();
+ m_bDesign = sal_False; // the statement can't be parsed so we show the text view
}
}
- else
- {
- String aTitle(ModuleRes(STR_SVT_SQL_SYNTAX_ERROR));
- OSQLMessageBox aDlg(getView(),aTitle,aErrorMsg);
- aDlg.Execute();
- m_bDesign = sal_False; // the statement can't be parsed so we show the text view
- }
}
}