View Issue Details

IDProjectCategoryView StatusLast Update
0005603JEDI VCL00 JVCL Componentspublic2012-09-10 14:15
ReporterstevegrAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.40 
Target VersionFixed in Version3.46 
Summary0005603: JvDBUltimGrid - ADO sorting problem.
DescriptionADO limitation:
Default Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Error on sort when key exists 10 KB.

A simple solution is:

procedure UpdateProp(const PropName: string; const Value: string);
begin
  // ERROR ADO 10 MB key limitation
  try
    SetStrProp(DSet, PropName, Value);
    FSortedFields := FieldsToSort;
    FSortOK := True;
  except
    { }
  end;
end;


TagsNo tags attached.

Relationships

related to 0005806 resolvedobones JvDBGrid - DefaultDrawColumnCell and ShowMemos 

Activities

obones

2011-09-21 11:48

administrator   ~0018925

Please provide the zipped sources of a sample application showing this

stevegr

2011-09-28 19:49

reporter   ~0018990

The try...except block is for general-purpose error handling.

The ADO 10MB key limitation error fires when I try to sort one of the following types using postgres database (Encoding UTF8):
- memo
- character varying(4680) or larger ==> 4680 x 2 = 9360 bytes

MSSQL Server do not allow so large values for char fields. I have not tried other databases but as this is an ADO limitation I believe that should happen with any char field that exceeds this limitation.

obones

2011-10-07 16:13

administrator   ~0019017

I'm sorry, but we can't silently swallow ALL exceptions, this is very dangerous and can lead to code injection by hackers
There should be another way to deal with this

stevegr

2011-10-07 16:59

reporter   ~0019018

OK. if there's a way to assist, please let me know.

stevegr

2011-10-08 21:23

reporter   ~0019022

// That piece of code is working. I tested only with ADO.

procedure TJvDBUltimGrid.Sort(FieldsToSort: TSortFields);
......
var
  DSet: TDataSet;
  SortField: TField; {needed in UpdateProp}

  procedure UpdateProp(const PropName: string; const Value: string);
  var
    Error: Boolean;
  begin
    // ERROR: ADO 10 KB key limitation
    Error:=
      (SortWith = swFields) { swFields: for ADO tables }
      and (SortField.DataType in [ftString, ftWideString])
      and (SortField.DataSize > 9361);

    if not Error then
    begin
      SetStrProp(DSet, PropName, Value);
      FSortedFields := FieldsToSort;
      FSortOK := True;
    end else
      FSortOK := False;

  end;
......

obones

2012-02-22 14:42

administrator   ~0019439

Someone with DB knowledge would have to look at this

obones

2012-02-27 11:33

administrator   ~0019567

This is now fixed in SVN

Issue History

Date Modified Username Field Change
2011-06-21 19:47 stevegr New Issue
2011-09-21 11:48 obones Note Added: 0018925
2011-09-21 11:48 obones Status new => feedback
2011-09-28 19:49 stevegr Note Added: 0018990
2011-10-07 16:13 obones Note Added: 0019017
2011-10-07 16:59 stevegr Note Added: 0019018
2011-10-08 21:23 stevegr Note Added: 0019022
2012-02-22 14:42 obones Note Added: 0019439
2012-02-22 14:42 obones Status feedback => acknowledged
2012-02-27 11:29 obones Relationship added related to 0005806
2012-02-27 11:33 obones Note Added: 0019567
2012-02-27 11:33 obones Status acknowledged => resolved
2012-02-27 11:33 obones Fixed in Version => Daily / SVN
2012-02-27 11:33 obones Resolution open => fixed
2012-02-27 11:33 obones Assigned To => obones
2012-09-10 14:15 obones Fixed in Version Daily / SVN => 3.46