// In parallel transactions and with transaction isolatoon level REPEATABLE READ it may be possible that the max id is already set by another transaction.
// Therefore run this in a try catch block just in case of a deadlock and increment the maxid in catch
// In a very very unikely case of race condition still the bonid can be created multiple times, but the unique primary key id is evidence that there is no
// intention in creating an invalid operation. Therefore also this comment is left in this source code!
$attempt=0;
$ok=false;
while(!$ok){
try{
$sql="INSERT INTO %operations% (id,typerange,bonid,processtype,handledintable,logtime,trans,sigcounter,tsesignature,pubkey,sigalg,serialno,certificate,signtxt,tseerror,terminalid) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";