|Subject||Re: Issues with String Truncation error on insert (FB 2.1 64 bits windows server)|
What we are trying to achieve is to have a trigger that reads the size of each field and trims all insert sentences to the size of the field being inserted, and the reason is because the application receives the strings to insert on database from many different systems across the world and it is not aware of the current size of each field, the application's job is to receive data via internet and post it to the DB via insert command. So the App is doing what it was designed to do. The DB's fields size cannot be increased every time a new system across the world is connected to the application, and we cannot just increase field sizes to the maximum because it will slowdown the system's response. So we planned to use triggers to trim the input but it seems impossible. The alternative would be to let the App know the DB schema upfront, and deal with the issue at the App level, but we were under the impression the problem could be sorted via triggers, it appears it is not possible.
--- In firstname.lastname@example.org, Robert martin wrote:
> What about Helens suggestion to increase the field size. If you must
> have a max of 100 characters in the field, you could still increase the
> field size and then your trigger should work. Otherwise it sounds like
> you are cooked/deep fried !
> On 17/01/2013 2:21 p.m., fabianchocron wrote:
> > I have trouble understanding the following:
> > Are you saying that when the application posts the "insert statement"
> > into firebird's dll the size of the string contained in the insert
> > statment is measured by firebird's engine and that size is what is
> > being compared against the size of the field on the table? If that is
> > the case then I am cooked/fried.
> > The application is written in visual basic 6 and the insert in
> > executed multiple times without any issues until the contents of the
> > text inserted is larger than the field definition in Firebird, so what
> > I am trying to do is to "catch" the string before saved on the DB and
> > trim it to (field size - 1).
> > Do you think it could be any way to sort out the issue without
> > modifying and recompiling firebird engine?
> > Regards,
> > Fabian