Database – Preventing errors from input

Is it a good practice to fully delegate data validation to database engine constraints?

Validating data from an application does not prevent invalid insertion from another software (maybe written in another language by another team). Using database constraints can reduce the need to worry about invalid input data .

If you verify in both the database and the application, then maintenance becomes boring because you have to update the code of who knows how many applications there are, which increases the possibility of human error.

I just can’t see doing this, looking at the code of the free software project.

Where possible, it’s best to specify validation rules in the database, and use or write a framework to make these rules bubble up to your front end. ASP.NET dynamic data helps achieve this, and there are some Commercial libraries can make it easier.

This can be used for simple input validation (such as numbers or dates), or for related data subject to foreign keys.

In short, our idea is to define rules in one place (most of the time in the database), and use code in other layers to enforce these rules.

Is it a good practice to entrust data validation to the database engine constraints?

Validating data from an application does not prevent invalid insertion from another software (maybe written in another language by another team). Using database constraints can reduce the need to worry about invalid input data .

If you verify in both the database and the application, then maintenance becomes boring because you have to update the code of who knows how many applications there are, which increases the possibility of human error.

I just can’t see doing this, looking at the code of a free software project.

When possible, it’s better to Specify validation rules in the database, and use or write a framework to make these rules bubble up to your front end. ASP.NET dynamic data helps to achieve this, and there are some commercial libraries that can make it easier.

< /p>

This can be used for simple input validation (such as numbers or dates), and it can also be used for related data constrained by foreign keys.

In short, our idea is in one place (Most of the time in the database) define rules and use code in other layers to enforce these rules.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 268 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.