R: [UMN_MAPSERVER-USERS] Oracle10g and queryByAttributes

Fernando Simon fsimon at UNIVALI.BR
Tue Jul 4 04:28:56 PDT 2006


Hi Antonio,
    Yes, the idcolumn must be a numeric type, I just used the nested
select to restrict the number of columns that are used by Mapserver.
    I believe that the problem in your case is the numeric column, can
you define a numeric column in UNIQUE definition?
    Best regards.

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

Antonio Iandolo wrote:
> 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