Automatic truncation?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Automatic truncation?

Post by kaisellgren »

Hi,

MySQL will most likely truncate data when u pass too much data to a column that can't handle that much data. However, there are two problems:

1) Truncation attacks
2) What if the autotruncation is turned off?

Right now what I have been planning on doing is that I try to force the MySQL to be strict (aka not auto truncating), and truncate the data instead by myself. That would be truncation attack safe and well as non sql server settings dependant. Great! But not so great... it's painful to truncate data yourself. Is there any way to automate this truncation so I do not need to truncate every single data going to the DB T_T...

I have a DBAL, so I could possibly somehow implement it in it?

OR... I try to force the SQL to autotruncate on SQL server and protect from truncation attacks some other way - which way?? How to alternatively protect from it other than self truncating?
Post Reply