[Libreoffice-commits] core.git: 4 commits - connectivity/source
Andrzej J.R. Hunt
andrzej at ahunt.org
Tue Aug 13 14:20:27 PDT 2013
connectivity/source/drivers/firebird/Columns.cxx | 47 ++++++++++++++++++++++-
connectivity/source/drivers/firebird/Columns.hxx | 6 ++
connectivity/source/drivers/firebird/Table.cxx | 1
connectivity/source/drivers/firebird/Tables.cxx | 3 -
4 files changed, 53 insertions(+), 4 deletions(-)
New commits:
commit 73c02c20b19702dbe662fe0d80601049f015d8ac
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Tue Aug 13 17:42:20 2013 +0100
Set ColumnsHelper parent. (firebird-sdbc)
This is needed for accessing the Tables again.
Change-Id: Ibebc017228b9bb47aaabaa4787e4c05d530acccf
diff --git a/connectivity/source/drivers/firebird/Columns.cxx b/connectivity/source/drivers/firebird/Columns.cxx
index 7fd9aef4..fbf54e0 100644
--- a/connectivity/source/drivers/firebird/Columns.cxx
+++ b/connectivity/source/drivers/firebird/Columns.cxx
@@ -24,7 +24,7 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
-Columns::Columns(OWeakObject& rTable,
+Columns::Columns(Table& rTable,
Mutex& rMutex,
const TStringVector& rVector):
OColumnsHelper(rTable,
@@ -32,6 +32,7 @@ Columns::Columns(OWeakObject& rTable,
rMutex,
rVector)
{
+ OColumnsHelper::setParent(&rTable);
}
ObjectType Columns::createObject(const OUString& rColumnName)
diff --git a/connectivity/source/drivers/firebird/Columns.hxx b/connectivity/source/drivers/firebird/Columns.hxx
index 543bf12..dc006d1 100644
--- a/connectivity/source/drivers/firebird/Columns.hxx
+++ b/connectivity/source/drivers/firebird/Columns.hxx
@@ -21,7 +21,7 @@ namespace connectivity
class Columns: public ::connectivity::OColumnsHelper
{
public:
- Columns(::cppu::OWeakObject& rTable,
+ Columns(Table& rTable,
::osl::Mutex& rMutex,
const ::connectivity::TStringVector &_rVector);
commit 67a9e7b1a161e96924e2e08b648c513b1a9795e2
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Tue Aug 13 17:33:30 2013 +0100
OTableHelper requires a call to construct() to be usable. (firebird-sdbc)
Without this we get a UnknownPropertyException due to the relevant
properties not being set up.
Change-Id: I3fa956a4a82e411d7aba3895faf58b8a84f9fb5c
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index 7624eee..1cd9813 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -39,6 +39,7 @@ Table::Table(Tables* pTables,
""),
m_rMutex(rMutex)
{
+ OTableHelper::construct();
}
//----- OTableHelper ---------------------------------------------------------
commit 6e3118777b7f6cb4df5664df197ac026cca73c16
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Tue Aug 13 13:04:25 2013 +0100
Implement Columns::createObject. (firebird-sdbc)
Change-Id: I5750f640a9bd8bbfc40c0b7ed506d95e9cdbed0f
diff --git a/connectivity/source/drivers/firebird/Columns.cxx b/connectivity/source/drivers/firebird/Columns.cxx
index c1e7034..7fd9aef4 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 c49dbfa..543bf12 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
commit 3a50cb84f422046a84febcf6759938054f5e1ece
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Tue Aug 13 11:35:18 2013 +0100
Correct comments at table creation (firebird-sdbc)
Table name is already in correct form, and type is irrelevant when
selecting one table.
Change-Id: I542819cb09e083434ac84b84842d5ea9016c0d79
diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx
index 8828b97..0dbca85 100644
--- a/connectivity/source/drivers/firebird/Tables.cxx
+++ b/connectivity/source/drivers/firebird/Tables.cxx
@@ -48,8 +48,7 @@ void Tables::impl_refresh()
ObjectType Tables::createObject(const OUString& rName)
{
- // TODO: parse the name.
- // TODO: use table types
+ // Only retrieving a single table, so table type is irrelevant (param 4)
uno::Reference< XResultSet > xTables = m_xMetaData->getTables(Any(),
OUString(),
rName,
More information about the Libreoffice-commits
mailing list