Should I check for DB constraints in code or should I catch exceptions thrown by DB

前端 未结 8 452
别跟我提以往
别跟我提以往 2021-02-04 03:43

I have an application that saves data into a table called Jobs. The Jobs table has a column called Name which has a UNIQUE constraint. The Name column is not PRIMARY KEY. I wond

8条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-04 04:18

    Personally I'd catch the exception. It's much simpler and requires much less code.

提交回复
热议问题