MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
polyglot_session.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 MYSQLSHDK_SCRIPTING_POLYGLOT_OBJECTS_POLYGLOT_SESSION_H_
27#define MYSQLSHDK_SCRIPTING_POLYGLOT_OBJECTS_POLYGLOT_SESSION_H_
28
29#include <string>
30#include <vector>
31
36
37namespace shcore {
38namespace polyglot {
39
40class Session : public Object_bridge {
41 public:
42 explicit Session(const std::shared_ptr<jit_executor::db::ISession> &session);
43 ~Session() override = default;
44
45 std::string class_name() const override { return "Session"; }
46
47 //! Calls the named method with the given args
48 Value call(const std::string &name, const Argument_list &args) override;
49
50 std::shared_ptr<PolyResult> run_sql(const Argument_list &args);
51
52 void reset();
53
54 private:
55 static std::vector<std::string> m_methods;
56 std::shared_ptr<jit_executor::db::ISession> m_session;
57
58 std::vector<std::string> *methods() const override { return &m_methods; }
59};
60
61} // namespace polyglot
62} // namespace shcore
63
64#endif // MYSQLSHDK_SCRIPTING_POLYGLOT_OBJECTS_POLYGLOT_SESSION_H_
Definition: polyglot_object_bridge.h:38
Definition: polyglot_session.h:40
std::shared_ptr< jit_executor::db::ISession > m_session
Definition: polyglot_session.h:56
std::vector< std::string > * methods() const override
Definition: polyglot_session.h:58
~Session() override=default
std::shared_ptr< PolyResult > run_sql(const Argument_list &args)
Definition: polyglot_session.cc:110
std::string class_name() const override
Definition: polyglot_session.h:45
Value call(const std::string &name, const Argument_list &args) override
Calls the named method with the given args.
Definition: polyglot_session.cc:100
void reset()
Definition: polyglot_session.cc:108
Session(const std::shared_ptr< jit_executor::db::ISession > &session)
Definition: polyglot_session.cc:96
static std::vector< std::string > m_methods
Definition: polyglot_session.h:55
Definition: file_system_exceptions.h:34
std::vector< Value > Argument_list
Definition: jit_executor_value.h:429
Pointer to a function that may be implemented in any language.
Definition: jit_executor_value.h:130