Mordred wrote:My database layer knows many things about the fields.
It is also possible to just hardcode the max lengths, but it will be a mess if you change the db structure often.
In my project that I am working on, it has a DBAL that currently works perfectly with SQL Server, Oracle, MaxDB, DB2 (IBM), MySQL (MySQLi supported), PostgreSQL, Firebird and SQLite. The only major DBMS I am missing is Sybase, because as far as I can see they are only offering paid database solutions so I am not able to develop it for my project. My project allows custom modules, and my project has its own SQL syntax called TriSQL which is SQL standard Except that it adds lots of extra syntax which most used is probably CREATE TABLE BUT DROP FIRST IF EXISTS.
So, keep tracking of column max values (or min) is impossible or am I missing something here? There are hundreds of modules creating and modifying the database and there's not much I can do about it (the truncation on DBAL -level).
So I guess my only choice is to either A) Truncate all data manually B) Leave the truncation for SQL server and check the limit and disallow further processing if limit exceeds some point.
If anyone got any other idea around this I would be happy to hear about it. =/