MySQL 9.0.0
Source Code Documentation
utils.cc File Reference
#include "client/mysqltest/utils.h"
#include <cstring>
#include <iostream>
#include <stdexcept>

Functions

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. More...
 
int get_int_val (const char *str)
 Use stoi function to get the integer value from a string. More...
 

Function Documentation

◆ get_int_val()

int get_int_val ( const char *  str)

Use stoi function to get the integer value from a string.

Parameters
strString which may contain an integer or an alphanumeric string.
Return values
Integervalue corresponding to the contents of the string, if conversion is successful, or -1 if integer is out of range, or if the conversion fails.

◆ query_get_string()

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.

Parameters
mysqlmysql handle
queryQuery string
columnColumn value
strString object to store the rvalue
Return values
Trueif fails to get the value, true otherwise.