summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-08-15 10:51:57 +0100
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2013-08-15 20:31:14 +0100
commit6cb1f56fced634e0692c82cd9b2c7d240a32c14b (patch)
tree1d94eef3dcf60635b88e1864709ff598d465e8b1 /connectivity
parentdc3eb6785dea352ae4928c5bbc3915ddf29c1c53 (diff)
Implement sdbcx table creation. (firebird-sdbc)
Change-Id: I3d0de21a5fe10b64e21955f3384b95a96ac7561e
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/Table.cxx11
-rw-r--r--connectivity/source/drivers/firebird/Table.hxx3
-rw-r--r--connectivity/source/drivers/firebird/Tables.cxx21
-rw-r--r--connectivity/source/drivers/firebird/Tables.hxx13
4 files changed, 44 insertions, 4 deletions
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index 38b0bcb13dbf..d32066f91d2b 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -29,6 +29,17 @@ using namespace ::com::sun::star::uno;
Table::Table(Tables* pTables,
Mutex& rMutex,
+ const uno::Reference< XConnection >& rConnection):
+ OTableHelper(pTables,
+ rConnection,
+ sal_True),
+ m_rMutex(rMutex)
+{
+ OTableHelper::construct();
+}
+
+Table::Table(Tables* pTables,
+ Mutex& rMutex,
const uno::Reference< XConnection >& rConnection,
const OUString& rName,
const OUString& rType,
diff --git a/connectivity/source/drivers/firebird/Table.hxx b/connectivity/source/drivers/firebird/Table.hxx
index ff9d183ec2ec..41f12c3f7eff 100644
--- a/connectivity/source/drivers/firebird/Table.hxx
+++ b/connectivity/source/drivers/firebird/Table.hxx
@@ -37,6 +37,9 @@ namespace connectivity
public:
Table(Tables* pTables,
::osl::Mutex& rMutex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
+ Table(Tables* pTables,
+ ::osl::Mutex& rMutex,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
const ::rtl::OUString& rName,
const ::rtl::OUString& rType,
diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx
index 0dbca8517129..52657038daf0 100644
--- a/connectivity/source/drivers/firebird/Tables.cxx
+++ b/connectivity/source/drivers/firebird/Tables.cxx
@@ -10,6 +10,8 @@
#include "Table.hxx"
#include "Tables.hxx"
+#include <connectivity/dbtools.hxx>
+
#include <com/sun/star/sdbc/XRow.hpp>
using namespace ::connectivity;
@@ -20,6 +22,7 @@ using namespace ::osl;
using namespace ::rtl;
using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
@@ -75,6 +78,24 @@ ObjectType Tables::createObject(const OUString& rName)
return xRet;
}
+uno::Reference< XPropertySet > Tables::createDescriptor()
+{
+ // There is some internal magic so that the same class can be used as either
+ // a descriptor or as a normal table. See VTable.cxx for the details. In our
+ // case we just need to ensure we use the correct constructor.
+ return new Table(this, m_rMutex, m_xMetaData->getConnection());
+}
+
+//----- XAppend ---------------------------------------------------------------
+ObjectType Tables::appendObject(const OUString& rName,
+ const uno::Reference< XPropertySet >& rDescriptor)
+{
+ OUString sSql(::dbtools::createSqlCreateTableStatement(rDescriptor,
+ m_xMetaData->getConnection()));
+ m_xMetaData->getConnection()->createStatement()->execute(sSql);
+
+ return createObject(rName);
+}
// //----- XDrop ----------------------------------------------------------------
// void SAL_CALL Tables::dropByName(const OUString& rName)
// throw (SQLException, NoSuchElementException, RuntimeException)
diff --git a/connectivity/source/drivers/firebird/Tables.hxx b/connectivity/source/drivers/firebird/Tables.hxx
index c025e1bf4b28..173d957158ef 100644
--- a/connectivity/source/drivers/firebird/Tables.hxx
+++ b/connectivity/source/drivers/firebird/Tables.hxx
@@ -29,14 +29,19 @@ namespace connectivity
::osl::Mutex& m_rMutex;
protected:
- // OCollection: pure virtual functions requiring implementation
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >
+ m_xMetaData;
+
+ // OCollection
virtual void impl_refresh()
throw(::com::sun::star::uno::RuntimeException);
virtual ::connectivity::sdbcx::ObjectType createObject(
const ::rtl::OUString& rName);
-
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >
- m_xMetaData;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ createDescriptor();
+ virtual ::connectivity::sdbcx::ObjectType appendObject(
+ const OUString& rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rDescriptor);
public:
Tables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& rMetaData,