I am using MySQL C API.
Now I have some Double Typed data in C, and I want to insert them to a database.
All I know now is to use mysql_real_query() with a statement string to do this.
I am worrying about losing precision, since the process above involves double to string then to double. Is there a way to avoid this? Like sending double binary data directly to MySQL? I assume MySQL implements double the same as C does.
I am using MySQL C API. Now I have some Double Typed data in
Share
You should use a prepared statement with a placeholder for your
doubleand then you can bind adoublewithout converting anything to a string. Something like this:References:
mysql_stmt_initmysql_stmt_preparemysql_stmt_bind_param