I've found what's matter, but I don't understand why ?

I've tried to 
use the sqlite3_mprintf() to prepare my sql.
If my numeric fValue is 
integer the SQL works fine, but if I've got a floating value the sql 
doesn't update the table.
And the bad is that I can get any error!!!!

I'll try to explain me better using a part of my code.

int iLow, 
iHigh;
long int liValue;
float fValue;
char *zSQL;
int Address;
int 
Port;

liValue = iHigh*256 + iLow;
fValue = my_custom_function
(liValue);

// If I uncomment the follow row the code works fine
// 
fValue = liValue;

zSQL = sqlite3_mprintf("UPDATE inputai SET Value=%.
2f, Timestamp=%d WHERE Address=%d and PortNumber=%d;",fValue , Port, 
Address, Port);

rc = sqlite3_exec(db,zSql, NULL, NULL, &zErrMsg );
if( 
rc!=SQLITE_OK )
{
  fprintf(stderr, "SQL error: %s\n", zErrMsg);
  
sqlite3_free(zErrMsg);
  return(-1);
}

This function doesn't works!!! 
I can't update my values!!! 
BUT... if remove the comment and the 
program execute fValue=liValue; statement the table is updated !!!

??????

What's my mistake ??
Pierluigi

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to