Range Check Error

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
preman_anjing
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 11.02.2006, 22:05

Range Check Error

Post by preman_anjing »

Solved Problem "Range Check Error", Field > 256

Code: Select all

ZPlainMySql5.pas

Line 302 : MYSQL_ROW = array[00..$ff] of PChar; // maximum Field 256

Change To

Line 302 : MYSQL_ROW = array[0000..$ffff] of PChar; // maximum Field 65536

sorry my english bad
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Can anybody who knows more about memory issues confirm this is a good or bad idea? Would we multiply memory usage by a huge factor?

Mark
mse
Junior Boarder
Junior Boarder
Posts: 41
Joined: 17.07.2007, 06:30

Post by mse »

Can anybody who knows more about memory issues confirm this is a good or bad idea? Would we multiply memory usage by a huge factor?

If I read the code right, MYSQL_ROW is used in ZPlainMySql41.pas:

Code: Select all

  MYSQL_METHODS = record
[...]
    fetch_lengths: procedure(_to: PLongInt; column: MYSQL_ROW;
      field_count: Cardinal);
[...]
  end;
where it would use much more space on the stack, but the definition is wrong anyway IMHO.
MYSQL_ROW is actually a ppchar:

Code: Select all

  MYSQL_ROW = ppchar;
Modify the getfielddata functions:

Code: Select all

//  Result := ZPlainMySql5.PMYSQL_ROW(ROW)[Offset];
  Result := ppchar(ptruint(ZPlainMySql5.PMYSQL_ROW(ROW))+Offset*sizeof(pchar))^;
ptruint = dword for win32. In objfpc mode "ppchar[offset]^" would work too.

Martin
Post Reply