MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
row.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017, 2025, Oracle and/or its affiliates.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2.0,
6 * as published by the Free Software Foundation.
7 *
8 * This program is designed to work with certain software (including
9 * but not limited to OpenSSL) that is licensed under separate terms,
10 * as designated in a particular file or component or in included license
11 * documentation. The authors of MySQL hereby grant you an additional
12 * permission to link the program and your derivative works with the
13 * separately licensed software that they have either included with
14 * the program or referenced in the documentation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
19 * the GNU General Public License, version 2.0, for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26// MySQL DB access module, for use by plugins and others
27// For the module that implements interactive DB functionality see mod_db
28
29#ifndef ROUTER_SRC_JIT_EXECUTOR_SRC_DATABASE_ROW_H_
30#define ROUTER_SRC_JIT_EXECUTOR_SRC_DATABASE_ROW_H_
31
32#include <map>
33#include <set>
34#include <vector>
35
36#include "database/column.h"
37#include "database/row.h"
39
40#include <mysql.h>
41#include <memory>
42#include <stdexcept>
43
44namespace shcore {
45namespace polyglot {
46namespace database {
47
48class bad_field : public std::invalid_argument {
49 public:
50 bad_field(const char *msg, uint32_t index)
51 : std::invalid_argument(msg), field(index) {}
52 uint32_t field;
53};
54
55class DbResult;
57 public:
58 Row(const Row &) = delete;
59 void operator=(const Row &) = delete;
60
61 uint32_t num_fields() const override;
62
63 Type get_type(uint32_t index) const override;
64 bool is_null(uint32_t index) const override;
65 std::string get_as_string(uint32_t index) const override;
66
67 std::string get_string(uint32_t index) const override;
68 std::wstring get_wstring(uint32_t index) const override;
69 int64_t get_int(uint32_t index) const override;
70 uint64_t get_uint(uint32_t index) const override;
71 float get_float(uint32_t index) const override;
72 double get_double(uint32_t index) const override;
73 std::pair<const char *, size_t> get_string_data(
74 uint32_t index) const override;
75 void get_raw_data(uint32_t index, const char **out_data,
76 size_t *out_size) const override;
77 std::tuple<uint64_t, int> get_bit(uint32_t index) const override;
78
79 inline void reset(MYSQL_ROW row, const unsigned long *lengths) {
80 _row = row;
82 }
83
84 private:
85 friend class DbResult;
86 explicit Row(DbResult *result);
87 Row(DbResult *result, MYSQL_ROW row, const unsigned long *lengths);
88
91 const unsigned long *_lengths;
92 uint32_t m_num_fields;
93};
94
95} // namespace database
96} // namespace polyglot
97} // namespace shcore
98#endif // ROUTER_SRC_JIT_EXECUTOR_SRC_DATABASE_ROW_H_
Definition: jit_executor_db_interface.h:82
void get_raw_data(uint32_t index, const char **out_data, size_t *out_size) const override
Definition: row.cc:215
const unsigned long * _lengths
Definition: row.h:91
float get_float(uint32_t index) const override
Definition: row.cc:222
void operator=(const Row &)=delete
std::string get_as_string(uint32_t index) const override
Definition: row.cc:139
std::pair< const char *, size_t > get_string_data(uint32_t index) const override
Definition: row.cc:210
std::string get_string(uint32_t index) const override
Definition: row.cc:198
double get_double(uint32_t index) const override
Definition: row.cc:234
bool is_null(uint32_t index) const override
Definition: row.cc:126
int64_t get_int(uint32_t index) const override
Definition: row.cc:154
uint32_t m_num_fields
Definition: row.h:92
void reset(MYSQL_ROW row, const unsigned long *lengths)
Definition: row.h:79
Type get_type(uint32_t index) const override
Definition: row.cc:134
MYSQL_ROW _row
Definition: row.h:90
uint32_t num_fields() const override
Definition: row.cc:132
uint64_t get_uint(uint32_t index) const override
Definition: row.cc:178
std::wstring get_wstring(uint32_t index) const override
Definition: row.cc:204
std::tuple< uint64_t, int > get_bit(uint32_t index) const override
Definition: row.cc:246
DbResult & _result
Definition: row.h:89
uint32_t field
Definition: row.h:52
bad_field(const char *msg, uint32_t index)
Definition: row.h:50
mrs::interface::RestHandler::HttpResult::Type Type
Definition: handler_content_file.cc:42
static uint lengths[256]
Definition: myisam_ftdump.cc:48
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
char ** MYSQL_ROW
Definition: mysql.h:145
bool index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:75
Definition: file_system_exceptions.h:34
Definition: gcs_xcom_synode.h:64
Definition: result.h:30