Recent

Author Topic: IBX 2.2.0 Line 2520 of IBExtract.pas, seems to be a bug  (Read 2589 times)

RedOctober

  • Sr. Member
  • ****
  • Posts: 452
IBX 2.2.0 Line 2520 of IBExtract.pas, seems to be a bug
« on: March 16, 2018, 04:03:17 am »
Line 2520 of IBExtract.pas:

 if not qryValue.EOF then
            FMetaData.Add(Format('ALTER SEQUENCE %s RESTART WITH %d;',
                 [QuoteIdentifierIfNeeded(FDatabase.SQLDialect, GenName),
                  qryValue.FieldByName('GENERATORVALUE').AsInteger]));

Parameter values: GenName = 'GEN_CHG_SEQ'

The SQL in qryValue is:  'SELECT GEN_ID(GEN_CHG_SEQ,0) as GENERATORVALUE From RDB$Database'

The original "QuoteIdentifier" was replaced with "QuoteIdentifierIfNeeded" on the suggestion of Tony W.

Error:

Project MyProject raised exception class 'RunError(201)'.

 In file 'fbintf\client\FBSQLData.pas' at line 1242

[Ignore this exception type]

[Break] [Continue]

The generator value of GEN_CHG_SEQ is a negative BIGINT:

-9223372036846508949

Is this a bug?  Maybe the Format('ALTER SEQUENCE %s RESTART WITH %d;'  is the problem?  Maybe %d isn't big enough to accept such a large integer?






rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: IBX 2.2.0 Line 2520 of IBExtract.pas, seems to be a bug
« Reply #1 on: March 16, 2018, 10:59:25 am »
-9,223,372,036,846,508,949
Is this a bug?  Maybe the Format('ALTER SEQUENCE %s RESTART WITH %d;'  is the problem?  Maybe %d isn't big enough to accept such a large integer?
BIGINT is defined as -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)

So -9,223,372,036,846,508,949 should fit in a BIGINT.

But .AsInteger (which is used) is an integer in FPC. (B.T.W. in Delphi it is a LongInt but effectively the same on 32 bits)
So, yeah, that could be a problem.

Usually you would do .asInt64 for a BigInt.

tonyw

  • Sr. Member
  • ****
  • Posts: 319
    • MWA Software
Re: IBX 2.2.0 Line 2520 of IBExtract.pas, seems to be a bug
« Reply #2 on: March 16, 2018, 01:09:22 pm »
Agree. It's a bug

 

TinyPortal © 2005-2018