table doesnt update if inserting values from c++ connection
Posted by: r p
Date: April 07, 2011 06:45PM

I have a c++ prog inserting values from modbus to the mysql table.
Everything was working find and suddenly mysql started acting in a weird way.

Now if i use command line to insert the value in to the table it works fine and i can see the value being inserted to the table

but if i use my c program to transfer the data to the mysql table it doesnt update at all i tried reboot mysql server, reboot whole system, new table new database
everything but somehow it doesnt update the table from the c program.

my code for c++ is as below


//snip
ret = Opendb(pc,user,pass,db);
        printf("opendb = %d\n",ret);
        sprintf(command,"Insert into meter (Power) values (%f);",i);
       // printf("command = %s\n",command);
        ret = Insertdb(command);
        printf("Insertdb = %d\n",ret);
//snip

bool Insertdb(char *insert)
{
    if(mysql_query(conn, insert))
    {
        fprintf(stderr, "%s\n",mysql_error(conn));
        return 0;
    }
    else return 1;

above code works fine and returns 1 every time its being called so it is calling out the mysql server the way it should. but somehow when i check the server from the command line i dont see any value been inserted into the table. so even the c prog runs good table in mysql doesnt receive any updates somehow. pls pls help

Options: ReplyQuote


Subject
Views
Written By
Posted
table doesnt update if inserting values from c++ connection
1549
r p
April 07, 2011 06:45PM


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.