MySQL 8.0.40
Source Code Documentation
utils.h
Go to the documentation of this file.
1#ifndef UTILS_INCLUDED
2#define UTILS_INCLUDED
3
4// Copyright (c) 2018, 2024, Oracle and/or its affiliates.
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License, version 2.0,
8// as published by the Free Software Foundation.
9//
10// This program is designed to work with certain software (including
11// but not limited to OpenSSL) that is licensed under separate terms,
12// as designated in a particular file or component or in included license
13// documentation. The authors of MySQL hereby grant you an additional
14// permission to link the program and your derivative works with the
15// separately licensed software that they have either included with
16// the program or referenced in the documentation.
17//
18// This program is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License, version 2.0, for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with this program; if not, write to the Free Software
25// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26
27#include <string>
28
29#include "mysql.h"
30
31/// Run a query and return one field in the result set from the first
32/// row and column.
33///
34/// @param mysql mysql handle
35/// @param query Query string
36/// @param column Column value
37/// @param str String object to store the rvalue
38///
39/// @retval True if fails to get the value, true otherwise.
40bool query_get_string(MYSQL *mysql, const char *query, int column,
41 std::string *str);
42
43/// Use stoi function to get the integer value from a string.
44///
45/// @param str String which may contain an integer or an alphanumeric
46/// string.
47///
48/// @retval Integer value corresponding to the contents of the string,
49/// if conversion is successful, or -1 if integer is out of
50/// range, or if the conversion fails.
51int get_int_val(const char *str);
52
53#endif // UTILS_INCLUDED
bool query_get_string(MYSQL *mysql, const char *query, int column, std::string *str)
Run a query and return one field in the result set from the first row and column.
Definition: utils.cc:39
int get_int_val(const char *str)
Use stoi function to get the integer value from a string.
Definition: utils.cc:70
static char * query
Definition: myisam_ftdump.cc:45
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1052
Definition: instrumented_condition_variable.h:32
Definition: mysql.h:299