MySQL Forums
Forum List  »  Connector/Arduino

Put SELECT result into a variable
Posted by: Silvio Pedretti
Date: December 26, 2015 02:12PM

Hello,

please help me with this (for me) big problem, I'm struggling trying to find a solution with no results.....

I have this part of code:

sprintf(query, SELECT_DATA);
my_conn.cmd_query(query);
column_names *cols = my_conn.get_columns();
Serial.println();
for (int f = 0; f < cols->num_fields; f++) {
Serial.print(cols->fields[f]->name);
if (f < cols->num_fields - 1)
Serial.print(',');
}
Serial.println();
row_values *row = NULL;
while (row = my_conn.get_next_row()) {
for (int f = 0; f < cols->num_fields; f++) {
Serial.print(row->values[f]);
if (f < cols->num_fields - 1)
Serial.print(',');
}
my_conn.free_row_buffer();
Serial.println();
}

It works, I can read from the serial monitor the results of the query, but I don't know how to put them into a variable...

any help is much appreciated...

thank you

Options: ReplyQuote


Subject
Views
Written By
Posted
Put SELECT result into a variable
965
December 26, 2015 02:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.