summaryrefslogtreecommitdiff
path: root/dbaccess/qa
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2022-03-23 21:14:46 +0100
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2022-03-25 13:37:57 +0100
commit4590048952a9e62124641c512dc2d19122f7fb2d (patch)
treea4e785d7b2c85907808cfaba49946aee0ae23929 /dbaccess/qa
parenta07e91a5a76546863ccf71462446e8d16d07d21b (diff)
tdf#132924 - Firebird findColumn: return column alias if specified
The function findColumn in a Basic macro should also find aliases for columns specified in an SQL query using a Firebird database. Change-Id: I96adb2564da1e18cee58f1c6803526d8ff4deabb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131990 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'dbaccess/qa')
-rw-r--r--dbaccess/qa/unit/data/tdf132924.odbbin0 -> 3148 bytes
-rw-r--r--dbaccess/qa/unit/firebird.cxx28
2 files changed, 28 insertions, 0 deletions
diff --git a/dbaccess/qa/unit/data/tdf132924.odb b/dbaccess/qa/unit/data/tdf132924.odb
new file mode 100644
index 000000000000..8cee7bcbabfd
--- /dev/null
+++ b/dbaccess/qa/unit/data/tdf132924.odb
Binary files differ
diff --git a/dbaccess/qa/unit/firebird.cxx b/dbaccess/qa/unit/firebird.cxx
index e67a4d10c097..7a8143810097 100644
--- a/dbaccess/qa/unit/firebird.cxx
+++ b/dbaccess/qa/unit/firebird.cxx
@@ -27,10 +27,12 @@ class FirebirdTest
public:
void testEmptyDBConnection();
void testIntegerDatabase();
+ void testTdf132924();
CPPUNIT_TEST_SUITE(FirebirdTest);
CPPUNIT_TEST(testEmptyDBConnection);
CPPUNIT_TEST(testIntegerDatabase);
+ CPPUNIT_TEST(testTdf132924);
CPPUNIT_TEST_SUITE_END();
};
@@ -90,6 +92,32 @@ void FirebirdTest::testIntegerDatabase()
closeDocument(uno::Reference<lang::XComponent>(xDocument, uno::UNO_QUERY));
}
+void FirebirdTest::testTdf132924()
+{
+ uno::Reference<XOfficeDatabaseDocument> xDocument = getDocumentForFileName(u"tdf132924.odb");
+ uno::Reference<XConnection> xConnection = getConnectionForDocument(xDocument);
+
+ uno::Reference<XStatement> xStatement = xConnection->createStatement();
+ CPPUNIT_ASSERT(xStatement.is());
+
+ uno::Reference<XResultSet> xResultSet = xStatement->executeQuery("SELECT * FROM AliasTest");
+ CPPUNIT_ASSERT(xResultSet.is());
+ CPPUNIT_ASSERT(xResultSet->next());
+
+ uno::Reference<XRow> xRow(xResultSet, UNO_QUERY);
+ CPPUNIT_ASSERT(xRow.is());
+ uno::Reference<XColumnLocate> xColumnLocate(xRow, UNO_QUERY);
+ CPPUNIT_ASSERT(xColumnLocate.is());
+
+ // Without the fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : The column name 'TestId' is not valid
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xRow->getShort(xColumnLocate->findColumn("TestId")));
+ CPPUNIT_ASSERT_EQUAL(OUString("TestName"), xRow->getString(xColumnLocate->findColumn("TestName")));
+
+ closeDocument(uno::Reference<lang::XComponent>(xDocument, uno::UNO_QUERY));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(FirebirdTest);
CPPUNIT_PLUGIN_IMPLEMENT();