Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3706 closed defect (fixed)

Clearing OGR Attribute Filter on ESRI Personal Geodatabase

Reported by: joelodom Owned by: Even Rouault
Priority: normal Milestone: 1.7.3
Component: OGR_SF Version: 1.7.2
Severity: normal Keywords: pgeo
Cc: joelodom


I'm encountering an issue where once I've set an attribute filter on an ESRI personal geodatabase, I cannot clear that filter. If I pass NULL to SetAttributeFilter, the filter is internally set to "", which makes future queries return zero results instead of all rows. Examining the personal geodatabase driver code, I find:

OGRErr OGRPGeoTableLayer::SetAttributeFilter( const char *pszQuery )
    if( (pszQuery == NULL && this->pszQuery == NULL)
        || (pszQuery != NULL && this->pszQuery != NULL 
            && EQUAL(pszQuery,this->pszQuery)) )
        return OGRERR_NONE;

    CPLFree( this->pszQuery );
    this->pszQuery = CPLStrdup( pszQuery );


    return OGRERR_NONE;

Around the line this->pszQuery = CPLStrdup( pszQuery ); there should there be an additional bit of logic that sets this->pszQuery to NULL if pszQuery is NULL. For example,

this->pszQuery = pszQuery ? CPLStrdup( pszQuery ) : 0;

Change History (4)

comment:1 Changed 11 years ago by joelodom

Cc: joelodom added

comment:2 Changed 11 years ago by Even Rouault

Owner: changed from warmerdam to Even Rouault

comment:3 Changed 11 years ago by Even Rouault

Keywords: pgeo added
Resolution: fixed
Status: newclosed

Fixed in trunk (r20190) and in branches/1.7 (r20191). Thanks

comment:4 Changed 11 years ago by Even Rouault

Test added in r20197

Note: See TracTickets for help on using tickets.