Page 1 of 1

[solved] MySQL WITH_WIDEMEMO

Posted: 16.06.2014, 08:27
by cacofony
Hi,

{$DEFINE WITH_WIDEMEMO} // Have WIDEMEMO, For Delphi we turn these off if not applicable

Could this perhaps be explained further?

I have found issues with large VARCHAR fields or TEXT fields. By commenting this out problems disappear.

Loading strings from streams appears to cause the issue.

Tristan

Re: MySQL WITH_WIDEMEMO

Posted: 16.06.2014, 09:40
by cacofony
Sorry ignore that, it still has access violations.

ZDbcCache.pas
function TZRowAccessor.GetRawByteString(Const ColumnIndex: Integer;
var IsNull: Boolean): RawByteString;


Code: Select all

stAsciiStream, stUnicodeStream, stBinaryStream:
      begin
        try
          TempBlob := GetBlobObject(FBuffer, ColumnIndex);
          if (TempBlob <> nil) and not TempBlob.IsEmpty then
            Result := TempBlob.GetString;

        except
          on E: Exception do
          begin
            Result := Format('%s, Column Index: %d, Column Type %d',
              [E.Message, ColumnIndex, Integer(FColumnTypes[ColumnIndex - 1])]);
          end;
        end;
      end;
This will happen for TEXT, LARGETEXT, SMALLTEXT and CAST as CHAR[n] where n > 500?

I placed the exception trap, the solumn type will be stUnicodeStream

Re: MySQL WITH_WIDEMEMO

Posted: 16.06.2014, 14:13
by cacofony
This can be easily replicated in the zeoslib test tables. Add some rows of text in the b_text field in table blob_values. I added 62 rows containing the text from lgpl.txt

Add a ZConnection, ZQuery, Datasource and link a DBGrid

Code: Select all

  ZQuery.SQL.Clear;
  ZQuery.SQL.Add('SELECT * FROM blob_values');
  ZQuery.Open;
Scroll through the records and an access violation will occur here

Code: Select all

function TZMySQLBaseDriver.GetFieldData(Row: PZMySQLRow;
  Offset: Cardinal): PAnsiChar;
begin
  Result := PMYSQL_ROW(ROW)[Offset];
end;

Re: MySQL WITH_WIDEMEMO

Posted: 21.06.2014, 16:28
by cacofony
My testing would show EgonHugeist has fixed the issue with commit 3158. Nice work.

https://sourceforge.net/p/zeoslib/tickets/77/

Re: MySQL WITH_WIDEMEMO

Posted: 24.06.2014, 14:15
by papelhigienico
@miab3 or @cacofony can you close this (Put [SOLVED] in the title of the first message)???

I don't have sufficient privileges to do this... :oops: