Re: transaction and insert - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: transaction and insert
Date
Msg-id CAKFQuwafx_Pio-LgS-+p8pv4oLG37zPuNO4vDvurcrSGvLo5kQ@mail.gmail.com
Whole thread Raw
In response to Re: transaction and insert  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
On Wed, Jul 17, 2019 at 12:24 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
                                                rows = stmt.executeUpdate(sqlUpdateAddSubTotal + sqlInsertAddRecord);

Also, after solving your immediate concern you should learn about SQL Injection risks and using preparedStatement in Java to mitigate that risk.  The style you are using here is simply bad code.

That fact that you don't re-throw the SQLException is also bad (can't tell if that is mock-up code or live production, but given other observations I'm going to assume the later).

David J.

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: transaction and insert
Next
From: Vladimir Ryabtsev
Date:
Subject: User mapping: view over a foreign table