1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
11 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
15 #include <rtl/ustring.hxx>
17 #include <com/sun/star/sdbc/DataType.hpp>
18 #include <com/sun/star/sdbc/SQLException.hpp>
20 namespace connectivity
26 * Make sure an identifier is safe to use within the databse. Currently
27 * firebird seems to return identifiers with 93 character (instead of
28 * 31), whereby the name is simply padded with trailing whitespace.
29 * This removes all trailing whitespace (i.e. if necessary so that
30 * the length is below 31 characters). Firebird automatically compensates
31 * for such shorter strings, however any trailing padding makes the gui
32 * editing of such names harder, hence we remove all trailing whitespace.
34 OUString
sanitizeIdentifier(const OUString
& rIdentifier
);
36 inline bool IndicatesError(const ISC_STATUS_ARRAY
& rStatusVector
)
38 return rStatusVector
[0]==1 && rStatusVector
[1]; // indicates error;
41 OUString
StatusVectorToString(const ISC_STATUS_ARRAY
& rStatusVector
,
42 const OUString
& rCause
);
45 * Evaluate a firebird status vector and throw exceptions as necessary.
46 * The content of the status vector is included in the thrown exception.
48 void evaluateStatusVector(const ISC_STATUS_ARRAY
& rStatusVector
,
49 const ::rtl::OUString
& aCause
,
50 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& _rxContext
)
51 throw (::com::sun::star::sdbc::SQLException
);
53 sal_Int32
getColumnTypeFromFBType(short aType
);
54 ::rtl::OUString
getColumnTypeNameFromFBType(short aType
);
57 * Internally (i.e. in RDB$FIELD_TYPE) firebird stores the data type
58 * for a column as defined in blr_*, however in the firebird
59 * api the SQL_* types are used, hence we need to be able to convert
60 * between the two when retrieving column metadata.
62 short getFBTypeFromBlrType(short blrType
);
64 void mallocSQLVAR(XSQLDA
* pSqlda
);
66 void freeSQLVAR(XSQLDA
* pSqlda
);
69 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */