<html><body>
<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);">Hi,</div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);"> </div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);">I have been using ms4w for 
quite some time and have discovered problems with Oracle when using 
php_mapscript. I posted this problem at ms4w's support and was adviced 
to turn to you.</div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);"> </div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);">I am supporting a 
gis-system on the web that is heavily database dependent, and can run on 
either postgres or oracle according to the costumer's request. So there 
are two sets of php-scripts that are identical apart from the database 
calls.</div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);"> </div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);">Thera are no problems with 
postgres.</div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);"> </div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);">With Oracle there is a 
funny problem with filter.</div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);">Look at this:</div>

<div style="font-size: 13.3333px; font-family: tahoma; color: rgb(0, 0, 0); 
font-weight: 400; font-style: normal; background: none 0% 0% / auto repeat 
scroll padding-box border-box rgba(0, 0, 0, 0);"> 
<div>foreach($aLayersIdx as $layerIndex) {<br />
  $oLayerK = $oMapK->getLayer($layerIndex);<br />
if ($bDebug) {<br />
  fwrite($f,"layer: ".$oLayerK->name."\r\n");<br 
/>
}</div>

<div>  if ($oLayerK->name == "AVD" && $avd == 
"") {<br />
    $oLayerK->set("status",MS_OFF);<br />
    continue;<br />
  }</div>

<div>  $filter = "";<br />
  switch ($oLayerK->name) {<br />
    case "AVD" :<br />
      $filter = "([ORGID]='".$orgid."' 
AND [FV]='".$fv."' AND [BEV]='".$bev."' 
AND [SKIFTE]='".$skifte."' AND 
[AVD]='".$avd."')";<br />
      $data = "KARTOBJ_SDO FROM 
".$dbowner.".AVD*AVD";<br />
      break;<br />
      <br />
    case "X" :<br />
      $filter = 
"([ID]='".$sessid."')";<br />
      $data = "KARTOBJ_SDO FROM 
".$dbowner.".KARTA*TMP2";<br />
      break;<br />
  }<br />
  <br />
  $data = str_replace("*","$",$data);<br />
 <br />
  $oLayerK->set("data", $data);<br />
  $oLayerK->setFilter($filter);<br />
  $oLayerK->setConnectionType(MS_ORACLESPATIAL);<br />
  $oLayerK->set("connection", $conn);<br />
  $oLayerK->set("status", MS_ON);<br />
  if ($bDebug) {<br />
    fwrite($f,"connection: ".$conn."\r\n");<br 
/>
    fwrite($f,"filter: ".$filter."\r\n");<br />

    fwrite($f,"data: ".$data."\r\n");<br />
  }  <br />
}</div>

<div> </div>

<div>A mapfile with two layers, 'AVD' and 'X'.</div>

<div>Problem is that filter for layer 'X' does not work. Or, rather, 
it works but no record is returned. The mapserver debugger reports no 
error.</div>

<div>The filter for layer 'AVD' works fine.</div>

<div> </div>

<div>When the line $filter = 
"[ID]='".$sessid."')" is commented and the table 
KARTA$TMP2 contains only one record it works and a map layer is produced. So 
it seems that when filter is introduced in the select something goes 
wrong.</div>

<div> </div>

<div>I thought that ID might be a reserved word but after some testing I 
found that filter fails in calls to other tables as well.</div>

<div>For example:</div>

<div>This works</div>

<div>     $filter = 
"([ORGID]='".$orgid."' AND 
[FV]='".$fv."' AND 
[BEV]='".$bev."')";</div>

<div>But this does not work</div>

<div><span style="font-family: tahoma; font-size: 13.3333px;">    
 $filter = "([ORGID]='".$orgid."' AND 
[FV]='".$fv."' AND [BEV]='".$bev."' AND 
[SKIFTE]='".$skifte."')";</span></div>

<div> </div>

<div>The problem is consistent in that way that where the problem occurs it 
always occurs, and where it not occurs it never occurs. It is not 
intermittent.</div>

<div> </div>

<div>The php script ( where the snippet came from above ) was developed 
under ms4w version 2.2.7 and at that time no problems occured. I have also 
used version 3.0.6 and 3.1.1 and both versions have problems. So somewhere 
between 2.2.7 and 3.0.6 something happened.</div>

<div> </div>

<div>I am at loss here.</div>

<div> </div>

<div>Björn Danielsson</div>
</div>
</body></html>