#1 2018-07-29 04:01:50

steve888
Member
Registered: 2018-07-17
Posts: 8

FetchAllToBinary - Too Many Columns

I'm having a problem with a stored procedure that returns 300+ columns.  FetchAllToBinary throws a 'Too Many Columns' exception.  Unfortunately I'm unable to modify the procedure to return less columns.  Any suggestions?

  FillChar(Null,sizeof(Null),0);
  result := 0;
  W := TFileBufferWriter.Create(Dest);
  try
    W.WriteVarUInt32(FETCHALLTOBINARY_MAGIC);
    FMax := ColumnCount;
    W.WriteVarUInt32(FMax);
    if FMax>0 then begin
      // write column description
      SetLength(ColTypes,FMax);
      dec(FMax);
      for F := 0 to FMax do begin
        W.Write(ColumnName(F));
        ColTypes[F] := ColumnType(F,@FieldSize);
        W.Write1(ord(ColTypes[F]));
        W.WriteVarUInt32(FieldSize);
      end;
      // initialize null handling
      NullRowSize := (FMax shr 3)+1;
      if NullRowSize>sizeof(Null) then                     <-------------------------
        raise ESQLDBException.CreateUTF8(
          '%.FetchAllToBinary: too many columns',[self]);

Offline

#2 2018-07-29 10:15:05

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

Re: FetchAllToBinary - Too Many Columns

Sadly it is hardcoded...

Offline

#3 2018-07-30 22:01:45

steve888
Member
Registered: 2018-07-17
Posts: 8

Re: FetchAllToBinary - Too Many Columns

ab wrote:

Sadly it is hardcoded...

Yes, TSqlDbProxyStatementColumns is a set limited to 256 elements.  Changing this to an array is a way around this limit.

Offline

#4 2018-09-13 08:48:59

cybexr
Member
Registered: 2016-09-14
Posts: 78

Re: FetchAllToBinary - Too Many Columns

Meet same problem here,  Syndb support fetch unlimted columns, but this FetchAllToBinary break the completeness. 
And FetchAllToJSON() will loose ColumnValueDBSize (original DBMS declared fieldsize ) information , FetchAllToBinary is the only way in my enviorment.  hope it will be corrected.

Offline

#5 2019-05-16 19:19:18

fbkopp
Member
Registered: 2017-08-11
Posts: 4

Re: FetchAllToBinary - Too Many Columns

I have hit same limit for a table with more than 256 columns, will there be a change or correction for the  hard coded limit?

Offline

#6 2019-05-17 12:57:38

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

Re: FetchAllToBinary - Too Many Columns

256 columns is already too much! Time for DB refactoring! sad
See https://dba.stackexchange.com/a/3976

But anyway, since most SQL DB allows up to 1000 columns per table - with performance impact for sure - I allowed any column count limit for SynDB remote binary serialization. smile
See https://synopse.info/fossil/info/3fb2ed0db6

Offline

#7 2019-05-20 14:42:54

fbkopp
Member
Registered: 2017-08-11
Posts: 4

Re: FetchAllToBinary - Too Many Columns

Thank you very much, it worked perfectly. Tested with 260 columns.

Offline

#8 2019-05-20 22:31:49

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

Re: FetchAllToBinary - Too Many Columns

smile

Out of curiosity, what is your feedback about performance and stability?

Offline

Board footer

Powered by FluxBB