Kaydet (Commit) fca027b0 authored tarafından Oliver Specht's avatar Oliver Specht

#89762# connections now pooled at the SwNewDBMgr

üst 894ff1ac
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: dbmgr.hxx,v $ * $RCSfile: dbmgr.hxx,v $
* *
* $Revision: 1.11 $ * $Revision: 1.12 $
* *
* last change: $Author: os $ $Date: 2001-07-10 13:49:54 $ * last change: $Author: os $ $Date: 2001-08-15 08:20:44 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -206,6 +206,7 @@ class SwNewDBMgr ...@@ -206,6 +206,7 @@ class SwNewDBMgr
SwMailMergeDlg* pMergeDialog; SwMailMergeDlg* pMergeDialog;
SwDSParam* FindDSData(const SwDBData& rData, BOOL bCreate); SwDSParam* FindDSData(const SwDBData& rData, BOOL bCreate);
SwDSParam* FindDSConnection(const ::rtl::OUString& rSource, BOOL bCreate);
DECL_LINK( PrtCancelHdl, Button * ); DECL_LINK( PrtCancelHdl, Button * );
...@@ -301,6 +302,10 @@ public: ...@@ -301,6 +302,10 @@ public:
BOOL GetColumnCnt(const String& rSourceName, const String& rTableName, BOOL GetColumnCnt(const String& rSourceName, const String& rTableName,
const String& rColumnName, sal_uInt32 nAbsRecordId, long nLanguage, const String& rColumnName, sal_uInt32 nAbsRecordId, long nLanguage,
String& rResult, double* pNumber); String& rResult, double* pNumber);
//create and store or find an already stored connection to a data source for use
//in SwFldMgr and SwDBTreeList
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>
RegisterConnection(::rtl::OUString& rSource);
const SwDSParam* CreateDSData(const SwDBData& rData) const SwDSParam* CreateDSData(const SwDBData& rData)
{return FindDSData(rData, TRUE);} {return FindDSData(rData, TRUE);}
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: dbmgr.cxx,v $ * $RCSfile: dbmgr.cxx,v $
* *
* $Revision: 1.42 $ * $Revision: 1.43 $
* *
* last change: $Author: os $ $Date: 2001-08-02 08:30:38 $ * last change: $Author: os $ $Date: 2001-08-15 08:20:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -726,7 +726,12 @@ BOOL SwNewDBMgr::GetTableNames(ListBox* pListBox, const String& rDBName) ...@@ -726,7 +726,12 @@ BOOL SwNewDBMgr::GetTableNames(ListBox* pListBox, const String& rDBName)
String sOldTableName(pListBox->GetSelectEntry()); String sOldTableName(pListBox->GetSelectEntry());
pListBox->Clear(); pListBox->Clear();
Reference< XDataSource> xSource; Reference< XDataSource> xSource;
Reference< XConnection> xConnection = SwNewDBMgr::GetConnection(rDBName, xSource); SwDSParam* pParam = FindDSConnection(rDBName, FALSE);
Reference< XConnection> xConnection;
if(pParam && pParam->xConnection.is())
xConnection = pParam->xConnection;
else
xConnection = SwNewDBMgr::GetConnection(rDBName, xSource);
if(xConnection.is()) if(xConnection.is())
{ {
Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY); Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY);
...@@ -769,7 +774,12 @@ BOOL SwNewDBMgr::GetColumnNames(ListBox* pListBox, ...@@ -769,7 +774,12 @@ BOOL SwNewDBMgr::GetColumnNames(ListBox* pListBox,
if (!bAppend) if (!bAppend)
pListBox->Clear(); pListBox->Clear();
Reference< XDataSource> xSource; Reference< XDataSource> xSource;
Reference< XConnection> xConnection = SwNewDBMgr::GetConnection(rDBName, xSource); SwDSParam* pParam = FindDSConnection(rDBName, FALSE);
Reference< XConnection> xConnection;
if(pParam && pParam->xConnection.is())
xConnection = pParam->xConnection;
else
xConnection = SwNewDBMgr::GetConnection(rDBName, xSource);
Reference< XColumnsSupplier> xColsSupp = SwNewDBMgr::GetColumnSupplier(xConnection, rTableName); Reference< XColumnsSupplier> xColsSupp = SwNewDBMgr::GetColumnSupplier(xConnection, rTableName);
if(xColsSupp.is()) if(xColsSupp.is())
{ {
...@@ -823,6 +833,23 @@ SwNewDBMgr::SwNewDBMgr() : ...@@ -823,6 +833,23 @@ SwNewDBMgr::SwNewDBMgr() :
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
SwNewDBMgr::~SwNewDBMgr() SwNewDBMgr::~SwNewDBMgr()
{ {
for(USHORT nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
{
SwDSParam* pParam = aDataSourceParams[nPos];
if(pParam->xConnection.is())
{
try
{
Reference<XComponent> xComp(pParam->xConnection, UNO_QUERY);
if(xComp.is())
xComp->dispose();
}
catch(RuntimeException& rEx)
{
//may be disposed already since multiple entries may have used the same connection
}
}
}
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
Beschreibung: Serienbrief drucken Beschreibung: Serienbrief drucken
...@@ -1266,7 +1293,11 @@ ULONG SwNewDBMgr::GetColumnFmt( const String& rDBName, ...@@ -1266,7 +1293,11 @@ ULONG SwNewDBMgr::GetColumnFmt( const String& rDBName,
} }
if(!xConnection.is() || !xSource.is()) if(!xConnection.is() || !xSource.is())
{ {
xConnection = SwNewDBMgr::GetConnection(rDBName, xSource); SwDSParam* pParam = FindDSConnection(rDBName, FALSE);
if(pParam && pParam->xConnection.is())
xConnection = pParam->xConnection;
else
xConnection = SwNewDBMgr::GetConnection(rDBName, xSource);
if(bUseMergeData) if(bUseMergeData)
pMergeData->xConnection = xConnection; pMergeData->xConnection = xConnection;
} }
...@@ -1381,7 +1412,12 @@ sal_Int32 SwNewDBMgr::GetColumnType( const String& rDBName, ...@@ -1381,7 +1412,12 @@ sal_Int32 SwNewDBMgr::GetColumnType( const String& rDBName,
{ {
sal_Int32 nRet = DataType::SQLNULL; sal_Int32 nRet = DataType::SQLNULL;
Reference< XDataSource> xSource; Reference< XDataSource> xSource;
Reference< XConnection> xConnection = SwNewDBMgr::GetConnection(rDBName, xSource); SwDSParam* pParam = FindDSConnection(rDBName, FALSE);
Reference< XConnection> xConnection;
if(pParam && pParam->xConnection.is())
xConnection = pParam->xConnection;
else
xConnection = SwNewDBMgr::GetConnection(rDBName, xSource);
Reference< XColumnsSupplier> xColsSupp = SwNewDBMgr::GetColumnSupplier(xConnection, rTableName); Reference< XColumnsSupplier> xColsSupp = SwNewDBMgr::GetColumnSupplier(xConnection, rTableName);
if(xColsSupp.is()) if(xColsSupp.is())
{ {
...@@ -1783,7 +1819,12 @@ BOOL SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTableO ...@@ -1783,7 +1819,12 @@ BOOL SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTableO
Reference< XDataSource> xSource; Reference< XDataSource> xSource;
if(pFound->xResultSet.is()) if(pFound->xResultSet.is())
return TRUE; return TRUE;
pFound->xConnection = SwNewDBMgr::GetConnection(rDataSource, xSource ); SwDSParam* pParam = FindDSConnection(rDataSource, FALSE);
Reference< XConnection> xConnection;
if(pParam && pParam->xConnection.is())
pFound->xConnection = pParam->xConnection;
else
pFound->xConnection = SwNewDBMgr::GetConnection(rDataSource, xSource );
if(pFound->xConnection.is()) if(pFound->xConnection.is())
{ {
try try
...@@ -1815,6 +1856,17 @@ BOOL SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTableO ...@@ -1815,6 +1856,17 @@ BOOL SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTableO
} }
return pFound->xResultSet.is(); return pFound->xResultSet.is();
} }
/* -----------------------------14.08.2001 10:26------------------------------
---------------------------------------------------------------------------*/
Reference< XConnection> SwNewDBMgr::RegisterConnection(OUString& rDataSource)
{
SwDSParam* pFound = SwNewDBMgr::FindDSConnection(rDataSource, TRUE);
Reference< XDataSource> xSource;
if(!pFound->xConnection.is())
pFound->xConnection = SwNewDBMgr::GetConnection(rDataSource, xSource );
return pFound->xConnection;
}
/* -----------------------------17.07.00 15:55-------------------------------- /* -----------------------------17.07.00 15:55--------------------------------
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
...@@ -1852,16 +1904,17 @@ sal_uInt32 SwNewDBMgr::GetSelectedRecordId( ...@@ -1852,16 +1904,17 @@ sal_uInt32 SwNewDBMgr::GetSelectedRecordId(
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
void SwNewDBMgr::CloseAll(BOOL bIncludingMerge) void SwNewDBMgr::CloseAll(BOOL bIncludingMerge)
{ {
for(USHORT nPos = 0; nPos < aDataSourceParams.Count(); nPos++) //do nothing - keep all connections until the destructor
{ // for(USHORT nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
SwDSParam* pParam = aDataSourceParams[nPos]; // {
if(bIncludingMerge || pParam != pMergeData) // SwDSParam* pParam = aDataSourceParams[nPos];
{ // if(bIncludingMerge || pParam != pMergeData)
pParam->xResultSet = 0; // {
pParam->xStatement = 0; // pParam->xResultSet = 0;
pParam->xConnection = 0; // pParam->xStatement = 0;
} // pParam->xConnection = 0;
} // }
// }
} }
/* -----------------------------17.07.00 14:54-------------------------------- /* -----------------------------17.07.00 14:54--------------------------------
...@@ -1890,6 +1943,31 @@ SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, BOOL bCreate) ...@@ -1890,6 +1943,31 @@ SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, BOOL bCreate)
} }
return pFound; return pFound;
} }
/* -----------------------------14.08.2001 10:27------------------------------
---------------------------------------------------------------------------*/
SwDSParam* SwNewDBMgr::FindDSConnection(const OUString& rDataSource, BOOL bCreate)
{
SwDSParam* pFound = 0;
for(USHORT nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
{
SwDSParam* pParam = aDataSourceParams[nPos];
if(rDataSource == pParam->sDataSource)
{
pFound = pParam;
break;
}
}
if(bCreate && !pFound)
{
SwDBData aData;
aData.sDataSource = rDataSource;
pFound = new SwDSParam(aData);
aDataSourceParams.Insert(pFound, aDataSourceParams.Count());
}
return pFound;
}
/* -----------------------------17.07.00 14:31-------------------------------- /* -----------------------------17.07.00 14:31--------------------------------
rDBName: <Source> + DB_DELIM + <Table>; + <Statement> rDBName: <Source> + DB_DELIM + <Table>; + <Statement>
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: dbtree.cxx,v $ * $RCSfile: dbtree.cxx,v $
* *
* $Revision: 1.11 $ * $Revision: 1.12 $
* *
* last change: $Author: os $ $Date: 2001-08-08 10:11:56 $ * last change: $Author: os $ $Date: 2001-08-15 08:20:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -163,7 +163,6 @@ using namespace com::sun::star::beans; ...@@ -163,7 +163,6 @@ using namespace com::sun::star::beans;
struct SwConnectionData struct SwConnectionData
{ {
OUString sSourceName; OUString sSourceName;
Reference<XDataSource> xSource;
Reference<XConnection> xConnection; Reference<XConnection> xConnection;
}; };
...@@ -177,8 +176,11 @@ class SwDBTreeList_Impl : public cppu::WeakImplHelper1 < XContainerListener > ...@@ -177,8 +176,11 @@ class SwDBTreeList_Impl : public cppu::WeakImplHelper1 < XContainerListener >
{ {
Reference< XNameAccess > xDBContext; Reference< XNameAccess > xDBContext;
SwConnectionArr aConnections; SwConnectionArr aConnections;
SwWrtShell& rWrtSh;
public: public:
SwDBTreeList_Impl(){} SwDBTreeList_Impl(SwWrtShell& rShell) :
rWrtSh(rShell) {}
~SwDBTreeList_Impl(); ~SwDBTreeList_Impl();
virtual void SAL_CALL elementInserted( const ContainerEvent& Event ) throw (RuntimeException); virtual void SAL_CALL elementInserted( const ContainerEvent& Event ) throw (RuntimeException);
...@@ -195,13 +197,6 @@ class SwDBTreeList_Impl : public cppu::WeakImplHelper1 < XContainerListener > ...@@ -195,13 +197,6 @@ class SwDBTreeList_Impl : public cppu::WeakImplHelper1 < XContainerListener >
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
SwDBTreeList_Impl::~SwDBTreeList_Impl() SwDBTreeList_Impl::~SwDBTreeList_Impl()
{ {
for(USHORT i = 0; i < aConnections.Count(); i++)
{
SwConnectionDataPtr pPtr = aConnections[i];
Reference<XComponent> xComp(pPtr->xConnection, UNO_QUERY);
if(xComp.is())
xComp->dispose();
}
Reference<XContainer> xContainer(xDBContext, UNO_QUERY); Reference<XContainer> xContainer(xDBContext, UNO_QUERY);
if(xContainer.is()) if(xContainer.is())
{ {
...@@ -235,9 +230,9 @@ void SwDBTreeList_Impl::elementRemoved( const ContainerEvent& rEvent ) throw (Ru ...@@ -235,9 +230,9 @@ void SwDBTreeList_Impl::elementRemoved( const ContainerEvent& rEvent ) throw (Ru
if(pPtr->sSourceName == sSource) if(pPtr->sSourceName == sSource)
{ {
SwConnectionDataPtr pPtr = aConnections[i]; SwConnectionDataPtr pPtr = aConnections[i];
Reference<XComponent> xComp(pPtr->xConnection, UNO_QUERY); // Reference<XComponent> xComp(pPtr->xConnection, UNO_QUERY);
if(xComp.is()) // if(xComp.is())
xComp->dispose(); // xComp->dispose();
aConnections.DeleteAndDestroy(i); aConnections.DeleteAndDestroy(i);
break; break;
} }
...@@ -297,23 +292,7 @@ Reference<XConnection> SwDBTreeList_Impl::GetConnection(const rtl::OUString& rS ...@@ -297,23 +292,7 @@ Reference<XConnection> SwDBTreeList_Impl::GetConnection(const rtl::OUString& rS
{ {
SwConnectionDataPtr pPtr = new SwConnectionData(); SwConnectionDataPtr pPtr = new SwConnectionData();
pPtr->sSourceName = rSourceName; pPtr->sSourceName = rSourceName;
Reference<XConnection> xConnection; xRet = rWrtSh.GetNewDBMgr()->RegisterConnection(pPtr->sSourceName);
try
{
Any aDBSource = xDBContext->getByName(rSourceName);
Reference<XCompletedConnection> xComplConnection;
aDBSource >>= xComplConnection;
pPtr->xSource = Reference<XDataSource>(xComplConnection, UNO_QUERY);
Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
Reference< XInteractionHandler > xHandler(
xMgr->createInstance( C2U( "com.sun.star.sdb.InteractionHandler" )), UNO_QUERY);
pPtr->xConnection = xComplConnection->connectWithCompletion( xHandler );
xRet = pPtr->xConnection;
}
catch(Exception&)
{
}
aConnections.Insert(pPtr, aConnections.Count()); aConnections.Insert(pPtr, aConnections.Count());
} }
return xRet; return xRet;
...@@ -321,7 +300,9 @@ Reference<XConnection> SwDBTreeList_Impl::GetConnection(const rtl::OUString& rS ...@@ -321,7 +300,9 @@ Reference<XConnection> SwDBTreeList_Impl::GetConnection(const rtl::OUString& rS
/*------------------------------------------------------------------------ /*------------------------------------------------------------------------
Beschreibung: Beschreibung:
------------------------------------------------------------------------*/ ------------------------------------------------------------------------*/
SwDBTreeList::SwDBTreeList(Window *pParent, const ResId& rResId, const String& rDefDBName, const BOOL bShowCol): SwDBTreeList::SwDBTreeList(Window *pParent, const ResId& rResId,
SwWrtShell& rSh,
const String& rDefDBName, const BOOL bShowCol):
SvTreeListBox (pParent, rResId), SvTreeListBox (pParent, rResId),
...@@ -333,7 +314,7 @@ SwDBTreeList::SwDBTreeList(Window *pParent, const ResId& rResId, const String& r ...@@ -333,7 +314,7 @@ SwDBTreeList::SwDBTreeList(Window *pParent, const ResId& rResId, const String& r
sDefDBName (rDefDBName), sDefDBName (rDefDBName),
bShowColumns (bShowCol), bShowColumns (bShowCol),
pImpl(new SwDBTreeList_Impl), pImpl(new SwDBTreeList_Impl(rSh)),
bInitialized (FALSE) bInitialized (FALSE)
{ {
SetHelpId(HID_DB_SELECTION_TLB); SetHelpId(HID_DB_SELECTION_TLB);
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: dbui.cxx,v $ * $RCSfile: dbui.cxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 17:14:34 $ * last change: $Author: os $ $Date: 2001-08-15 08:20:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -76,71 +76,6 @@ ...@@ -76,71 +76,6 @@
#include "dbui.hrc" #include "dbui.hrc"
#include "dbui.hxx" #include "dbui.hxx"
// STATIC DATA -----------------------------------------------------------
/*------------------------------------------------------------------------
Beschreibung:
------------------------------------------------------------------------*/
#if 0
SwDBSelect::SwDBSelect(Window *pParent, SwWrtShell *pSh, const String& rDefDBName):
SvxStandardDialog(pParent, SW_RES(DLG_DBSELECTION)),
aTree (this, SW_RES(TLB_DBLIST), rDefDBName),
aOkBTN (this, SW_RES(BTN_OK)),
aCancelBTN (this, SW_RES(BTN_CANCEL)),
aHelpBTN (this, SW_RES(BTN_HELP))
{
FreeResource();
aTree.SetSelectHdl(LINK(this, SwDBSelect, TreeSelectHdl));
}
/*------------------------------------------------------------------------
Beschreibung:
------------------------------------------------------------------------*/
__EXPORT SwDBSelect::~SwDBSelect()
{
}
/*------------------------------------------------------------------------
Beschreibung:
------------------------------------------------------------------------*/
void __EXPORT SwDBSelect::Apply()
{
}
/*------------------------------------------------------------------------
Beschreibung:
------------------------------------------------------------------------*/
String SwDBSelect::GetDBName() const
{
return aTree.GetDBName();
}
/*---------------------------------------------------------------------
Beschreibung:
---------------------------------------------------------------------*/
IMPL_LINK( SwDBSelect, TreeSelectHdl, SvTreeListBox *, pBox )
{
SvLBoxEntry* pEntry = pBox->GetCurEntry();
if (pEntry)
aOkBTN.Enable(aTree.GetParent(pEntry) != 0);
return 0;
}
#endif
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Beschreibung: Beschreibung:
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
...@@ -160,57 +95,3 @@ PrintMonitor::PrintMonitor( Window *pParent, BOOL bEMail ) ...@@ -160,57 +95,3 @@ PrintMonitor::PrintMonitor( Window *pParent, BOOL bEMail )
FreeResource(); FreeResource();
} }
/*------------------------------------------------------------------------
$Log: not supported by cvs2svn $
Revision 1.15 2000/09/18 16:05:19 willem.vandorp
OpenOffice header added.
Revision 1.14 2000/06/26 13:31:03 os
new DataBase API
Revision 1.13 1999/03/08 08:56:26 MH
chg: header
Rev 1.12 08 Mar 1999 09:56:26 MH
chg: header
Rev 1.11 27 Oct 1998 12:17:08 OM
#58132# Progress fuer Serienmailings
Rev 1.10 09 Dec 1997 12:30:52 OM
#45200# Serienbrief: Speichern-Monitor
Rev 1.9 02 Sep 1997 09:57:12 OM
SDB-Headeranpassung
Rev 1.8 01 Sep 1997 13:16:04 OS
DLL-Umstellung
Rev 1.7 11 Nov 1996 09:25:38 MA
ResMgr
Rev 1.6 02 Oct 1996 18:00:56 MA
Umstellung Enable/Disable
Rev 1.5 28 Aug 1996 09:18:04 OS
includes
Rev 1.4 05 Aug 1996 15:47:52 OM
Datenbankumstellung
Rev 1.3 25 Jul 1996 16:36:26 OM
Eigene TreeListbox fuer Datenbankauswahl
Rev 1.2 23 Jul 1996 13:28:38 OM
Neue Segs
Rev 1.1 23 Jul 1996 13:26:08 OM
Datenbank und Tabelle auswaehlen
Rev 1.0 22 Jul 1996 11:01:52 OM
Initial revision.
------------------------------------------------------------------------*/
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: changedb.cxx,v $ * $RCSfile: changedb.cxx,v $
* *
* $Revision: 1.6 $ * $Revision: 1.7 $
* *
* last change: $Author: fme $ $Date: 2001-05-21 12:27:13 $ * last change: $Author: os $ $Date: 2001-08-15 08:20:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -145,7 +145,7 @@ SwChangeDBDlg::SwChangeDBDlg(SwView& rVw) : ...@@ -145,7 +145,7 @@ SwChangeDBDlg::SwChangeDBDlg(SwView& rVw) :
aUsedDBFT (this, SW_RES(FT_USEDDB )), aUsedDBFT (this, SW_RES(FT_USEDDB )),
aAvailDBFT (this, SW_RES(FT_AVAILDB )), aAvailDBFT (this, SW_RES(FT_AVAILDB )),
aUsedDBTLB (this, SW_RES(TLB_USEDDB )), aUsedDBTLB (this, SW_RES(TLB_USEDDB )),
aAvailDBTLB (this, SW_RES(TLB_AVAILDB )), aAvailDBTLB (this, SW_RES(TLB_AVAILDB ), rVw.GetWrtShell()),
aDescFT (this, SW_RES(FT_DESC )), aDescFT (this, SW_RES(FT_DESC )),
aDocDBTextFT(this, SW_RES(FT_DOCDBTEXT )), aDocDBTextFT(this, SW_RES(FT_DOCDBTEXT )),
aDocDBNameFT(this, SW_RES(FT_DOCDBNAME )), aDocDBNameFT(this, SW_RES(FT_DOCDBNAME )),
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: flddb.cxx,v $ * $RCSfile: flddb.cxx,v $
* *
* $Revision: 1.8 $ * $Revision: 1.9 $
* *
* last change: $Author: os $ $Date: 2001-07-18 13:24:40 $ * last change: $Author: os $ $Date: 2001-08-15 08:20:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -114,7 +114,7 @@ SwFldDBPage::SwFldDBPage(Window* pParent, const SfxItemSet& rCoreSet ) : ...@@ -114,7 +114,7 @@ SwFldDBPage::SwFldDBPage(Window* pParent, const SfxItemSet& rCoreSet ) :
aTypeFT (this, SW_RES(FT_DBTYPE)), aTypeFT (this, SW_RES(FT_DBTYPE)),
aTypeLB (this, SW_RES(LB_DBTYPE)), aTypeLB (this, SW_RES(LB_DBTYPE)),
aSelectionFT(this, SW_RES(FT_DBSELECTION)), aSelectionFT(this, SW_RES(FT_DBSELECTION)),
aDatabaseTLB(this, SW_RES(TLB_DBLIST), aEmptyStr, FALSE), aDatabaseTLB(this, SW_RES(TLB_DBLIST), ::GetActiveView()->GetWrtShell(),aEmptyStr, FALSE),
aConditionFT(this, SW_RES(FT_DBCONDITION)), aConditionFT(this, SW_RES(FT_DBCONDITION)),
aConditionED(this, SW_RES(ED_DBCONDITION)), aConditionED(this, SW_RES(ED_DBCONDITION)),
aValueFT (this, SW_RES(FT_DBSETNUMBER)), aValueFT (this, SW_RES(FT_DBSETNUMBER)),
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xfldui.cxx,v $ * $RCSfile: xfldui.cxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* *
* last change: $Author: os $ $Date: 2001-07-18 13:24:40 $ * last change: $Author: os $ $Date: 2001-08-15 08:20:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -100,6 +100,18 @@ ...@@ -100,6 +100,18 @@
#ifndef _FLDMGR_HXX #ifndef _FLDMGR_HXX
#include <fldmgr.hxx> #include <fldmgr.hxx>
#endif #endif
#ifndef _DBMGR_HXX
#include <dbmgr.hxx>
#endif
#ifndef _WRTSH_HXX
#include <wrtsh.hxx> // Actives Fenster
#endif
#ifndef _VIEW_HXX
#include <view.hxx>
#endif
#ifndef _SWMODULE_HXX
#include <swmodule.hxx>
#endif
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
...@@ -126,21 +138,18 @@ BOOL SwFldMgr::IsDBNumeric( const String& rDBName, const String& rTblQryName, ...@@ -126,21 +138,18 @@ BOOL SwFldMgr::IsDBNumeric( const String& rDBName, const String& rTblQryName,
BOOL bIsTable, const String& rFldName) BOOL bIsTable, const String& rFldName)
{ {
BOOL bNumeric = TRUE; BOOL bNumeric = TRUE;
if( !GetDBContext().is() || !xDBContext->hasByName(rDBName) )
SwNewDBMgr* pDBMgr = pWrtShell ? pWrtShell->GetNewDBMgr() :
::GetActiveView()->GetWrtShell().GetNewDBMgr();
::rtl::OUString sSource(rDBName);
Reference< XConnection> xConnection =
pDBMgr->RegisterConnection(sSource);
if( !xConnection.is() )
return bNumeric; return bNumeric;
Any aDBSource = xDBContext->getByName(rDBName);
Reference<XDataSource>* pxSource = (Reference<XDataSource>*)aDBSource.getValue();
Reference<XConnection> xConnection;
try
{
rtl::OUString sDummy;
xConnection = (*pxSource)->getConnection(sDummy, sDummy);
}
catch(Exception&)
{}
Reference<XColumnsSupplier> xColsSupplier; Reference<XColumnsSupplier> xColsSupplier;
if(bIsTable) if(bIsTable)
{ {
Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY); Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY);
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: dbtree.hxx,v $ * $RCSfile: dbtree.hxx,v $
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* last change: $Author: os $ $Date: 2001-07-17 12:34:53 $ * last change: $Author: os $ $Date: 2001-08-15 08:20:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -79,6 +79,7 @@ namespace com{namespace sun{namespace star{namespace container{ ...@@ -79,6 +79,7 @@ namespace com{namespace sun{namespace star{namespace container{
#include <swunodef.hxx> #include <swunodef.hxx>
#endif #endif
class SwDBTreeList_Impl; class SwDBTreeList_Impl;
class SwWrtShell;
class SwDBTreeList : public SvTreeListBox class SwDBTreeList : public SvTreeListBox
{ {
Bitmap aRootOpened; Bitmap aRootOpened;
...@@ -103,7 +104,8 @@ class SwDBTreeList : public SvTreeListBox ...@@ -103,7 +104,8 @@ class SwDBTreeList : public SvTreeListBox
public: public:
SwDBTreeList( Window* pParent, const ResId& rResId, SwDBTreeList( Window* pParent, const ResId& rResId,
const String& rDefDBName = aEmptyStr, SwWrtShell& rSh,
const String& rDefDBName = aEmptyStr,
const BOOL bShowCol = FALSE ); const BOOL bShowCol = FALSE );
virtual ~SwDBTreeList(); virtual ~SwDBTreeList();
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: dbui.hxx,v $ * $RCSfile: dbui.hxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 17:14:39 $ * last change: $Author: os $ $Date: 2001-08-15 08:20:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -73,30 +73,6 @@ ...@@ -73,30 +73,6 @@
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#endif #endif
#include "dbtree.hxx"
#include "swtypes.hxx"
class SwWrtShell;
class SbaObject;
class SwDBSelect : public SvxStandardDialog
{
SwDBTreeList aTree;
OKButton aOkBTN;
CancelButton aCancelBTN;
HelpButton aHelpBTN;
DECL_LINK(TreeSelectHdl, SvTreeListBox* pBox);
virtual void Apply();
public:
SwDBSelect(Window* pParent, SwWrtShell* pSh, const String& rDefDBName = aEmptyStr);
~SwDBSelect();
String GetDBName() const;
};
class PrintMonitor: public ModelessDialog class PrintMonitor: public ModelessDialog
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment