ChuckBell / MySQL_Connector_Arduino

Database connector library for using MySQL with your Arduino projects.
332 stars 133 forks source link

how can i execute a procedure? #49

Closed fgaliazzo closed 6 years ago

fgaliazzo commented 6 years ago

Hi,

i need execute this procedure

char INSERT_SQL[] = "CALL inserirMedicao(%d,&f, @output)"; sprintf(buffer, INSERT_SQL, vDisp,vValorDb);

MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn); cur_mem->execute(INSERT_SQL); delete cur_mem;

and read the output @output.

how can i do this?

tks

ChuckBell commented 6 years ago

First, you need to read the documentation and examples for how to use floating point numbers with sprintf(). Hint: you need to use dtostrf() as demonstrated in complex_insert.

Second, the connector does not fully support procedures with out parameters. What you will need to do is use a function. This will allow you to return the value from the function. But I wonder why you want to use a procedure. It would be helpful to see the procedure in context.

Please post your procedure and I'll try to suggest an alternative/workaround.

fgaliazzo commented 6 years ago

hi, ChuckBell

i studied more procedures and functions and i resolved my problem.

thank you for you support and tips.