Opened 20 years ago

Closed 20 years ago

#921 closed enhancement (fixed)

saveQuery, freeQuery, queryByIndex for SWIG mapscripts

Reported by: sgillies@… Owned by: sgillies@…
Priority: highest Milestone: 4.4 release
Component: MapScript-SWIG Version: 4.3
Severity: minor Keywords:
Cc: aryan@…

Description

Just like the PHP mapscript.

Change History (4)

comment:1 by sgillies@…, 20 years ago

Milestone: 4.4 release
Status: newassigned
There's no reason why this shouldn't be in 4.4.  Will be quick to do and easy
to test.


comment:2 by aryan@…, 20 years ago

Don't forget loadQuery, saveQuery's darling sibling.

comment:3 by sgillies@…, 20 years ago

saveQuery, freeQuery, loadQuery are in place.  Below is the test 
that shows how they are used.

    def testSaveAndLoadQuery(self):
        """test saving query to a file"""
        results = self.pointquery()
        self.map.saveQuery('test.qry')
        self.map.freeQuery()
        results = self.layer.getResults()
        assert results == None
        self.map.loadQuery('test.qry')
        results = self.layer.getResults()
        assert results is not None

queryByIndex is in as well.  Here's the test.
        
    def testQueryByIndex(self):
        """pop a result into the result set"""
        self.layer.queryByIndex(self.map, -1, 0, mapscript.MS_FALSE)
        results = self.layer.getResults()
        assert results.numresults == 1
        self.layer.queryByIndex(self.map, -1, 0, mapscript.MS_TRUE)
        results = self.layer.getResults()
        assert results.numresults == 2
        
If you leave off the 4th argument, the default is to clobber the existing
query results instead of adding.

Should be in hobu's next build.  You could come on to IRC and see if he'll
build a new one for you now.  After you confirm, I'll close up this bug.

comment:4 by sgillies@…, 20 years ago

Resolution: fixed
Status: assignedclosed
closing.  my tests pass.  we'll reopen if there are any problems.

Note: See TracTickets for help on using tickets.