update emoji autocorrect entries from po-files
[LibreOffice.git] / connectivity / source / drivers / firebird / Util.hxx
blobc04488f342d736b53c9abf90b6ffcdd87e945247
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 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
11 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
13 #include <ibase.h>
15 #include <rtl/ustring.hxx>
17 #include <com/sun/star/sdbc/DataType.hpp>
18 #include <com/sun/star/sdbc/SQLException.hpp>
20 namespace connectivity
22 namespace firebird
25 /**
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);
44 /**
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);
56 /**
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: */