#1 2016-09-02 07:21:21

bagusprasojo
Member
Registered: 2016-07-26
Posts: 18

Error Mormot in Interbase : select first 1 ID from tablename

Hello, I have tried mormot in SQL Server and PostgreSQL. On those DBMS, mormot runs smoothly. But, when i change dbms to Interbase i got error. It's error is caused by execution of SQL

select first 1 ID from tablename

In interbase, if we want to get firstrow of a table the sql is :

select ID from tablename rows 1

How to fix this error ?

Offline

#2 2016-09-02 07:24:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Error Mormot in Interbase : select first 1 ID from tablename

Interbase is not supported yet.
I though that FireBird did have the same syntax, but it appears it does not.

Some modifications are needed in SynDB.pas to add explicit recognition and process of Interbase.
I do not have Interbase, nor want to use it.
So external input is welcome!

Offline

#3 2016-09-02 07:53:17

miab3
Member
From: Poland
Registered: 2014-10-01
Posts: 188

Re: Error Mormot in Interbase : select first 1 ID from tablename

Offline

#4 2016-09-02 08:31:42

bagusprasojo
Member
Registered: 2016-07-26
Posts: 18

Re: Error Mormot in Interbase : select first 1 ID from tablename

hello AB, i have solved the above error. But i got another error. Here is the error log :

20160902 07582138  !  +    SynDBFireDAC.TSQLDBFireDACStatement(01BB5A00).007ED1A9 
20160902 07582138  ! SQL   	SynDBFireDAC.TSQLDBFireDACStatement(01BB5A00) CREATE UNIQUE DESC INDEX NDXMorAssetID ON MorAsset(ID)
20160902 07582447  ! EXC   	EIBNativeException ("[FireDAC][Phys][IB]unsuccessful metadata update\r\nSTORE RDB$INDICES failed\r\nattempt to store duplicate value (visible to active transactions) in unique index \"RDB$INDEX_5\"") at 00721C9F  stack trace API 00544E02 
20160902 07582447  ! EXC   	EIBNativeException ("[FireDAC][Phys][IB]unsuccessful metadata update\r\nSTORE RDB$INDICES failed\r\nattempt to store duplicate value (visible to active transactions) in unique index \"RDB$INDEX_5\"") at 00721C9F  stack trace API 00544E02 
20160902 07582447  ! EXC   	EIBNativeException ("[FireDAC][Phys][IB]unsuccessful metadata update\r\nSTORE RDB$INDICES failed\r\nattempt to store duplicate value (visible to active transactions) in unique index \"RDB$INDEX_5\"") at 00721C9F  stack trace API 00544E02 
20160902 07582447  ! EXC   	EIBNativeException ("[FireDAC][Phys][IB]unsuccessful metadata update\r\nSTORE RDB$INDICES failed\r\nattempt to store duplicate value (visible to active transactions) in unique index \"RDB$INDEX_5\"") at 00721C9F  stack trace API 00544E02 004071EC 77B7718B 77B77017 00721C9F 00AF9238 00B0B394 00B0B521 007BE47F 007BE5B7 007BF5AF 007BE00E 0084100A 00841460 007B915C 007BF89C 00828D9B 0082906D 0082F52D 007F8DEE 0084352D 00607884 00607F6F 005B3EBD 005B416A 0059D133 006C367E 00B0E168 004990F5 0049D44D 
20160902 07582448  ! EXC   	EIBNativeException ("[FireDAC][Phys][IB]unsuccessful metadata update\r\nSTORE RDB$INDICES failed\r\nattempt to store duplicate value (visible to active transactions) in unique index \"RDB$INDEX_5\"") at 00721C9F  stack trace API 00544E02 
20160902 07582449  ! EXC   	EIBNativeException ("[FireDAC][Phys][IB]unsuccessful metadata update\r\nSTORE RDB$INDICES failed\r\nattempt to store duplicate value (visible to active transactions) in unique index \"RDB$INDEX_5\"") at 00721C9F  stack trace API 00544E02 
20160902 07582449  ! EXC   	EIBNativeException ("[FireDAC][Phys][IB]unsuccessful metadata update\r\nSTORE RDB$INDICES failed\r\nattempt to store duplicate value (visible to active transactions) in unique index \"RDB$INDEX_5\"") at 00721C9F  stack trace API 00544E02 

Could you point me which part of this framework to be changed ?

Last edited by bagusprasojo (2016-09-02 08:32:23)

Offline

#5 2016-09-02 09:15:58

bagusprasojo
Member
Registered: 2016-07-26
Posts: 18

Re: Error Mormot in Interbase : select first 1 ID from tablename

I have solved the above error. I change unit unit mORMotDB.pas

function TSQLRestStorageExternal.CreateSQLMultiIndex(
  Table: TSQLRecordClass; const FieldNames: array of RawUTF8;
  Unique: boolean; IndexName: RawUTF8): boolean;
var SQL: RawUTF8;
    ExtFieldNames: TRawUTF8DynArray;
    IntFieldIndex: TIntegerDynArray;
    Descending: boolean;
    i,n,extfield: integer;
begin
  ..........................................
      dPostgreSQL,dMSSQL,dMySQL,dOracle,dNexusDB: begin // as most DB on primary key
        result := true;
        exit;
      end;
      dFirebird:  // see http://www.firebirdfaq.org/faq205
        Descending := true;
      end;
   .........................................

tobe

function TSQLRestStorageExternal.CreateSQLMultiIndex(
  Table: TSQLRecordClass; const FieldNames: array of RawUTF8;
  Unique: boolean; IndexName: RawUTF8): boolean;
var SQL: RawUTF8;
    ExtFieldNames: TRawUTF8DynArray;
    IntFieldIndex: TIntegerDynArray;
    Descending: boolean;
    i,n,extfield: integer;
begin
  .........................................
      dPostgreSQL,dMSSQL,dMySQL,dOracle,dNexusDB, dFirebird: begin // as most DB on primary key
        result := true;
        exit;
      end;
//      dFirebird:  // see http://www.firebirdfaq.org/faq205
//        Descending := true;
      end;
    .........................................

Offline

#6 2016-09-02 09:21:05

bagusprasojo
Member
Registered: 2016-07-26
Posts: 18

Re: Error Mormot in Interbase : select first 1 ID from tablename

one more addition, before using mormot + Interbase, we must create domain BIGINT. Here is the code

create domain BIGINT as Integer

Offline

#7 2016-09-02 11:41:36

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Error Mormot in Interbase : select first 1 ID from tablename

AFAIK Interbase Integer is 32-bit, so it won't work as expected - for 64-bit values.
See http://docwiki.embarcadero.com/InterBas … Data_Types

Interbase is disapointing, in this aspect... no native 64-bit integer type? In year 2016?

Offline

#8 2016-09-02 13:46:18

miab3
Member
From: Poland
Registered: 2014-10-01
Posts: 188

Re: Error Mormot in Interbase : select first 1 ID from tablename

Interbase NUMERIC(18,0)
Fierbird NUMERIC(18,0) or BIGINT

Michal

Offline

Board footer

Powered by FluxBB