some corrections for columnnames and aliases

This commit is contained in:
Ocke Janssen 2001-04-06 12:47:18 +00:00
parent aa93361408
commit 7e6b0f6fa7
4 changed files with 30 additions and 24 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: querycontroller.hxx,v $
*
* $Revision: 1.10 $
* $Revision: 1.11 $
*
* last change: $Author: oj $ $Date: 2001-04-02 10:18:50 $
* last change: $Author: oj $ $Date: 2001-04-06 13:47:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -144,6 +144,7 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getQueries();
// creates the querycomposer
void setQueryComposer();
void deleteIterator();
void executeQuery();
protected:

View file

@ -2,9 +2,9 @@
*
* $RCSfile: QueryDesignView.cxx,v $
*
* $Revision: 1.11 $
* $Revision: 1.12 $
*
* last change: $Author: oj $ $Date: 2001-03-20 08:13:25 $
* last change: $Author: oj $ $Date: 2001-04-06 13:46:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -597,6 +597,10 @@ extern ::rtl::OUString ConvertAlias(const ::rtl::OUString& rName);
aTmpStr += ::dbtools::quoteName(aQuote,ConvertAlias(rAlias));
aTmpStr += ::rtl::OUString('.');
}
// we have to look if we have alias.* here
String sTemp = rFieldName;
if(sTemp.GetTokenCount('.') == 2)
rFieldName = sTemp.GetToken(1,'.');
if(pEntryField->GetTable().getLength() && rFieldName.toChar() != '*')
aTmpStr += ::dbtools::quoteName(aQuote, rFieldName).getStr();

View file

@ -2,9 +2,9 @@
*
* $RCSfile: SelectionBrowseBox.cxx,v $
*
* $Revision: 1.13 $
* $Revision: 1.14 $
*
* last change: $Author: fs $ $Date: 2001-03-30 13:06:46 $
* last change: $Author: oj $ $Date: 2001-04-06 13:46:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -617,17 +617,10 @@ sal_Bool OSelectionBrowseBox::SaveModified()
OQueryTableWindow* pWin = static_cast<OQueryTableWindow*>(pEntry->GetTabWindow());
if (!pWin && (aFieldName.GetTokenCount('.') == 2))
{
OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
if (pTabWinList)
{
OJoinTableView::OTableWindowMapIterator aIter = pTabWinList->find(aFieldName.GetToken(0, '.'));
if(aIter != pTabWinList->end())
pWin = static_cast<OQueryTableWindow*>(aIter->second);
}
}
pWin = static_cast<OQueryTableWindow*>(getDesignView()->getTableView()->GetWindow(aFieldName.GetToken(0, '.')));
Reference<XPropertySet> xColumn;
sal_Bool bAsterix = sal_False;
if (pWin)
{
Reference<XNameAccess> xColumns = pWin->GetOriginalColumns();
@ -635,9 +628,11 @@ sal_Bool OSelectionBrowseBox::SaveModified()
::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;
}
if(!xColumn.is()) // only when text not a column of the table
if(!xColumn.is() && !bAsterix) // only when text not a column of the table
{
::rtl::OUString aErrorMsg;
bIsPredicate = sal_True; // #72670#
@ -695,8 +690,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
if(!xConnection.is())
break;
Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
if(xMetaData->supportsCoreSQLGrammar()
&& aFieldName.GetChar(0) != '*' && pEntry->GetFunction().getLength())
if(aFieldName.GetChar(0) != '*' && pEntry->GetFunction().getLength())
{
pEntry->SetFunction(::rtl::OUString());
m_pFunctionCell->SelectEntryPos(0);
@ -1896,7 +1890,8 @@ String OSelectionBrowseBox::GetCellText(long nRow, sal_uInt16 nColId) const
if (aField.GetChar(0) == '*') // * durch alias.* ersetzen
{
aField = pEntry->GetAlias();
aField += '.';
if(aField.Len())
aField += '.';
aField += '*';
}
aText = aField;

View file

@ -2,9 +2,9 @@
*
* $RCSfile: querycontroller.cxx,v $
*
* $Revision: 1.27 $
* $Revision: 1.28 $
*
* last change: $Author: fs $ $Date: 2001-04-03 14:14:35 $
* last change: $Author: oj $ $Date: 2001-04-06 13:46:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -253,14 +253,20 @@ OQueryController::~OQueryController()
{
}
// -----------------------------------------------------------------------------
void OQueryController::disposing()
void OQueryController::deleteIterator()
{
if(m_pSqlIterator)
{
delete m_pSqlIterator->getParseTree();
m_pSqlIterator->dispose();
delete m_pSqlIterator;
m_pSqlIterator = NULL;
}
}
// -----------------------------------------------------------------------------
void OQueryController::disposing()
{
deleteIterator();
delete m_pSqlParser;
delete m_pParseContext;
@ -786,6 +792,7 @@ void OQueryController::setQueryComposer()
}
OSL_ENSURE(m_xComposer.is(),"No querycomposer available!");
Reference<XTablesSupplier> xTablesSup(m_xConnection, UNO_QUERY);
deleteIterator();
m_pSqlIterator = new ::connectivity::OSQLParseTreeIterator(xTablesSup->getTables(),m_xConnection->getMetaData(),NULL,m_pSqlParser);
}
}
@ -887,8 +894,7 @@ void SAL_CALL OQueryController::disposing( const EventObject& Source ) throw(Run
// -----------------------------------------------------------------------------
void OQueryController::createNewConnection(sal_Bool _bUI)
{
delete m_pSqlIterator;
m_pSqlIterator = NULL;
deleteIterator();
::comphelper::disposeComponent(m_xComposer);
OJoinController::createNewConnection(_bUI);