Recent

Author Topic: [solved] Invalid float entry in DB - Dataset buffer - how to configure?  (Read 693 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1095
There is a structure looking like this:

DBEdit
Datafield = EMISSIONSPREIS
DataSource = DataSource_EinAsset
IBQuery = IBQuery_EinAsset

Not sure, if it is important: There are a lot of data sensitive fields in this query / Frame.
To this very value I suddenly found an "invalid figure" in my database.

And sometimes I read there
"Dataset buffer is too small (4) to receive the data from Field ...."

What does this mean!?

Although it is years ago, that I migrated from Delphi, (what I am grateful for!), I miss something:
There exists an editor for datafields. In this very editor I could check the type of the input, which was e.g. integer or float or "computed". This I would like to control. I do not see such options in FP. Are they not there or is it me who cannot find them?

My question:
Please hint me, how to key in my value in DBEdit without buffer error.
Thanks.


Thank you for all answers.
The topic was complex and I learnt a lot by it.
At the end I had the "wrong database" on re-adding the fields in the query-editor. This I could fix by "edit SQL", which made the compiler connecting. I connected and this fixed it. I could re-add the fields after this and now it works.
« Last Edit: April 17, 2025, 06:17:37 pm by Nicole »

tonyw

  • Sr. Member
  • ****
  • Posts: 336
    • MWA Software
Re: Invalid float entry in DB - Dataset buffer - how to configure?
« Reply #1 on: April 10, 2025, 12:09:59 am »
There is a structure looking like this:

DBEdit
Datafield = EMISSIONSPREIS
DataSource = DataSource_EinAsset
IBQuery = IBQuery_EinAsset

Not sure, if it is important: There are a lot of data sensitive fields in this query / Frame.
To this very value I suddenly found an "invalid figure" in my database.

And sometimes I read there
"Dataset buffer is too small (4) to receive the data from Field ...."

What does this mean!?

Although it is years ago, that I migrated from Delphi, (what I am grateful for!), I miss something:
There exists an editor for datafields. In this very editor I could check the type of the input, which was e.g. integer or float or "computed". This I would like to control. I do not see such options in FP. Are they not there or is it me who cannot find them?

My question:
Please hint me, how to key in my value in DBEdit without buffer error.
Thanks.
IBX stores the data for each row in a row buffer. This is a contiguous area of memory and a separate buffer is used for every row read into memory. When the dataset is opened, IBX determines the maximum row buffer size by reading the database metadata and working out, on a field by field basis, how many bytes is must allocate for each field. Each row buffer is then allocated with enough space to hold the largest row.

Your error message indicates that, in this case, four bytes was allocated for the field. If the field is a text field then it is a CHAR(4) or VARCHAR(4) for a single byte character set or a CHAR(1) or VARCHAR(1) if the character set is UTF8. Alternatively, it could be a 32-bit integer field.

This error occurs when there is a mismatch between the field size saved in the form and the actual field size as reported by the database. This can occur when you have created the field using the Lazarus Fields Editor and, for some reason, the database field size has changed. This can occur if you change the field definition in the database schema or sometimes on a database upgrade. If you created the field manually in the fields editor then you may have incorrectly defined the field size.

When you create a field using the Fields Editor, the Fields Editor asks IBX what the field size is (in bytes) and is told the field size using the current database connection. That information is saved as part of the form and is persistent, There is no automatic mechanism that checks, when the dataset is later opened, that the field size reported by the database matches that saved with the form. You only find out when this error occurs.

The simplest fix is usually to delete field in the fields editor, make sure that the current database connection is with an up-to-date version of the database, and then recreate the field, again using the fields editor. That should ensure that the field size matches the database. Note that you do not usually have to change any visual control (e.g. a TDBEdit).

Nicole

  • Hero Member
  • *****
  • Posts: 1095
Re: Invalid float entry in DB - Dataset buffer - how to configure?
« Reply #2 on: April 10, 2025, 02:34:31 pm »
Hi Tony,

I am so grateful one of the DB-genius' saw my question finally! This part of my code waits since last week to be worked on.

It feels 99,99 % that you exactly named the reason. I have a different issue, where I suddenly cannot key in just a certain count of digits although the field shall hold more of them. Feels like too low storage as well.

So how to fix it without destroying my old work I cannot remember exactly any more what it means?

Deleting and re-adding sounds really good. But how?
Where can I find the field editor? I make a screenshot which shows my frame with some stuff.
Did I understand you correctly that I shall just delete the items in blue and re-add?

Thank you so much for caring. I could not find a good answer anywhere in the net up to now. I found a lot of answers, but yours feels correct for the first time.


Sieben

  • Sr. Member
  • ****
  • Posts: 373
Re: Invalid float entry in DB - Dataset buffer - how to configure?
« Reply #3 on: April 10, 2025, 06:46:20 pm »
Quote
Where can I find the field editor?

Just double click the Dataset that is connected to your DBEdit - which should be IBQuery_EinAsset as stated in your first post.
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

Nicole

  • Hero Member
  • *****
  • Posts: 1095
Re: Invalid float entry in DB - Dataset buffer - how to configure?
« Reply #4 on: April 11, 2025, 10:56:54 am »
I tried, - and something terrible happened:

The compiler jumped to the wrong database. How that?!
In the object manager everything looks ok and pointing at the correct database.

tonyw

  • Sr. Member
  • ****
  • Posts: 336
    • MWA Software
Re: Invalid float entry in DB - Dataset buffer - how to configure?
« Reply #5 on: April 11, 2025, 06:46:43 pm »
I tried, - and something terrible happened:

The compiler jumped to the wrong database. How that?!
In the object manager everything looks ok and pointing at the correct database.
IBX allows you to select a different (testing) database when you open a database connection in the IDE to the one specified in the TIBDatabase Databasename property. Check the dialog that pops up when an IDE database connection is opened and make sure you are opening the right database.

 

TinyPortal © 2005-2018