-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathmod_mysql_resultset.h
164 lines (151 loc) · 5.44 KB
/
mod_mysql_resultset.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
* Copyright (c) 2014, 2024, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
* as published by the Free Software Foundation.
*
* This program is designed to work with certain software (including
* but not limited to OpenSSL) that is licensed under separate terms,
* as designated in a particular file or component or in included license
* documentation. The authors of MySQL hereby grant you an additional
* permission to link the program and your derivative works with the
* separately licensed software that they have either included with
* the program or referenced in the documentation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License, version 2.0, for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// MySQL DB access module, for use by plugins and others
// For the module that implements interactive DB functionality see mod_db
#ifndef MODULES_MOD_MYSQL_RESULTSET_H_
#define MODULES_MOD_MYSQL_RESULTSET_H_
#include <list>
#include <memory>
#include <string>
#include <vector>
#include "modules/devapi/base_resultset.h"
#include "mysqlshdk/libs/db/mysql/result.h"
#include "mysqlshdk/libs/db/mysql/row.h"
#include "scripting/types.h"
#include "scripting/types_cpp.h"
namespace mysqlsh {
namespace mysql {
/**
* \ingroup ShellAPI
* $(CLASSICRESULT_BRIEF)
*
* $(CLASSICRESULT)
*/
class SHCORE_PUBLIC ClassicResult : public ShellBaseResult {
public:
#if DOXYGEN_JS
Integer affectedItemsCount; //!< Same as getAffectedItemsCount()
/**
* Same as getAffectedRowCount()
*
* @attention This property will be removed in a future release, use the
* <b>affectedItemsCount</b> property instead.
*/
Integer affectedRowCount;
Integer columnCount; //!< Same as getColumnCount()
List columnNames; //!< Same as getColumnNames()
List columns; //!< Same as getColumns()
String executionTime; //!< Same as getExecutionTime()
String info; //!< Same as getInfo()
Integer autoIncrementValue; //!< Same as getAutoIncrementValue()
List warnings; //!< Same as getWarnings()
/**
* Same as getWarningCount()
*
* @attention This property will be removed in a future release, use the
* <b>warningsCount</b> property instead.
*/
Integer warningCount;
Integer warningsCount; //!< Same as getWarningsCount()
Row fetchOne();
Dictionary fetchOneObject();
List fetchAll();
Integer getAffectedItemsCount();
Integer getAffectedRowCount();
Integer getColumnCount();
List getColumnNames();
List getColumns();
String getExecutionTime();
Bool hasData();
String getInfo();
Integer getAutoIncrementValue();
Integer getWarningCount();
Integer getWarningsCount();
List getWarnings();
Bool nextDataSet();
Bool nextResult();
#elif DOXYGEN_PY
int affected_items_count; //!< Same as get_affected_items_count()
/**
* Same as get_affected_row_count()
*
* @attention This property will be removed in a future release, use the
* <b>affected_items_count</b> property instead.
*/
int affected_row_count;
int column_count; //!< Same as get_column_count()
list column_names; //!< Same as get_column_names()
list columns; //!< Same as get_columns()
str execution_time; //!< Same as get_execution_time()
str info; //!< Same as get_info()
int auto_increment_value; //!< Same as get_auto_increment_value()
list warnings; //!< Same as get_warnings()
/**
* Same as get_warning_count()
*
* @attention This property will be removed in a future release, use the
* <b>warnings_count</b> property instead.
*/
int warning_count;
int warnings_count; //!< Same as get_warnings_count()
Row fetch_one();
dict fetch_one_object();
list fetch_all();
int get_affected_items_count();
int get_affected_row_count();
int get_column_count();
list get_column_names();
list get_columns();
str get_execution_time();
bool has_data();
str get_info();
int get_auto_increment_value();
int get_warning_count();
int get_warnings_count();
list get_warnings();
bool next_data_set();
bool next_result();
#endif
explicit ClassicResult(std::shared_ptr<mysqlshdk::db::mysql::Result> result);
std::string class_name() const override { return "ClassicResult"; }
shcore::Value get_member(const std::string &prop) const override;
void append_json(shcore::JSON_dumper &dumper) const override;
bool has_data() const override;
std::shared_ptr<Row> fetch_one() const;
shcore::Dictionary_t _fetch_one_object();
shcore::Array_t fetch_all() const;
bool next_data_set();
bool next_result();
mysqlshdk::db::IResult *get_result() const override { return _result.get(); }
private:
std::string get_protocol() const override { return "mysql"; }
const std::vector<mysqlshdk::db::Column> &get_metadata() const override {
return _result->get_metadata();
}
std::shared_ptr<mysqlshdk::db::mysql::Result> _result;
};
} // namespace mysql
} // namespace mysqlsh
#endif // MODULES_MOD_MYSQL_RESULTSET_H_