@@ -93,7 +93,7 @@ int64 Mysql_query_runner::run_query(
9393 std::string query, std::function<int64(const Row &)> *result_callback) {
9494 Mysql_query_runner copy (*this );
9595 copy.add_result_callback (result_callback);
96- int64 result = copy.run_query (query);
96+ const int64 result = copy.run_query (query);
9797 delete result_callback;
9898 copy.m_result_callbacks .clear ();
9999 return result;
@@ -113,7 +113,7 @@ int64 Mysql_query_runner::run_query(std::string query) {
113113 Message_type_error);
114114 return this ->report_message (message);
115115 }
116- uint64 result = this ->run_query_unguarded (query);
116+ const uint64 result = this ->run_query_unguarded (query);
117117 *m_is_processing = false ;
118118
119119 return result;
@@ -140,13 +140,13 @@ int64 Mysql_query_runner::run_query_unguarded(string query) {
140140 }
141141 }
142142
143- unsigned int columns = mysql_field_count (m_connection);
143+ const unsigned int columns = mysql_field_count (m_connection);
144144 Row *processed_row = new Row (results, columns, row);
145145
146146 vector<std::function<int64 (const Row &)> *>::reverse_iterator it;
147147 for (it = m_result_callbacks.rbegin (); it != m_result_callbacks.rend ();
148148 ++it) {
149- int64 callback_result = (**it)(*processed_row);
149+ const int64 callback_result = (**it)(*processed_row);
150150 if (callback_result != 0 ) {
151151 mysql_free_result (results);
152152 return callback_result;
@@ -176,7 +176,7 @@ int64 Mysql_query_runner::run_query_unguarded(string query) {
176176 break ;
177177 }
178178
179- unsigned int columns = mysql_field_count (m_connection);
179+ const unsigned int columns = mysql_field_count (m_connection);
180180 Row *processed_row = new Row (results, columns, row);
181181
182182 Warning_data warning (
@@ -199,7 +199,7 @@ int64 Mysql_query_runner::report_mysql_error() {
199199int64 Mysql_query_runner::report_message (Message_data &message) {
200200 for (auto it = m_message_callbacks.rbegin (); it != m_message_callbacks.rend ();
201201 it++) {
202- int64 callback_result = (*it->first )(message);
202+ const int64 callback_result = (*it->first )(message);
203203 if (callback_result < 0 ) {
204204 return 0 ;
205205 } else if (callback_result != 0 ) {
@@ -263,11 +263,11 @@ void Mysql_query_runner::append_escape_string(std::string *destination_string,
263263void Mysql_query_runner::append_escape_string (std::string *destination_string,
264264 const char *original,
265265 size_t original_length) {
266- size_t start_lenght = destination_string->size ();
267- size_t required_capacity = start_lenght + original_length * 2 + 1 ;
266+ const size_t start_lenght = destination_string->size ();
267+ const size_t required_capacity = start_lenght + original_length * 2 + 1 ;
268268 destination_string->resize (required_capacity);
269269
270- int length = mysql_real_escape_string_quote (
270+ const int length = mysql_real_escape_string_quote (
271271 m_connection, &((*destination_string)[0 ]) + start_lenght, original,
272272 (ulong)original_length, ' "' );
273273 destination_string->resize (start_lenght + length);
@@ -276,12 +276,12 @@ void Mysql_query_runner::append_escape_string(std::string *destination_string,
276276void Mysql_query_runner::append_hex_string (std::string *destination_string,
277277 const char *original,
278278 size_t original_length) {
279- size_t start_lenght = destination_string->size ();
280- size_t required_capacity = start_lenght + original_length * 2 + 1 ;
279+ const size_t start_lenght = destination_string->size ();
280+ const size_t required_capacity = start_lenght + original_length * 2 + 1 ;
281281 destination_string->resize (required_capacity);
282282
283- int length = mysql_hex_string (&((*destination_string)[ 0 ]) + start_lenght,
284- original, original_length);
283+ const int length = mysql_hex_string (
284+ &((*destination_string)[ 0 ]) + start_lenght, original, original_length);
285285 destination_string->resize (start_lenght + length);
286286}
287287
@@ -351,7 +351,7 @@ const char *Mysql_query_runner::Row::get_buffer(std::size_t index,
351351 start = m_buffer_starts[start_index];
352352 }
353353
354- std::size_t end = m_buffer_starts[index + 1 ];
354+ const std::size_t end = m_buffer_starts[index + 1 ];
355355 length = (end - start - 1 );
356356 return &m_buffer[start];
357357}
0 commit comments