R: [UMN_MAPSERVER-USERS] Oracle10g and queryByAttributes

Antonio Iandolo aiandolo at GRUPPOAS.IT
Wed Jul 5 09:42:39 EDT 2006


I've changed my idcolumn to NUMBER(16) but it still doesn't work...and I
already have defined a UNIQUE INDEX on that column...

Moreover the same script works fine both with ESRI shapefiles and with
MapInfo tables...

Now some further questions:
1) I query (queryByAttributes) on a POINT layer and there is another
POINT layer for the same oracle table (in order to handle different
symbols for different zoom levels); each of these layers has 2 classes
(one for the selected point and one for all the other "unselected"
points): do you think this could be a problem for the queryByAttributes
method?

Of course only one layer is queried, depending on the zoom level....

Other suggestions to solve this problem?

Thanks again,
Antonio



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