Kaydet (Commit) 6cb1f56f authored tarafından Andrzej J.R. Hunt's avatar Andrzej J.R. Hunt

Implement sdbcx table creation. (firebird-sdbc)

Change-Id: I3d0de21a5fe10b64e21955f3384b95a96ac7561e
üst dc3eb678
...@@ -27,6 +27,17 @@ using namespace ::com::sun::star::container; ...@@ -27,6 +27,17 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno; 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, Table::Table(Tables* pTables,
Mutex& rMutex, Mutex& rMutex,
const uno::Reference< XConnection >& rConnection, const uno::Reference< XConnection >& rConnection,
......
...@@ -35,6 +35,9 @@ namespace connectivity ...@@ -35,6 +35,9 @@ namespace connectivity
::rtl::OUString getAlterTableColumn(const ::rtl::OUString& rColumn); ::rtl::OUString getAlterTableColumn(const ::rtl::OUString& rColumn);
public: public:
Table(Tables* pTables,
::osl::Mutex& rMutex,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
Table(Tables* pTables, Table(Tables* pTables,
::osl::Mutex& rMutex, ::osl::Mutex& rMutex,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include "Table.hxx" #include "Table.hxx"
#include "Tables.hxx" #include "Tables.hxx"
#include <connectivity/dbtools.hxx>
#include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XRow.hpp>
using namespace ::connectivity; using namespace ::connectivity;
...@@ -20,6 +22,7 @@ using namespace ::osl; ...@@ -20,6 +22,7 @@ using namespace ::osl;
using namespace ::rtl; using namespace ::rtl;
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container; using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbc;
...@@ -75,6 +78,24 @@ ObjectType Tables::createObject(const OUString& rName) ...@@ -75,6 +78,24 @@ ObjectType Tables::createObject(const OUString& rName)
return xRet; 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 ---------------------------------------------------------------- // //----- XDrop ----------------------------------------------------------------
// void SAL_CALL Tables::dropByName(const OUString& rName) // void SAL_CALL Tables::dropByName(const OUString& rName)
// throw (SQLException, NoSuchElementException, RuntimeException) // throw (SQLException, NoSuchElementException, RuntimeException)
......
...@@ -29,14 +29,19 @@ namespace connectivity ...@@ -29,14 +29,19 @@ namespace connectivity
::osl::Mutex& m_rMutex; ::osl::Mutex& m_rMutex;
protected: protected:
// OCollection: pure virtual functions requiring implementation ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >
m_xMetaData;
// OCollection
virtual void impl_refresh() virtual void impl_refresh()
throw(::com::sun::star::uno::RuntimeException); throw(::com::sun::star::uno::RuntimeException);
virtual ::connectivity::sdbcx::ObjectType createObject( virtual ::connectivity::sdbcx::ObjectType createObject(
const ::rtl::OUString& rName); const ::rtl::OUString& rName);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > createDescriptor();
m_xMetaData; virtual ::connectivity::sdbcx::ObjectType appendObject(
const OUString& rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rDescriptor);
public: public:
Tables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& rMetaData, Tables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& rMetaData,
......
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