diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-08-22 23:10:45 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-08-22 23:15:18 -0400 |
commit | 44dcb37bf9339611559743f35a93dd674227b357 (patch) | |
tree | 61486541abd94383342aeacd246a5d1addcaa7a3 /sc/inc | |
parent | 585b3ebea4312dbfa86ad9f4a72f0014fe2eacec (diff) |
Abstract database connection from pivot cache to hide UNO API.
This is the first step toward unit-testing the initialization
code from the database source.
Change-Id: I1a7882ba443fd71d4210fb2e2caa195fb71dab92
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/dpcache.hxx | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx index 68b1029edc5d..d68f3482de0c 100644 --- a/sc/inc/dpcache.hxx +++ b/sc/inc/dpcache.hxx @@ -43,12 +43,6 @@ #include <vector> #include <set> -namespace com { namespace sun { namespace star { - namespace sdbc { - class XRowSet; - } -}}} - struct ScQueryParam; class ScDPObject; class ScDPItemData; @@ -102,6 +96,20 @@ public: Field(); }; + /** + * Interface for connecting to database source. Column index is 0-based. + */ + class DBConnector + { + public: + virtual long getColumnCount() const = 0; + virtual rtl::OUString getColumnLabel(long nCol) const = 0; + virtual bool first() = 0; + virtual bool next() = 0; + virtual void finish() = 0; + virtual void getValue(long nCol, ScDPItemData& rData, short& rNumType) const = 0; + }; + private: ScDocument* mpDoc; @@ -148,7 +156,7 @@ public: const ItemsType& GetDimMemberValues( SCCOL nDim ) const; bool InitFromDoc(ScDocument* pDoc, const ScRange& rRange); - bool InitFromDataBase(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate); + bool InitFromDataBase(DBConnector& rDB); SCROW GetRowCount() const; SCROW GetItemDataId( sal_uInt16 nDim, SCROW nRow, bool bRepeatIfEmpty ) const; |