diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-13 13:04:25 +0100 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-13 22:12:40 +0100 |
commit | 6e3118777b7f6cb4df5664df197ac026cca73c16 (patch) | |
tree | 1873a02981a921f6005ac22ba750b731d8c9944e /connectivity | |
parent | 3a50cb84f422046a84febcf6759938054f5e1ece (diff) |
Implement Columns::createObject. (firebird-sdbc)
Change-Id: I5750f640a9bd8bbfc40c0b7ed506d95e9cdbed0f
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/firebird/Columns.cxx | 44 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Columns.hxx | 4 |
2 files changed, 48 insertions, 0 deletions
diff --git a/connectivity/source/drivers/firebird/Columns.cxx b/connectivity/source/drivers/firebird/Columns.cxx index c1e70342690b..7fd9aef4baed 100644 --- a/connectivity/source/drivers/firebird/Columns.cxx +++ b/connectivity/source/drivers/firebird/Columns.cxx @@ -9,12 +9,21 @@ #include "Columns.hxx" +#include <connectivity/sdbcx/VColumn.hxx> + +#include <com/sun/star/sdbc/XRow.hpp> + using namespace ::connectivity; using namespace ::connectivity::firebird; +using namespace ::connectivity::sdbcx; using namespace ::cppu; using namespace ::osl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::uno; + Columns::Columns(OWeakObject& rTable, Mutex& rMutex, const TStringVector& rVector): @@ -25,5 +34,40 @@ Columns::Columns(OWeakObject& rTable, { } +ObjectType Columns::createObject(const OUString& rColumnName) +{ + uno::Reference< XResultSet > xColumns = m_pTable->getConnection()->getMetaData()->getColumns( + Any(), + "", + m_pTable->getName(), + rColumnName); + + uno::Reference< XRow > xRow(xColumns, UNO_QUERY); + + if(!xColumns.is() || !xRow.is() || !xColumns->next()) + throw RuntimeException(); + + ObjectType xColumn(new OColumn(rColumnName, // Name + xRow->getString(6), // Type Name + xRow->getString(13), // Default Value + xRow->getString(12), // Description + xRow->getInt(11), // Nullable + xRow->getInt(7), // Precision + xRow->getInt(9), // Scale + xRow->getInt(5), // Type + sal_False, // TODO: AutoIncrement + // Might need a call to getTypes to determine autoincrement + sal_False, // TODO: IsRowVersion? + sal_False, // IsCurrency -- same as autoincrement + sal_True, // Case sensitivity: yes + "", + "", + m_pTable->getName())); + + if (xColumns->next()) + throw RuntimeException(); // There should only be one column retrieved + + return xColumn; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/connectivity/source/drivers/firebird/Columns.hxx b/connectivity/source/drivers/firebird/Columns.hxx index c49dbfa5ae90..543bf12ffafb 100644 --- a/connectivity/source/drivers/firebird/Columns.hxx +++ b/connectivity/source/drivers/firebird/Columns.hxx @@ -24,6 +24,10 @@ namespace connectivity Columns(::cppu::OWeakObject& rTable, ::osl::Mutex& rMutex, const ::connectivity::TStringVector &_rVector); + + // OColumnsHelper + virtual ::connectivity::sdbcx::ObjectType createObject( + const ::rtl::OUString& rName); }; } // namespace firebird |