On 06-09-15 20:46, Petr L?z?ovsk? wrote:
> Thanks to all answers. Are principles of such script OK, or I miss something?
>
>
> set "_error="
> sqlite3.exe %db% BEGIN;
> for /f "tokens=2,3 delims=," %%a in (data.csv) do (
> sqlite3 %db% "INSERT INTO payments(id,amount) VALUES
> ('%%a','%%b')";
> if errorlevel 1 set "_error=y"
> )
> if not defined _error (
> sqlite3.exe %db% COMMIT;
> ) else (
> sqlite3.exe %db% ROLLBACK;
> call stop_perform_another_scheduled_writings.cmd
> call notify_admin_payment_writing_failed.cmd
> )
>
>
> L.
>
>
>
no, because this script:
sqlite3.exe %db% BEGIN;
sqlite3.exe %db% COMMIT;
will end with: "Error: cannot commit - no transaction is active"
Every time sqlite3.exe is started a new transaction will begin (and END wehn
sqlite3.exe stops)
while:
echo BEGIN; >file
echo COMMIT; >>file
cat file | sqlite3.exe %db%
works, creating 1 transaction.