fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / qa / unit / firebird.cxx
bloba8022c125f7ffd7d619601fe2c2549d85c549da9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include "dbtest_base.cxx"
12 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
13 #include <com/sun/star/sdbc/XColumnLocate.hpp>
14 #include <com/sun/star/sdbc/XConnection.hpp>
15 #include <com/sun/star/sdbc/XResultSet.hpp>
16 #include <com/sun/star/sdbc/XRow.hpp>
17 #include <com/sun/star/sdbc/XStatement.hpp>
18 #include <svtools/miscopt.hxx>
20 using namespace ::com::sun::star;
21 using namespace ::com::sun::star::sdb;
22 using namespace ::com::sun::star::sdbc;
23 using namespace ::com::sun::star::uno;
25 class FirebirdTest
26 : public DBTestBase
28 public:
29 void testEmptyDBConnection();
30 void testIntegerDatabase();
32 virtual void setUp() SAL_OVERRIDE;
34 CPPUNIT_TEST_SUITE(FirebirdTest);
35 CPPUNIT_TEST(testEmptyDBConnection);
36 CPPUNIT_TEST(testIntegerDatabase);
37 CPPUNIT_TEST_SUITE_END();
40 void FirebirdTest::setUp()
42 DBTestBase::setUp();
43 SvtMiscOptions aMiscOptions;
44 aMiscOptions.SetExperimentalMode(true);
47 /**
48 * Test the loading of an "empty" file, i.e. the embedded database has not yet
49 * been initialised (as occurs when a new .odb is created and opened by base).
51 void FirebirdTest::testEmptyDBConnection()
53 uno::Reference< XOfficeDatabaseDocument > xDocument =
54 getDocumentForFileName("firebird_empty.odb");
56 getConnectionForDocument(xDocument);
58 closeDocument(uno::Reference<lang::XComponent>(xDocument, uno::UNO_QUERY));
61 /**
62 * Test reading of integers from a known .odb to verify that the data
63 * can still be read on all systems.
65 void FirebirdTest::testIntegerDatabase()
67 uno::Reference< XOfficeDatabaseDocument > xDocument =
68 getDocumentForFileName("firebird_integer_x64le.odb");
70 uno::Reference< XConnection > xConnection =
71 getConnectionForDocument(xDocument);
73 uno::Reference< XStatement > xStatement = xConnection->createStatement();
74 CPPUNIT_ASSERT(xStatement.is());
76 uno::Reference< XResultSet > xResultSet = xStatement->executeQuery(
77 "SELECT * FROM TESTTABLE");
78 CPPUNIT_ASSERT(xResultSet.is());
79 CPPUNIT_ASSERT(xResultSet->next());
81 uno::Reference< XRow > xRow(xResultSet, UNO_QUERY);
82 CPPUNIT_ASSERT(xRow.is());
83 uno::Reference< XColumnLocate > xColumnLocate(xRow, UNO_QUERY);
84 CPPUNIT_ASSERT(xColumnLocate.is());
86 CPPUNIT_ASSERT(sal_Int16(-30000) ==
87 xRow->getShort(xColumnLocate->findColumn("_SMALLINT")));
88 CPPUNIT_ASSERT(sal_Int32(-2100000000) ==
89 xRow->getInt(xColumnLocate->findColumn("_INT")));
90 CPPUNIT_ASSERT(SAL_CONST_INT64(-9000000000000000000) ==
91 xRow->getLong(xColumnLocate->findColumn("_BIGINT")));
92 CPPUNIT_ASSERT("5" ==
93 xRow->getString(xColumnLocate->findColumn("_CHAR")));
94 CPPUNIT_ASSERT("5" ==
95 xRow->getString(xColumnLocate->findColumn("_VARCHAR")));
97 CPPUNIT_ASSERT(!xResultSet->next()); // Should only be one row
99 closeDocument(uno::Reference<lang::XComponent>(xDocument, uno::UNO_QUERY));
102 CPPUNIT_TEST_SUITE_REGISTRATION(FirebirdTest);
104 CPPUNIT_PLUGIN_IMPLEMENT();
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */