Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#662 closed defect (fixed)

Bug in FdoFilter::ToString - filter NOT(a AND b) returns L"NOT a AND b"

Reported by: ijarm Owned by: gregboone
Priority: minor Milestone: 3.6.0
Component: FDO API Version: 3.4.0
Severity: 1 Keywords: FDO FdoFilter ToString Parse parsing bug defect
Cc: igor@… haris@… External ID:

Description

An FdoFilter representing NOT(a AND b) returns L"NOT a AND b" when its ToString is called.

This code:

FdoFilter *NOTaANDb;//NOT(a AND b)
FdoFilter *newFlt = FdoFilter::Parse(NOTaANDb->ToString());

makes newFlt that is not equal to the original.

I tested this in FDO 3.4 but as far as I could see parsing code in FDO 3.5 hasn't changed at all.

The following is a sample code used to produce the error:

//a
  FdoPtr<FdoFilter> flt1 = FdoFilter::Parse(L"Geometry INTERSECTS GeomFromText('POLYGON ((461848 100030, 462399 100892, 463039 100544, 462697 99882, 462545 99926, 462652 100525, 462539 100612, 462075 99911, 461848 100030))')");

//b
  FdoPtr<FdoFilter> flt2 = FdoFilter::Parse(L"POVRSINA < 200");

//a AND b
  FdoPtr<FdoFilter> fltand = FdoFilter::Combine(flt1, FdoBinaryLogicalOperations_And, flt2);

//NOT(a AND b)
  FdoPtr<FdoFilter> fltnot = FdoUnaryLogicalOperator::Create(fltand, FdoUnaryLogicalOperations_Not);

//the same filter can be parsed directly from string
//  fltnot = FdoFilter::Parse(L"NOT(Geometry INTERSECTS GeomFromText('POLYGON ((461848 100030, 462399 100892, 463039 100544, 462697 99882, 462545 99926, 462652 100525, 462539 100612, 462075 99911, 461848 100030))') AND POVRSINA < 200)");

//WRONG: filterStr equals L"NOT Geometry INTERSECTS GeomFromText('POLYGON ((461848 100030, 462399 100892, 463039 100544, 462697 99882, 462545 99926, 462652 100525, 462539 100612, 462075 99911, 461848 100030))') AND POVRSINA < 200"
//SHOULD BE: L"NOT ( Geometry INTERSECTS GeomFromText('POLYGON ((461848 100030, 462399 100892, 463039 100544, 462697 99882, 462545 99926, 462652 100525, 462539 100612, 462075 99911, 461848 100030))') AND POVRSINA < 200 )"
  FdoString *filterStr = fltnot->ToString();

Change History (3)

comment:1 by ijarm, 14 years ago

Summary: Bug in FdoFilter::ToStringBug in FdoFilter::ToString - filter NOT(a AND b) returns L"NOT a AND b"

comment:2 by gregboone, 14 years ago

Resolution: fixed
Status: newclosed

Refer to -- Ticket #664: FdoUnaryLogicalOperator::ToString generates an invalid filter

comment:3 by gregboone, 14 years ago

Milestone: 3.5.03.6.0
Note: See TracTickets for help on using tickets.