MXS-1703 Rename typedefs in preparation for more changes

Also moved some code around.
This commit is contained in:
Esa Korhonen
2018-04-06 14:35:13 +03:00
parent 71004a0ebc
commit 8b642dbb5e
7 changed files with 86 additions and 130 deletions

View File

@ -29,10 +29,7 @@
}\
} while (false)
using std::string;
typedef std::vector<string> StringVector;
typedef std::vector<MXS_MONITORED_SERVER*> ServerVector;
typedef std::vector<MXS_MONITORED_SERVER*> MonServerArray;
extern const int64_t SERVER_ID_UNKNOWN;
@ -44,25 +41,13 @@ extern const int64_t SERVER_ID_UNKNOWN;
*/
int64_t scan_server_id(const char* id_string);
/**
* Query one row of results, save strings to array. Any additional rows are ignored.
*
* @param database The database to query.
* @param query The query to execute.
* @param expected_cols How many columns the result should have.
* @param output The output array to populate.
* @return True on success.
*/
bool query_one_row(MXS_MONITORED_SERVER *database, const char* query, unsigned int expected_cols,
StringVector* output);
/**
* Get MariaDB connection error strings from all the given servers, form one string.
*
* @param slaves Servers with errors
* @return Concatenated string.
*/
string get_connection_errors(const ServerVector& servers);
std::string get_connection_errors(const MonServerArray& servers);
/**
* Generates a list of server names separated by ', '
@ -70,7 +55,7 @@ string get_connection_errors(const ServerVector& servers);
* @param array The servers
* @return Server names
*/
string monitored_servers_to_string(const ServerVector& array);
std::string monitored_servers_to_string(const MonServerArray& array);
/**
* Helper class for simplifying working with resultsets. Used in MariaDBServer.
@ -112,7 +97,7 @@ public:
* @param col_name Column name
* @return Index or -1 if not found.
*/
int64_t get_col_index(const string& col_name) const;
int64_t get_col_index(const std::string& col_name) const;
/**
* Read a string value from the current row and given column. Empty string and (null) are both interpreted
@ -121,7 +106,7 @@ public:
* @param column_ind Column index
* @return Value as string
*/
string get_string(int64_t column_ind) const;
std::string get_string(int64_t column_ind) const;
/**
* Read a non-negative integer value from the current row and given column.
@ -141,7 +126,7 @@ public:
private:
MYSQL_RES* m_resultset; // Underlying result set, freed at dtor.
std::tr1::unordered_map<string, int64_t> m_col_indexes; // Map of column name -> index
std::tr1::unordered_map<std::string, int64_t> m_col_indexes; // Map of column name -> index
int64_t m_columns; // How many columns does the data have. Usually equal to column index map size.
MYSQL_ROW m_rowdata; // Data for current row
int64_t m_current_row; // Index of current row