<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;"><div><span style="font-family: Calibri; font-size: 15px;">Björn,</span></div><div><span style="font-family: Calibri; font-size: 15px;"><br></span></div><div><span style="font-family: Calibri; font-size: 15px;">Can you turn on DEBUG level 3 and show what queries are being generated? </span></div><div><span style="font-family: Calibri; font-size: 15px;"><br></span></div><div><span style="font-family: Calibri; font-size: 15px;">That will help isolate whats going on with the queries to the backend.</span></div><div><span style="font-family: Calibri; font-size: 15px;"><br></span></div><div><span style="font-family: Calibri; font-size: 15px;">Mike</span></div><div><span style="font-family: Calibri; font-size: 15px;"><br></span></div><div><div><div><div>-- </div><div>Michael Smith</div></div><div>Remote Sensing/GIS Center</div><div>US Army Corps of Engineers</div></div></div><span id="OLK_SRC_BODY_SECTION"><div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><span style="font-weight:bold">From: </span> mapserver-dev <<a href="mailto:mapserver-dev-bounces@lists.osgeo.org">mapserver-dev-bounces@lists.osgeo.org</a>> on behalf of Björn Danielsson <<a href="mailto:bjorn.danielsson@falubo.se">bjorn.danielsson@falubo.se</a>><br><span style="font-weight:bold">Date: </span> Thursday, January 14, 2016 at  4:30 AM<br><span style="font-weight:bold">To: </span> "<a href="mailto:mapserver-dev@lists.osgeo.org">mapserver-dev@lists.osgeo.org</a>" <<a href="mailto:mapserver-dev@lists.osgeo.org">mapserver-dev@lists.osgeo.org</a>><br><span style="font-weight:bold">Subject: </span> [EXTERNAL] [mapserver-dev] Problem with filter in Oracle<br><span style="font-weight:bold">Resent-From: </span> Michael Smith <<a href="mailto:michael.smith@usace.army.mil">michael.smith@usace.army.mil</a>><br></div><div><br></div><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;"><div><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><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);">
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></div></div></blockquote></span></body></html>