On 12/10/14 10:56, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
Based on above, the function update_record_puadb() should return without doing the db update if pres->etag.s is not set. It should end up in an insert if pres->etag.s is not set.
i'm not sure, since publ_cback_func() does make insert explicitly if record is not found. but it does not get that far, because for some reason, i see that this test succeeds:
if (pua_dbf.affected_rows != NULL || dbmode != PUA_DB_ONLY) { INFO("find_and_update_record\n"); if (find_and_update_record(hentity, hash_code, lexpire, &etag) > 0)
In the function of the above line is done an update with the etag not set and it shouldn't.
Either here the condition should be on hentity->etag.s being not null as well or the update_record_puadb() shoudl have its own safety check on etag (-- or even both for performance/safety).
goto done;
}
what query is pua_dbf.affected_rows here referring to?
That is a check to see if that database connector module implements affected_rows function -- not a check of a result of affected rows.
Daniel
i have not found in the function any db queries before the test.
-- juha