Re: transaction and insert

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: jackchen88(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: transaction and insert
Date: 2019-07-17 19:31:26
Message-ID: CAKFQuwafx_Pio-LgS-+p8pv4oLG37zPuNO4vDvurcrSGvLo5kQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jul 17, 2019 at 12:24 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Vladimir Ryabtsev 2019-07-17 21:24:04 User mapping: view over a foreign table
Previous Message David G. Johnston 2019-07-17 19:24:43 Re: transaction and insert