Page 1 of 1

Range Check Error

Posted: 05.08.2007, 17:56
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

Posted: 05.08.2007, 23:56
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

Posted: 06.08.2007, 06:34
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