MySQL Forums
Forum List  »  Connector/Arduino

Re: Using parameters
Posted by: Noam Parness
Date: February 26, 2014 02:23PM

Peter -
If I understand correctly, you're trying to set up a MySQL INSERT statement that allows you to enter variables that you capture from some other part of the routine.

That sounds like what I'm doing with my setup. I have a "template" statement, with placeholders for the actual values. I then use sprintf to build a new string with the collected values inserted into the string.

The trick is turning the values (a combination of integers and long unsigned integers, in my case) into strings. I don't have my code handy right now, but I'm pretty sure I'm using sprintf to write the numerical values into an array of strings (technically it is a two-dimensional chacater array, I guess), and then using sprintf again to insert those strings into the "template" statement.

I'm sure that's overkill, but I had a lot of trouble getting it to work early on (which was caused by network issues I didn't realize I had), so I'd broken the process down into more steps to try and troubleshoot it.

Options: ReplyQuote

Written By
February 22, 2014 12:33AM
Re: Using parameters
February 26, 2014 02:23PM

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.