MySQL 8.3.0
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, 2023, 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 also distributed 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 included with MySQL.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License, version 2.0, for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25
26#include <string>
27
28#include "mysql.h"
29
30/// Run a query and return one field in the result set from the first
31/// row and column.
32///
33/// @param mysql mysql handle
34/// @param query Query string
35/// @param column Column value
36/// @param str String object to store the rvalue
37///
38/// @retval True if fails to get the value, true otherwise.
39bool query_get_string(MYSQL *mysql, const char *query, int column,
40 std::string *str);
41
42/// Use stoi function to get the integer value from a string.
43///
44/// @param str String which may contain an integer or an alphanumeric
45/// string.
46///
47/// @retval Integer value corresponding to the contents of the string,
48/// if conversion is successful, or -1 if integer is out of
49/// range, or if the conversion fails.
50int get_int_val(const char *str);
51
52#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:38
int get_int_val(const char *str)
Use stoi function to get the integer value from a string.
Definition: utils.cc:69
static char * query
Definition: myisam_ftdump.cc:46
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:1065
Definition: instrumented_condition_variable.h:31
Definition: mysql.h:297