R: [UMN_MAPSERVER-USERS] Oracle10g and queryByAttributes

Antonio Iandolo aiandolo at GRUPPOAS.IT
Tue Jul 4 03:02:03 PDT 2006


Hi all

Thanks for the answer, Fernando, but I still can't get the solution...
My DATA are the following:
    DATA "GEOM FROM mytable USING UNIQUE myidcolumn SRID 8307"

(Note: myidcolumn is a VARCHAR2(16), is it a problem? Should it be
numeric?)

Why did you use a nested select in the DATA? Is it an old bug solved in
4.8.3 MapServer version?

I've tried all the following settings, getting always the same result
(shapeindex < 0):

DATA "GEOM FROM mytable USING UNIQUE idcolumn SRID 8307 FILTER"
DATA "GEOM FROM mytable USING UNIQUE SRID 8307 FILTER"
DATA "GEOM FROM mytable USING UNIQUE SRID 8307 VERSION 10g FILTER"

The query returns 1 shape (i.e. $layer->getNumResults() = 1), but after
these statements 

$layer->open();
$result=$layer->getResult(0);

I do a simple var_dump($result) and I get:

result=object(stdClass)(3) { ["shapeindex"]=>  int(-2028233538)
["tileindex"]=>  int(-1) ["classindex"]=>  int(0) }

That is $result->shapeindex < 0!! So the following $shape is "False":
$shape=$layer->getShape(-1,$result->shapeindex);

...I don't think that $result->shapeindex should be negative...

My software environment is:
- Windows XP Professional SP1
- Apache 2.0.55
- MapServer 4.8.3 
- php 4.4.3-dev (MS4W 1.5.3)
- php_mapscript_48.dll (232Kb - 09/05/2006 17.22)
- Oracle10g (XE) 

I have both Oracle8i and Oracle10g installed (server and client), but
I've renamed the Oracle8i's home directory.

May I know your MapServer version, Php version and php_mapscript's
version (maybe also php_mapscript.dll's size and date)?
Maybe the problem is the php's "dev" version...(I'll "downgrade" to a
stable version)

Any further hint?

Thanks in advance,
Antonio



> 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"
> 



More information about the MapServer-users mailing list