summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-22 17:47:38 +0200
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-22 18:03:29 +0200
commit7ae8da726747ce661dcd223b864d819f8b207819 (patch)
tree97acfd3fe35aac11bbf65d25af3ca375819c1dcd /connectivity
parentcd30d13c3d99bf8152dffec152fe3eecd6f4d406 (diff)
Further minor fixes (firebird-sdbc).
Change-Id: I1ed77e7910bd59aa0534ff7fb32d96e3432b58d3
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/FDatabaseMetaData.cxx24
-rw-r--r--connectivity/source/drivers/firebird/FStatement.cxx5
2 files changed, 18 insertions, 11 deletions
diff --git a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
index bad5ad611801..c2dde744f264 100644
--- a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
@@ -245,7 +245,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException,
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
{
- return sal_False;
+ return sal_True;
}
// -------------------------------------------------------------------------
OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException)
@@ -921,10 +921,12 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
while( rs->next() )
{
- ODatabaseMetaDataResultSet::ORow aCurrentRow(16);
+ ODatabaseMetaDataResultSet::ORow aCurrentRow(18);
- // 1. TABLE_CAT (catalog) may be null -- thus we omit it.
- // 2. TABLE_SCHEM (schema) may be null -- thus we omit it.
+ // 1. TABLE_CAT (catalog) may be null
+ aCurrentRow.push_back(new ORowSetValueDecorator());
+ // 2. TABLE_SCHEM (schema) may be null
+ aCurrentRow.push_back(new ORowSetValueDecorator());
// 3. TABLE_NAME
{
OUString aTableName = xRow->getString(1);
@@ -989,23 +991,25 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
}
// 12. Comments -- may be omitted
{
+ OUString aDescription;
uno::Reference< XBlob > xDescriptionBlob = xRow->getBlob(3);
if (xDescriptionBlob.is())
{
sal_Int32 aBlobLength = (sal_Int32) xDescriptionBlob->length();
- OUString aDescription = OUString((char*) xDescriptionBlob->getBytes(0, aBlobLength).getArray(),
+ aDescription = OUString((char*) xDescriptionBlob->getBytes(0, aBlobLength).getArray(),
aBlobLength,
RTL_TEXTENCODING_UTF8);
- aCurrentRow.push_back(new ORowSetValueDecorator(aDescription));
}
+ aCurrentRow.push_back(new ORowSetValueDecorator(aDescription));
}
// 13. Default -- may be omitted.
{
uno::Reference< XBlob > xDefaultValueBlob = xRow->getBlob(4);
if (xDefaultValueBlob.is())
{
- // TODO: push to back
+ // TODO: Implement
}
+ aCurrentRow.push_back(new ORowSetValueDecorator());
}
// 14. Unused
aCurrentRow.push_back(new ORowSetValueDecorator());
@@ -1024,10 +1028,12 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
{
aCurrentRow.push_back(new ORowSetValueDecorator(sal_Int32(0)));
}
- // 17. Index in column
+ // 17. Index of column
{
short aColumnNumber = xRow->getShort(5);
- aCurrentRow.push_back(new ORowSetValueDecorator(aColumnNumber));
+ // Firebird stores column numbers beginning with 0 internally
+ // SDBC expects column numbering to begin with 1.
+ aCurrentRow.push_back(new ORowSetValueDecorator(aColumnNumber + 1));
}
// 18. Is nullable
if (xRow->getShort(9))
diff --git a/connectivity/source/drivers/firebird/FStatement.cxx b/connectivity/source/drivers/firebird/FStatement.cxx
index 721a8876f9e7..c2207004437e 100644
--- a/connectivity/source/drivers/firebird/FStatement.cxx
+++ b/connectivity/source/drivers/firebird/FStatement.cxx
@@ -340,10 +340,10 @@ uno::Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery(const OUStri
return m_xResultSet;
}
-sal_Bool SAL_CALL OStatement_Base::execute(const OUString& sql) throw(SQLException, RuntimeException)
+sal_Bool SAL_CALL OStatement_Base::execute(const OUString& sqlIn) throw(SQLException, RuntimeException)
{
SAL_INFO("connectivity.firebird", "executeQuery(). "
- "Got called with sql: " << sql);
+ "Got called with sql: " << sqlIn);
MutexGuard aGuard(m_pConnection->getMutex());
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
@@ -352,6 +352,7 @@ sal_Bool SAL_CALL OStatement_Base::execute(const OUString& sql) throw(SQLExcepti
isc_stmt_handle aStatementHandle = 0;
int aErr = 0;
+ const OUString sql = sanitizeSqlString(sqlIn);
aErr = prepareAndDescribeStatement(sql,
aStatementHandle,