Sugar 5.1 supports "strict mode" in MySQL

sugarcrmdevelopers —  July 31, 2008 — Leave a comment

Strict mode is a mode where at least one of STRICT_TRANS_TABLES or STRICT_ALL_TABLES is enabled.

Enabling strict mode can increase data integrity. How? In a nutshell, when strict mode validates inputed and reports errors for invalid data and does not allow the invalid data to be written to the database.

Examples of invalid data that can be handled by strict mode:

1) If you try to insert a 50-character value into 40-character field, in non-strict mode the excess characters will be truncated and the insert will succeed. With strict mode, MySQL returns an error and the insert fails.

2) The date field in mysql is internally stored as a string, which means that invalid dates can be inserted in non-strict mode, and you will see errors only when you try to render the data. With strict mode, again, MySQL returns an error and the insert fails.

The above are examples for just two data types. There are may be several other conditions associated with each data type.

For more detailed and technical information about enabling strict mode in MySQL, read the page on SQL Modes in the MySQL website.

No Comments

Be the first to start the conversation!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s