Recent

Author Topic: IBX 2.7.2, What's wrong with my codes?  (Read 3283 times)

bytebites

  • Hero Member
  • *****
  • Posts: 721
Re: Lazarus 4, What's wrong with my codes?
« Reply #30 on: June 18, 2025, 02:29:54 pm »
Of course you are running range check on.

rvk

  • Hero Member
  • *****
  • Posts: 6814
Re: Lazarus 4, What's wrong with my codes?
« Reply #31 on: June 18, 2025, 02:45:38 pm »
Of course you are running range check on.
Nope. Even debugging info was off in the test-project.

Thaddy

  • Hero Member
  • *****
  • Posts: 17476
  • Ceterum censeo Trumpum esse delendum (Tnx Charlie)
Re: Lazarus 4, What's wrong with my codes?
« Reply #32 on: June 18, 2025, 05:11:07 pm »
So that makes this case a CASE issue?.......
Now playing the Hives again.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

incendio

  • Sr. Member
  • ****
  • Posts: 358
Re: Lazarus 4, What's wrong with my codes?
« Reply #33 on: June 18, 2025, 11:35:00 pm »
So that makes this case a CASE issue?.......
Now playing the Hives again.
What do you mean?

incendio

  • Sr. Member
  • ****
  • Posts: 358
Re: Lazarus 4, What's wrong with my codes?
« Reply #34 on: June 19, 2025, 12:04:28 am »
Simple procedure like this gave problem
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button2Click(Sender: TObject);
  2.  
  3. begin
  4.   Q.Close;
  5.   Q.SQL.Clear;
  6.   Q.SQL.Add('select title from m_rpt_col where ID_RPT = 2664 order by id rows 1' );
  7.   Q.Open;
  8.  
  9.   while not(Q.EOF) do
  10.   begin
  11.     ShowMessage('Field : ' + Q.FieldByName('title').AsString + 'cv');
  12.     Q.Next;
  13.   end;
  14. end;
  15.  
  16. ShowMessage showed
  17. Field : cv
  18.  
  19. Don't know wtih caused the problem, Lazarus 4 32 or IBX 2.7.2.1650
  20.  
  21.  
  22.  

rvk

  • Hero Member
  • *****
  • Posts: 6814
Re: Lazarus 4, What's wrong with my codes?
« Reply #35 on: June 19, 2025, 12:13:26 am »
Does it show that for all 12 records?
Do you get 12 times the same result?

Otherwise there just might be a record with an empty title.

incendio

  • Sr. Member
  • ****
  • Posts: 358
Re: Lazarus 4, What's wrong with my codes?
« Reply #36 on: June 19, 2025, 12:48:54 am »
Yes, 12 times, empty.

incendio

  • Sr. Member
  • ****
  • Posts: 358
Re: Lazarus 4, What's wrong with my codes?
« Reply #37 on: June 19, 2025, 04:25:24 am »
Testted with Lazarus 2.2.2 and IBX 2.7.2, gave same problem.

With IBX 2.7.2 this code
Code: Pascal  [Select][+][-]
  1. ShowMessage('Field : ' + Q.FieldByName('wd').AsString);

Gave correct result if field wd type is integer.

So probably, problem in IBX?
« Last Edit: June 19, 2025, 04:44:08 am by incendio »

rvk

  • Hero Member
  • *****
  • Posts: 6814
Re: Lazarus 4, What's wrong with my codes?
« Reply #38 on: June 19, 2025, 07:05:49 am »
I was just about to suggest trying a different fields.
Because when I tried it I used a different fields and it worked fine.

This might not be a problem with IBX but maybe a problem with Firebird.
Maybe title had become a reserved word (although not documented).

You can check if the standard slqdb component from FPC/Lazarus give the same.

Dus the field contain text when you use Flamerobin (or other manager) to view the table.

incendio

  • Sr. Member
  • ****
  • Posts: 358
Re: Lazarus 4, What's wrong with my codes?
« Reply #39 on: June 19, 2025, 07:59:48 am »
I have tried with Lazarus 2.2.2 with IBX 2.7.2 from OPM and IBX 2.7.4 from github, both IBX versions gave same problem.

I remembere when using Lazarus 2.2.2 and IBX (forgot the version), that codes work fine.

Probably this is IBX.

@rvk, you said that code work fine for you, could you share the version of IBX, fbintf, and ibcontrol you used?

egsuh

  • Hero Member
  • *****
  • Posts: 1624
Re: Lazarus 4, What's wrong with my codes?
« Reply #40 on: June 19, 2025, 09:14:07 am »
This may not be database-related problem. Some problem in string operation, instead. Once I had similar problem but not remember exactly what it was.  I think I have posted the issue here, but cannot find it.

Can you try followings, and share the results.


1) using Format, instead of + operation.

    ShowMessageFmt('Field : %s cv', [Q.FieldByName('title').AsString]);


2) Use mediating variable

       ts := Q.FieldByName('title').AsString;
       ShowMessage('Field : ' + ts + 'cv');



3) Using mediating variable for whole string

        ts :- 'Field : ' + Q.FieldByName('title').AsString + 'cv';
        ShowMessage(ts);



incendio

  • Sr. Member
  • ****
  • Posts: 358
Re: Lazarus 4, What's wrong with my codes?
« Reply #41 on: June 19, 2025, 12:42:49 pm »
This may not be database-related problem. Some problem in string operation, instead. Once I had similar problem but not remember exactly what it was.  I think I have posted the issue here, but cannot find it.

Can you try followings, and share the results.


1) using Format, instead of + operation.

    ShowMessageFmt('Field : %s cv', [Q.FieldByName('title').AsString]);


2) Use mediating variable

       ts := Q.FieldByName('title').AsString;
       ShowMessage('Field : ' + ts + 'cv');



3) Using mediating variable for whole string

        ts :- 'Field : ' + Q.FieldByName('title').AsString + 'cv';
        ShowMessage(ts);

All failed.

With previous ver of IBX, it was no problem.
I have been trying to install previous ver of IBX from github with no success.

rvk

  • Hero Member
  • *****
  • Posts: 6814
Re: Lazarus 4, What's wrong with my codes?
« Reply #42 on: June 19, 2025, 12:57:31 pm »
@rvk, you said that code work fine for you, could you share the version of IBX, fbintf, and ibcontrol you used?
As I said, I didn't have your database so I used one of mine.
With a table and field name NAAM it worked fine.

You say that it worked with other fields.
So the problem is the field name title which is probably a reserved word.

Did you try another database manager to see what the table actually shows?

Anyway... avoid common words like title etc.

rvk

  • Hero Member
  • *****
  • Posts: 6814
Re: Lazarus 4, What's wrong with my codes?
« Reply #43 on: June 19, 2025, 01:04:38 pm »
As I said, I didn't have your database so I used one of mine.
With a table and field name NAAM it worked fine.

You say that it worked with other fields.
So the problem is the field name title which is probably a reserved word.

Did you try another database manager to see what the table actually shows?

Anyway... avoid common words like title etc.
Nope. Just tried it with a table you defined and that still works for me (using the field "title").

Can you share a sample database?
(not the DDL and INSERT but the actual database)

Only thing I can think of is that you also have a DOMAIN type title or a PROCEDURE or something.
Especially because other fields work fine.

*) You could try doing SELECT title as NEWFIELD from xx
and then trying to read NEWFIELD

*) If that doesn't work, create a second field NEWFIELD and fill it and try to use it.
Just to rule out it is the "title" as fieldname problem.
« Last Edit: June 19, 2025, 01:10:58 pm by rvk »

incendio

  • Sr. Member
  • ****
  • Posts: 358
Re: Lazarus 4, What's wrong with my codes?
« Reply #44 on: June 19, 2025, 02:05:29 pm »
@rvk, you said that code work fine for you, could you share the version of IBX, fbintf, and ibcontrol you used?
As I said, I didn't have your database so I used one of mine.
With a table and field name NAAM it worked fine.

You say that it worked with other fields.
So the problem is the field name title which is probably a reserved word.

Did you try another database manager to see what the table actually shows?

Anyway... avoid common words like title etc.
It worked if field type is integer.

This is not about reserved word. Tried to test table, field name S1, type varchar 32, same problem.

Also, it worked fine in old IBX version.

What about your, could you share your version of ibx, ibcontrol and fbintf so I can download these files from github. Have trouble also to get the old IBX to work.

 

TinyPortal © 2005-2018