Oracle10g and queryByAttributes

Fernando Simon fsimon at UNIVALI.BR
Mon Jul 3 09:48:38 EDT 2006


Hi Antonio,
    How did you defined your DATA parameter for you layer? The extents
for your query are right?
    Here I use this code as example:
        // Performing the query and returning only a single record
        @$qlayer->queryByAttributes($nm_field_query, $regex, MS_SINGLE);
        $numresults = $qlayer->getNumResults();
        if ($numresults > 0)
        {
                for($f = 0; $f < $numresults ; $f++)
                {
                        // Opening the layer to return data
                        $qlayer->open();
                        // Getting the object that store the results
                        $indexResult = $qlayer->getResult($i);
                        $qresult =
$qlayer->getShape(-1,$indexResult->shapeindex);

                        // Getting the data from object
                        // The "values" contains the data
                        // for all columns that are in layer data definition
                        // You can get all columns that are in data
definition
                        $dataResult = array($qresult->values[STATE]);

                        // Cleaning and closing objects
                        $qresult->free();
                        $qlayer->close();
                }
                return $dataResult[0];
        }

      And my DATA definition:
        data "geo_column from (SELECT geo_id, state, totpop, geo_column
FROM tb_states) USING UNIQUE geo_id FILTER"

     Best regards.

------------------------------------------------------------------------
Fernando Simon
Mapserver and Oracle Spatial developer
G10 - Laboratorio de Computacao Aplicada - Brazil
http://g10.cttmar.univali.br - UNIVALI/CTTMAR
------------------------------------------------------------------------

Antonio Iandolo wrote:
> I'm querying Oracle10g with phpmapscript (MapServer 4.8.3) but I can't
> browse the result set...
>
> Here it is my code:
>
> $myresult=$mylayer->queryByAttributes($queryItem,$queryString,MS_SINGLE)
> ;
> var_dump($myresult);
> if ($mylayer->getNumResults() > 0){
>   $mylayer->open();
>   $result=$mylayer->getResult($i);
>   $shp=$mylayer->getShape(-1,$myresult->shapeindex);
>   var_dump($shp);
> }
>
> >From the output I can see that:
>
> 1) var_dump($myresult) is "object(stdClass)(3) { ["shapeindex"]=>
> int(-2028233538) ["tileindex"]=>  int(-1) ["classindex"]=>  int(0) }"
>
> 2) var_dump($shp) is "False"  
>
> It displays numresults=1 but it $myresult->shapeindex is negative...
>
> What's wrong? Maybe this is not the right way to query Oracle
> (queryByAttributes) to get data? 
>
> Thanks in advance,
> Antonio
>
>   



More information about the mapserver-users mailing list