@
@
@insighter2019-12-18 19:17:32
Database
@insighter, 2019-12-18 19:17:32

Do transactions affect the execution of prepared queries?

The correctness of the request will be affected if it will be prepared in one transaction, and will be called in another.
Schematically like this:

sql = 'UPDATE customer SET field = :field WHERE id = :id';
query.SQL = sql;
query.Prepare;


// выполняем блок ниже в цикле по массиву переданных ИДов
for ...
  startTransaction();
  try
    ...
    query.Param['id'] = ...
    query.Param['field'] = ...
    query.Exec();
    commitTransaction();
  except
    rollbackTransaction();
    raise;
  end;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question