Jump to content

Store sqlite database problem


Newbie89

Recommended Posts

Can some help me check and recorrect my code?

if (T_Time >= InTime){if (cal_count<60){printf("insert data till one minute\n");sprintf(sql_lite, "insert into Packet (Dated,Time,Src_MAC,Dest_MAC,Net_P,Trans_P,Src_IP, Dest_IP,Src_Port,Dest_Port,Cap_Bytes) values ('%s','%s','%s','%s','%s','%s','%s','%s','%ld','%l d','%ld');",DT, TM, Src_MAC, Dest_MAC, Net_P,Trans_P, Src_IP, Dest_IP, Src_Port, Dest_Port, Cap_Bytes);error = sqlite3_exec(conn, sql_lite, 0, 0, 0);cal_count=cal_count+1;}else{printf("update each one minute\n");sprintf(del_lite,"delete from Packet;");error = sqlite3_exec(conn, del_lite, 0, 0, 0);/*printf("Date=%s\tTime=%s\nSrc_MAC=%s\tDest MAC=%s\nNet_P=%s\tTrans_P=%s\nSrc_IP=%s\tDest_IP=% s\nSrc_Port=%ld\tDest_Port=%ld\nPacket Size=%ld\n", DT, TM, Src_MAC, Dest_MAC, Net_P,Trans_P, Src_IP, Dest_IP, Src_Port, Dest_Port, Cap_Bytes);*/sleep(1);}}elsebreak;
I try and found that something wrong in my code.In my code just for one minute to keep data.How do I keep data for each 1 minute? :Pleased:
Link to comment
Share on other sites

There's not enough code there to suggest anything to change. Your question is how to get your program to wait a minute to do something else? I assume you don't just want the program to sleep for that minute, correct?

Link to comment
Share on other sites

There's not enough code there to suggest anything to change. Your question is how to get your program to wait a minute to do something else? I assume you don't just want the program to sleep for that minute, correct?
Ya,I don't want the program to sleep for that minute.I want it perform repeatably like insert,delete,insert,delete...
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...