MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
polyglot_row.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 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#ifndef ROUTER_SRC_JIT_EXECUTOR_SRC_OBJECTS_POLYGLOT_ROW_H_
27#define ROUTER_SRC_JIT_EXECUTOR_SRC_OBJECTS_POLYGLOT_ROW_H_
28
29#include <string>
30#include <vector>
31
35
36namespace shcore {
37namespace polyglot {
38
39class Row : public Object_bridge {
40 public:
41 Row(const std::vector<std::string> &names, const jit_executor::db::IRow &row);
42
43 std::string class_name() const override { return "Row"; }
44
45 shcore::Value get_field(const std::string &field) const;
46
47 bool has_member(const std::string &prop) const override;
48 shcore::Value get_member(const std::string &prop) const override;
49 shcore::Value get_member(size_t index) const override;
50
51 size_t length() const override { return m_value_array.size(); }
52 bool is_indexed() const override { return true; }
53
55
56 Value call(const std::string &name, const Argument_list &args) override;
57
58 private:
59 const std::vector<std::string> *methods() const override {
60 return &m_methods;
61 }
62 const std::vector<std::string> *properties() const override {
63 return &m_names;
64 }
65
66 static std::vector<std::string> m_methods;
67 std::vector<std::string> m_names;
68 std::vector<shcore::Value> m_value_array;
69};
70
71} // namespace polyglot
72} // namespace shcore
73
74#endif // ROUTER_SRC_JIT_EXECUTOR_SRC_OBJECTS_POLYGLOT_ROW_H_
Definition: jit_executor_db_interface.h:82
Definition: polyglot_object_bridge.h:38
Definition: polyglot_row.h:39
bool is_indexed() const override
Returns the value of a member.
Definition: polyglot_row.h:52
std::vector< std::string > m_names
Definition: polyglot_row.h:67
static std::vector< std::string > m_methods
Definition: polyglot_row.h:66
shcore::Value get_field(const std::string &field) const
Definition: polyglot_row.cc:145
bool has_member(const std::string &prop) const override
Verifies if the object has a member.
Definition: polyglot_row.cc:154
const std::vector< std::string > * methods() const override
Definition: polyglot_row.h:59
std::vector< shcore::Value > m_value_array
Definition: polyglot_row.h:68
Value call(const std::string &name, const Argument_list &args) override
Calls the named method with the given args.
Definition: polyglot_row.cc:170
size_t length() const override
Returns the number of indexable members.
Definition: polyglot_row.h:51
const std::vector< std::string > * properties() const override
Definition: polyglot_row.h:62
std::string class_name() const override
Definition: polyglot_row.h:43
shcore::Dictionary_t as_object()
Definition: polyglot_row.cc:135
Row(const std::vector< std::string > &names, const jit_executor::db::IRow &row)
Definition: polyglot_row.cc:127
shcore::Value get_member(const std::string &prop) const override
Returns the value of a member.
Definition: polyglot_row.cc:159
bool index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:75
Definition: file_system_exceptions.h:34
std::vector< Value > Argument_list
Definition: jit_executor_value.h:429
Value::Map_type_ref Dictionary_t
Definition: jit_executor_value.h:430
Pointer to a function that may be implemented in any language.
Definition: jit_executor_value.h:130