bump product version to 7.2.5.1
[LibreOffice.git] / connectivity / source / drivers / mysqlc / mysqlc_resultsetmetadata.hxx
blobc2e5db5f337566d94045432ed7077da08e4e7929
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include "mysqlc_connection.hxx"
24 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
25 #include <com/sun/star/sdbc/XConnection.hpp>
26 #include <com/sun/star/sdbc/SQLException.hpp>
28 #include <cppuhelper/implbase1.hxx>
29 #include <mysql.h>
31 namespace connectivity::mysqlc
33 using ::com::sun::star::sdbc::SQLException;
34 using ::com::sun::star::uno::RuntimeException;
35 using ::com::sun::star::uno::RuntimeException;
37 struct MySqlFieldInfo
39 OUString columnName;
40 sal_Int32 length = 0;
41 sal_Int32 type = 0;
42 enum_field_types mysql_type = {};
43 unsigned charsetNumber = 0;
44 unsigned flags = 0;
45 OUString schemaName;
46 OUString tableName;
47 OUString catalogName;
48 sal_Int32 decimals;
49 sal_Int32 max_length;
52 //************ Class: ResultSetMetaData
54 typedef ::cppu::WeakImplHelper1<css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
56 class OResultSetMetaData final : public OResultSetMetaData_BASE
58 private:
59 OConnection& m_rConnection;
60 std::vector<MySqlFieldInfo> m_fields;
62 void checkColumnIndex(sal_Int32 columnIndex);
63 virtual ~OResultSetMetaData() override = default;
65 public:
66 OResultSetMetaData(OConnection& rConn, MYSQL_RES* pResult);
68 sal_Int32 SAL_CALL getColumnCount() override;
70 sal_Bool SAL_CALL isAutoIncrement(sal_Int32 column) override;
71 sal_Bool SAL_CALL isCaseSensitive(sal_Int32 column) override;
72 sal_Bool SAL_CALL isSearchable(sal_Int32 column) override;
73 sal_Bool SAL_CALL isCurrency(sal_Int32 column) override;
75 sal_Int32 SAL_CALL isNullable(sal_Int32 column) override;
77 sal_Bool SAL_CALL isSigned(sal_Int32 column) override;
79 sal_Int32 SAL_CALL getColumnDisplaySize(sal_Int32 column) override;
81 OUString SAL_CALL getColumnLabel(sal_Int32 column) override;
82 OUString SAL_CALL getColumnName(sal_Int32 column) override;
83 OUString SAL_CALL getSchemaName(sal_Int32 column) override;
85 sal_Int32 SAL_CALL getPrecision(sal_Int32 column) override;
86 sal_Int32 SAL_CALL getScale(sal_Int32 column) override;
88 OUString SAL_CALL getTableName(sal_Int32 column) override;
89 OUString SAL_CALL getCatalogName(sal_Int32 column) override;
91 sal_Int32 SAL_CALL getColumnType(sal_Int32 column) override;
93 OUString SAL_CALL getColumnTypeName(sal_Int32 column) override;
95 sal_Bool SAL_CALL isReadOnly(sal_Int32 column) override;
96 sal_Bool SAL_CALL isWritable(sal_Int32 column) override;
97 sal_Bool SAL_CALL isDefinitelyWritable(sal_Int32 column) override;
99 OUString SAL_CALL getColumnServiceName(sal_Int32 column) override;
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */