Error with IBDAC Version 7.4.4: String Right Truncation

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
JHenze
Posts: 5
Joined: Fri 03 Sep 2021 13:09

Error with IBDAC Version 7.4.4: String Right Truncation

Post by JHenze » Fri 03 Sep 2021 13:15

When using the TIBCStoredProcedure with Firebird 3.0 and Delphi 10.4, we get the error mentioned.
We have set

Code: Select all

StoredProc.Options.DescribeParams:=TRUE;

but the error mentioned occurs when string parameters are passed that are longer than declared in the StoredProc.
Are there any further instructions on how to work around this error in general?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Error with IBDAC Version 7.4.4: String Right Truncation

Post by ViktorV » Fri 03 Sep 2021 13:34

Hi there,

In order to provide you with fast and correct reply please compose and send us small sample which demonstrates described behavior including scripts to create and fill-in database objects (or database file itself) using our contact form:
https://devart.com/company/contactform.html

Regards,
Viktor

JHenze
Posts: 5
Joined: Fri 03 Sep 2021 13:09

Re: Error with IBDAC Version 7.4.4: String Right Truncation

Post by JHenze » Fri 10 Sep 2021 05:52

I sent them a mini-example-Project. That's the answer from devArt:

...
We have investigated your case and got the following results:
The IBDAC behavior is correct, this error is returned by the server, because you are trying to insert a value that exceeds the field length.
You can verify this by trying to insert your values into a query without parameters.
For example:
IBCQuery.SQL.Add ('insert into country (country, currency) values (' 'AlicesWonderland' ',' 'GoldAndSilver' ')');
To solve this problem, you should insert values that will not exceed the length of the field.
Please feel free to reply to this email in case you have any additional questions or need any kind of additional instructions.
Best regards,
Viktor
Technical Support Engineer
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

In case you have any other question please let us know.

Best regards,
Victor
Devart Team
www.devart.com
Last edited by JHenze on Fri 10 Sep 2021 06:10, edited 3 times in total.

JHenze
Posts: 5
Joined: Fri 03 Sep 2021 13:09

Re: Error with IBDAC Version 7.4.4: String Right Truncation

Post by JHenze » Fri 10 Sep 2021 05:56

The annoying thing is that the devArt components up to versions before 7.3. have brought this functionality with them. If the transferred strings were too long, only the maximum possible length was used without raising an exception.

For us as developers, it is completely irrelevant whether the exception is generated in the devArt components or in the Firebird DLL.

The fact is that you have changed a fundamental way of working of your components. We're working on a project with several million lines of source code. It is not even possible to quickly adapt all the relevant points to this changed behavior.

The fact that you have introduced the parameter 'StoredProc.Options.DescribeParams' shows that you have seen this yourself. If this does not work as described, you need to make improvements. You can't pass the problem on to your customers!

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Error with IBDAC Version 7.4.4: String Right Truncation

Post by ViktorV » Fri 10 Sep 2021 10:53

Hi there,

We have changed this behavior based on requests from users, starting IBDAC 7.2.3 in order to fix critical bug, because such behavior could cause the risk of data corruption. The error should appear, otherwise this could lead to data corruption or data loss because in a sample provided by you, parameter values were cut-off in IBDAC 7.2.4.
Please note that such behavior is not normal for DBMS and data-access components.

Best regards,
Viktor

JHenze
Posts: 5
Joined: Fri 03 Sep 2021 13:09

Re: Error with IBDAC Version 7.4.4: String Right Truncation

Post by JHenze » Mon 13 Sep 2021 06:01

That is understandable and also completely acceptable. Appropriate precautions must then be taken for new developments so that lengths are not exceeded.

But once again my argument: If you change such a basic behavior, you have to offer a flag so that we can still force the old behavior as before. In a large project with several million lines of source text, it is not possible to change all the relevant places at short notice.

That is a fundamental question: Your customers install your components in the lowest application layer, i.e. in the foundation of a program. You can't change basic behavior without creating a way to continue to enforce the old behavior. That brings a complex software architecture to collapse.

Development systems such as Delphi shows the only acceptable way that can be shared by all developers: If a function or a behavior is to be changed, both options are available in parallel for a few versions with the note that the old behavior or the old function will no longer be available in the future. However, we developers then have enough time to adapt the relevant points to the new behavior over several versions (i.e. over a period of several months to a few years).

We have estimated several thousand queries and stored procs in use. We would now have to search for, analyze and adapt these multiple locations. A job for several developers over several weeks.
In contrast, there are exactly 2 places for you: in the code of the query and that of the stored proc. We are probably talking about 10 or 20 lines in your source code: once to query the flag and secondly to cut off strings that are too long when receiving or to pass the exception from the database DLL.

malmedin
Posts: 22
Joined: Fri 26 Mar 2010 19:52

Re: Error with IBDAC Version 7.4.4: String Right Truncation

Post by malmedin » Sat 18 Sep 2021 07:17

I had the same problem. My application just stopped working properly. I have seen in some other component suite a property like "TruncateStringParams". I think it's not too hard to implement it?

I am not quite sure about loosing data related bug? What is meant by that? Loosing truncated data or something else?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Error with IBDAC Version 7.4.4: String Right Truncation

Post by ViktorV » Mon 20 Sep 2021 11:12

Hi guys!

Thank you for your notes!
We have already added the global variable CutOffParams, which is declared in the IBCClasses.pas module. This variable has a default value of False. To return the old behavior, you should set it to True. For example:

Code: Select all

initialization 
  CutOffParams := True;
This addition will be included in the next release of IBDAC. We can send you a nightly build which includes this change. For this, please send us your license number and the version of the IDE you are using through the contact form:
https://devart.com/company/contactform.html
Please, let us know if you have any questions!

Best regards,
Viktor

JHenze
Posts: 5
Joined: Fri 03 Sep 2021 13:09

Re: Error with IBDAC Version 7.4.4: String Right Truncation

Post by JHenze » Wed 22 Sep 2021 06:45

Hi Viktor,

first of all, thank you very much for solving the problem raised. We will wait for the next official version/release.

But one question remains: What is the parameter Options.DescribeParams for?
I understood it to use this to control the automatic length correction granularly for each Query or StoredProc.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Error with IBDAC Version 7.4.4: String Right Truncation

Post by ViktorV » Fri 24 Sep 2021 14:16

Hi!

Thank you for your question and interest in our product!
Note that when using the DescribeParams property: https://www.devart.com/ibdac/docs/devar ... params.htm
the required data about the parameter (length, type, subtype, etc.) is obtained and used.
Feel free to ask in case of any further questions!

Thanks in advance,
Viktor

Post Reply