>>Hi Andrus,
>>
>>> Unfortunately, if backend returns error as response to SQLEXEC(), VFP automatically sends ROLLBACK command to backend!
>>
>>How have you determined that VFP sends a ROLLBACK command? I'm asking, because I haven't seen this behavior yet, and I too, have code that first fails, picks an alternative and completes successfully.
>
>I turned logging ON in a PostgreSQL ODBC driver.
>In this case, all sql commands and their results are written to a log file.
>This log shows that after error, an extra ROLLBACK command is always sent to
>to Postgres.
>This ROLLBACK command is not generated by my application.
>
It is PostgreSQL ODBC driver that do this, not VFP.
The ODBC Driver BEGIN the transaction,
and where the server return a error,
it close the transaction with a ROLLBACK.
>Also, when I try to read the data added in this transaction, the data does not exist. So real rollback is done in backend.
>
>>Are you, by chance, disconnecting from the server? In this case, the following line might help:
>>
>>SQLSetProp( This.nHandle, "DisconnectRollback", .F. )
>>
>
You should set:
SQLSetProp( 0, "DisconnectRollback", .T. )
>I'm testing this in a developemnt computer connected to localhost.
>It is simple to create a code to reproduce this. This is always reproducible.