Dear All, I am using sqlite to store public key (PK), signature (Sig) and hashes generated by crypto++ library in a C++ program. I encode the PKs to base64 strings and then store them in the database. Later in my program, I want to update records of data by searching based on the PK, i.e.
*char* *zSQL = *sqlite3_mprintf*("UPDATE BC set Signature = null and PK = null where PK = '%q' ;", endoced_pub.c_str()); *sqlite3_prepare_v2*(db, zSQL, -1, &stmt, NULL); where BC is the name of my table and endoced_pub is the string containing the encoded PK. But, it does not find any match thus it does nothing :( I connect to the database and see the PK values. They exactly match with the PKs printed in the main program. Thus it should work. The only thing that comes to my mind is that when the database stores the PK , it does some other encodings on that, and thus it does not match with the key I send in update request. The PK is a BLOB type, i.e., sql = "CREATE TABLE BC(" \ "T_ID TEXT ," \ "P_T_ID TEXT ," \ "PK BLOB ," \ "Signature BLOB ," \ "Block_ID TEXT );"; I also used the prepare command to ensure that my command is encoded based on sqlite but it does not work. sqlite3_stmt *stmt; *char* *zSQL = *sqlite3_mprintf*("UPDATE BC set Signature = null and PK = null where PK = '%q' ;", endoced_pub.c_str()); *sqlite3_prepare_v2*(db, zSQL, -1, &stmt, NULL); rc = *sqlite3_step*(stmt); Here is how I store the PKs initially in database: *char* *zSQL = *sqlite3_mprintf*("INSERT INTO BC ( T_ID , P_T_ID , PK , Signature , Block_ID ) VALUES ('%q','%q','%q','%q','%q');", BC.trans[l]. TransactionID.c_str() ,BC.trans[l].previousTransactionID.c_str() ,BC.trans [l].PK.c_str() ,BC.trans[l].Sign.c_str(),BC.block_hash.c_str()); Any thoughts on how can I solve the issue? Regards Ali _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users