[Mapserver-dev] FastCGI and MapServer 4.4

Smith, Michael ERDC-CRREL-NH Michael.Smith at erdc.usace.army.mil
Mon Sep 27 15:56:28 EDT 2004


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C4A4CB.533F7CC4
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Fernando,

If you have difficulties, we could probably assist you after Frank =
finishes
the FastCGI api.=20

I also have some code for handling geodetic extents passed to the
apply_window part of msOracleSpatialLayerWhichShapes when a geodetic =
srid is
defined .



/* create SQL statement for retrieving shapes */
int msOracleSpatialLayerWhichShapes( layerObj *layer, rectObj rect )
{
  int success, apply_window, i;
  char query_str[6000];
  char table_name[2000], geom_column_name[100], srid[100];
  OCIDefine *adtp =3D NULL, *items[ARRAY_SIZE] =3D { NULL };

  /* get layerinfo */
  msOracleSpatialLayerInfo *layerinfo =3D (msOracleSpatialLayerInfo
*)layer->layerinfo;
  if (layerinfo =3D=3D NULL) {
    msSetError( MS_ORACLESPATIALERR,
      "msOracleSpatialLayerWhichShapes called on unopened layer",
      "msOracleSpatialLayerWhichShapes()" );
    return MS_FAILURE;
  }

  /* allocate enough space for items */
  if (layer->numitems > 0) {
    layerinfo->items =3D (item_text_array *)malloc( =
sizeof(item_text_array) *
layer->numitems );
    if (layerinfo->items =3D=3D NULL) {
      msSetError( MS_ORACLESPATIALERR,
        "Cannot allocate items buffer",
        "msOracleSpatialLayerWhichShapes()" );
      return MS_FAILURE;
    }
  }

  /* parse geom_column_name and table_name */
  if (!msSplitData( layer->data, geom_column_name, table_name, srid )) =
{
    msSetError( MS_ORACLESPATIALERR,
      "Error parsing OracleSpatial DATA variable. Must be "
      "'geometry_column FROM table_name [USING SRID srid#]' or "
      "'geometry_column FROM (SELECT stmt)'.",=20
      "msOracleSpatialLayerWhichShapes()" );
    return MS_FAILURE;
  }

  /* define SQL query */
  apply_window =3D (table_name[0] !=3D '('); /* table isn=B4t a SELECT =
statement
*/
  strcpy( query_str, "SELECT rownum" );
  for( i=3D0; i<layer->numitems; ++i )
    sprintf( query_str + strlen(query_str), ", %s", layer->items[i] );
  sprintf( query_str + strlen(query_str), ", %s FROM %s", =
geom_column_name,
table_name );
  if (apply_window || layer->filter.string !=3D NULL)
    strcat( query_str, " WHERE " );
  if (layer->filter.string !=3D NULL) {
    strcat( query_str, layer->filter.string );
    if (apply_window) strcat( query_str, " AND " );
  }
  if (applywindow){
  if (srid>=3D8192)&&(srid<=3D8316){
  sprintf( query_str + strlen(query_str),
        "SDO_FILTER( %s.%s, SDO_CS.VIEWPORT_TRANSFORM("
          "MDSYS.SDO_GEOMETRY("
          "2003, 0, NULL,"
          "MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),"
          "MDSYS.SDO_ORDINATE_ARRAY(%.9g,%.9g,%.9g,%.9g) ), %s),"
        "'querytype=3Dwindow') =3D 'TRUE'",
        table_name, geom_column_name,
        rect.minx, rect.miny, rect.maxx, rect.maxy, srid )}
  else
    {sprintf( query_str + strlen(query_str),
        "SDO_FILTER( %s.%s, MDSYS.SDO_GEOMETRY("
          "2003, %s, NULL,"
          "MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),"
          "MDSYS.SDO_ORDINATE_ARRAY(%.9g,%.9g,%.9g,%.9g) ),"
        "'querytype=3Dwindow') =3D 'TRUE'",
        table_name, geom_column_name, srid,
        rect.minx, rect.miny, rect.maxx, rect.maxy )
        }
      };

  /* parse and execute SQL query */
  success =3D TRY( layerinfo,
    /* prepare */
    OCIStmtPrepare( layerinfo->stmthp, layerinfo->errhp, (text =
*)query_str,
(ub4)strlen(query_str), (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT) );

  if (success && layer->numitems > 0) {
    for( i=3D0; i<layer->numitems && success; ++i )
      success =3D TRY( layerinfo,
        OCIDefineByPos( layerinfo->stmthp, &items[i], layerinfo->errhp,
(ub4)i+2, (dvoid *)layerinfo->items[i], (sb4)TEXT_SIZE, SQLT_STR, =
(dvoid
*)0, (ub2 *)0, (ub2 *)0, (ub4)OCI_DEFAULT ) );
  }

  if (success) {
    success =3D TRY( layerinfo,
      /* define spatial position adtp ADT object */
      OCIDefineByPos( layerinfo->stmthp, &adtp, layerinfo->errhp,
(ub4)layer->numitems+2, (dvoid *)0, (sb4)0, SQLT_NTY, (dvoid *)0, (ub2 =
*)0,
(ub2 *)0, (ub4)OCI_DEFAULT) )
    && TRY( layerinfo,
      /* define object tdo from adtp */
      OCIDefineObject( adtp, layerinfo->errhp, layerinfo->tdo, (dvoid
**)layerinfo->obj, (ub4 *)0, (dvoid **)layerinfo->ind, (ub4 *)0 ) )
    && TRY( layerinfo,
      /* execute */
      OCIStmtExecute( layerinfo->svchp, layerinfo->stmthp, =
layerinfo->errhp,
(ub4)ARRAY_SIZE, (ub4)0, (OCISnapshot *)NULL, (OCISnapshot *)NULL,
(ub4)OCI_DEFAULT ) )
    &&  TRY( layerinfo,
      /* get rows fetched */
      OCIAttrGet( (dvoid *)layerinfo->stmthp, (ub4)OCI_HTYPE_STMT, =
(dvoid
*)&layerinfo->rows_fetched, (ub4 *)0, (ub4)OCI_ATTR_ROW_COUNT,
layerinfo->errhp ) );
  }

  if (!success)
    sprintf( last_oci_call_ms_error + strlen(last_oci_call_ms_error), =
". SQL
statement: %s", query_str );
 =20
  if (ERROR( "msOracleSpatialLayerWhichShapes()", layerinfo ))
    return MS_FAILURE;

  /* should begin processing first row */
  layerinfo->row_num =3D layerinfo->row =3D 0;=20

  return MS_SUCCESS;
}


Mike Smith
GIS Specialist/Physical Scientist/Oracle Developer
Remote Sensing/GIS Center of Expertise
Army Engineer Research & Development Center=20
Hanover, NH
(603) 646-4765
michael.smith at erdc.usace.army.mil

=20

-----Original Message-----
From: Fernando S. [mailto:simon at inf.univali.br]=20
Sent: Monday, September 27, 2004 3:34 PM
To: Frank Warmerdam; mapserver-dev at lists.gis.umn.edu
Subject: Re: [Mapserver-dev] FastCGI and MapServer 4.4

Hi,
    It's very nice.
    I started to write something for maporaclespatial some weeks ago. I
liked the fastcgi idea but when do you intend to include this feature =
in the
code? In the next version? 4.4 or 4.6?
    I intend to start write oracle/fastcgi in the next week. But I =
don't
know if I can to finish until October. So, what can I follow? Exist any =
step
by step or a how to use for fastcgi?
    Any hints?
    Sorry my english.


----------------------------------------------------------------
Fernando Simon - simon at inf.univali.br
G10 - Laboratorio de Computacao Aplicada http://g10.cttmar.univali.br
----------------------------------------------------------------



Frank Warmerdam wrote:

> Smith, Michael ERDC-CRREL-NH wrote:
>
>> Frank,
>>
>> What extra would it take to extend the connection pooling to Oracle. =
=20
>> We may be able to provide that.
>> If not for 4.4, then for 4.5.
>
>
> Mike,
>
> My intention is to define fairly clear instructions on how to take=20
> advantage of a "new" connection pooling API and those instructions=20
> should make it pretty clear how it could be used.  Basically, I am=20
> looking at an API like this:
>
> void MS_DLL_EXPORT *msConnPoolRequest( layerObj *layer ); void=20
> MS_DLL_EXPORT *msConnPoolRelease( layerObj *layer, void * ); void=20
> MS_DLL_EXPORT  msConnPoolRegister( layerObj *layer,
>                                         void *connect_handle,
>                                         void (*close)( void * ) );=20
> void MS_DLL_EXPORT  msConnPoolMapDrawComplete(); void MS_DLL_EXPORT =20
> msConnPoolFinalCleanup();
>
> Particular format providers that want to support connection pooling=20
> will call msConnPoolRequest() with their layer.  The connection=20
> pooling code will look at the CONNECTION and CONNECTIONTYPE string,=20
> and see if there is an existing handle associated with that pair.  If =

> so, it will be returned (as a void *).
>
> If not, the provider establishes a connection and then registers it=20
> with msConnPoolRegister(), along with a function to be called when it =

> should be closed.
>
> When the LayerClose function is called for the provider, it would =
call
> msConnPoolRelease() and the connection pooling code would decide=20
> whether to invoke the low level close() or not.
>
> The connection pooling API would inspect some keyword(s) on the layer =

> to determine whether to keep a connection alive, or let it close=20
> immediately after the last release against it.  I expect to use=20
> PROCESSING options for this for now, though we might introduce a =
first=20
> class keyword for this at a later date.
>
> So, I believe that updating particular providers such as the Oracle,=20
> SDE, PostGIS, or OGR ones would be pretty straight forward.  The main =

> issue would be that it be done by some who can test if the code=20
> changes work.
> Ideally the
> Oracle connecton maintainers would implement (or at least test)=20
> changes for this.
>
> The actual work is likely not enough to justify cutting a contract of =

> some kind if that is what you are thinking.
>
> Best regards,


_______________________________________________
Mapserver-dev mailing list
Mapserver-dev at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev

------_=_NextPart_001_01C4A4CB.533F7CC4
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2655.35">
<TITLE>RE: [Mapserver-dev] FastCGI and MapServer 4.4</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Fernando,</FONT>
</P>

<P><FONT SIZE=3D2>If you have difficulties, we could probably assist =
you after Frank finishes the FastCGI api. </FONT>
</P>

<P><FONT SIZE=3D2>I also have some code for handling geodetic extents =
passed to the apply_window part of msOracleSpatialLayerWhichShapes when =
a geodetic srid is defined .</FONT></P>
<BR>
<BR>

<P><FONT SIZE=3D2>/* create SQL statement for retrieving shapes =
*/</FONT>
<BR><FONT SIZE=3D2>int msOracleSpatialLayerWhichShapes( layerObj =
*layer, rectObj rect )</FONT>
<BR><FONT SIZE=3D2>{</FONT>
<BR><FONT SIZE=3D2>&nbsp; int success, apply_window, i;</FONT>
<BR><FONT SIZE=3D2>&nbsp; char query_str[6000];</FONT>
<BR><FONT SIZE=3D2>&nbsp; char table_name[2000], geom_column_name[100], =
srid[100];</FONT>
<BR><FONT SIZE=3D2>&nbsp; OCIDefine *adtp =3D NULL, *items[ARRAY_SIZE] =
=3D { NULL };</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; /* get layerinfo */</FONT>
<BR><FONT SIZE=3D2>&nbsp; msOracleSpatialLayerInfo *layerinfo =3D =
(msOracleSpatialLayerInfo *)layer-&gt;layerinfo;</FONT>
<BR><FONT SIZE=3D2>&nbsp; if (layerinfo =3D=3D NULL) {</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; msSetError( =
MS_ORACLESPATIALERR,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;msOracleSpatialLayerWhichShapes called on unopened =
layer&quot;,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;msOracleSpatialLayerWhichShapes()&quot; );</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; return MS_FAILURE;</FONT>
<BR><FONT SIZE=3D2>&nbsp; }</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; /* allocate enough space for items */</FONT>
<BR><FONT SIZE=3D2>&nbsp; if (layer-&gt;numitems &gt; 0) {</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; layerinfo-&gt;items =3D =
(item_text_array *)malloc( sizeof(item_text_array) * layer-&gt;numitems =
);</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; if (layerinfo-&gt;items =3D=3D =
NULL) {</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msSetError( =
MS_ORACLESPATIALERR,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;Cannot allocate items buffer&quot;,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;msOracleSpatialLayerWhichShapes()&quot; );</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return =
MS_FAILURE;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&nbsp; }</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; /* parse geom_column_name and table_name =
*/</FONT>
<BR><FONT SIZE=3D2>&nbsp; if (!msSplitData( layer-&gt;data, =
geom_column_name, table_name, srid )) {</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; msSetError( =
MS_ORACLESPATIALERR,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Error parsing =
OracleSpatial DATA variable. Must be &quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;'geometry_column FROM table_name [USING SRID srid#]' or =
&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;'geometry_column FROM (SELECT stmt)'.&quot;, </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;msOracleSpatialLayerWhichShapes()&quot; );</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; return MS_FAILURE;</FONT>
<BR><FONT SIZE=3D2>&nbsp; }</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; /* define SQL query */</FONT>
<BR><FONT SIZE=3D2>&nbsp; apply_window =3D (table_name[0] !=3D '('); /* =
table isn=B4t a SELECT statement */</FONT>
<BR><FONT SIZE=3D2>&nbsp; strcpy( query_str, &quot;SELECT rownum&quot; =
);</FONT>
<BR><FONT SIZE=3D2>&nbsp; for( i=3D0; i&lt;layer-&gt;numitems; ++i =
)</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; sprintf( query_str + =
strlen(query_str), &quot;, %s&quot;, layer-&gt;items[i] );</FONT>
<BR><FONT SIZE=3D2>&nbsp; sprintf( query_str + strlen(query_str), =
&quot;, %s FROM %s&quot;, geom_column_name, table_name );</FONT>
<BR><FONT SIZE=3D2>&nbsp; if (apply_window || layer-&gt;filter.string =
!=3D NULL)</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; strcat( query_str, &quot; WHERE =
&quot; );</FONT>
<BR><FONT SIZE=3D2>&nbsp; if (layer-&gt;filter.string !=3D NULL) =
{</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; strcat( query_str, =
layer-&gt;filter.string );</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; if (apply_window) strcat( =
query_str, &quot; AND &quot; );</FONT>
<BR><FONT SIZE=3D2>&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&nbsp; if (applywindow){</FONT>
<BR><FONT SIZE=3D2>&nbsp; if =
(srid&gt;=3D8192)&amp;&amp;(srid&lt;=3D8316){</FONT>
<BR><FONT SIZE=3D2>&nbsp; sprintf( query_str + =
strlen(query_str),</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;SDO_FILTER( %s.%s, SDO_CS.VIEWPORT_TRANSFORM(&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;MDSYS.SDO_GEOMETRY(&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;2003, 0, NULL,&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;MDSYS.SDO_ORDINATE_ARRAY(%.9g,%.9g,%.9g,%.9g) ), =
%s),&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;'querytype=3Dwindow') =3D 'TRUE'&quot;,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
table_name, geom_column_name,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
rect.minx, rect.miny, rect.maxx, rect.maxy, srid )}</FONT>
<BR><FONT SIZE=3D2>&nbsp; else</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; {sprintf( query_str + =
strlen(query_str),</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;SDO_FILTER( %s.%s, MDSYS.SDO_GEOMETRY(&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;2003, %s, NULL,&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;MDSYS.SDO_ORDINATE_ARRAY(%.9g,%.9g,%.9g,%.9g) ),&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&quot;'querytype=3Dwindow') =3D 'TRUE'&quot;,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
table_name, geom_column_name, srid,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
rect.minx, rect.miny, rect.maxx, rect.maxy )</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; /* parse and execute SQL query */</FONT>
<BR><FONT SIZE=3D2>&nbsp; success =3D TRY( layerinfo,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; /* prepare */</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; OCIStmtPrepare( =
layerinfo-&gt;stmthp, layerinfo-&gt;errhp, (text *)query_str, =
(ub4)strlen(query_str), (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT) =
);</FONT></P>

<P><FONT SIZE=3D2>&nbsp; if (success &amp;&amp; layer-&gt;numitems &gt; =
0) {</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; for( i=3D0; =
i&lt;layer-&gt;numitems &amp;&amp; success; ++i )</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; success =3D TRY( =
layerinfo,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
OCIDefineByPos( layerinfo-&gt;stmthp, &amp;items[i], =
layerinfo-&gt;errhp, (ub4)i+2, (dvoid *)layerinfo-&gt;items[i], =
(sb4)TEXT_SIZE, SQLT_STR, (dvoid *)0, (ub2 *)0, (ub2 *)0, =
(ub4)OCI_DEFAULT ) );</FONT></P>

<P><FONT SIZE=3D2>&nbsp; }</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; if (success) {</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; success =3D TRY( =
layerinfo,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* define spatial =
position adtp ADT object */</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OCIDefineByPos( =
layerinfo-&gt;stmthp, &amp;adtp, layerinfo-&gt;errhp, =
(ub4)layer-&gt;numitems+2, (dvoid *)0, (sb4)0, SQLT_NTY, (dvoid *)0, =
(ub2 *)0, (ub2 *)0, (ub4)OCI_DEFAULT) )</FONT></P>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; &amp;&amp; TRY( layerinfo,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* define object tdo =
from adtp */</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OCIDefineObject( =
adtp, layerinfo-&gt;errhp, layerinfo-&gt;tdo, (dvoid =
**)layerinfo-&gt;obj, (ub4 *)0, (dvoid **)layerinfo-&gt;ind, (ub4 *)0 ) =
)</FONT></P>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; &amp;&amp; TRY( layerinfo,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* execute */</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OCIStmtExecute( =
layerinfo-&gt;svchp, layerinfo-&gt;stmthp, layerinfo-&gt;errhp, =
(ub4)ARRAY_SIZE, (ub4)0, (OCISnapshot *)NULL, (OCISnapshot *)NULL, =
(ub4)OCI_DEFAULT ) )</FONT></P>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; &amp;&amp;&nbsp; TRY( =
layerinfo,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* get rows fetched =
*/</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OCIAttrGet( (dvoid =
*)layerinfo-&gt;stmthp, (ub4)OCI_HTYPE_STMT, (dvoid =
*)&amp;layerinfo-&gt;rows_fetched, (ub4 *)0, (ub4)OCI_ATTR_ROW_COUNT, =
layerinfo-&gt;errhp ) );</FONT></P>

<P><FONT SIZE=3D2>&nbsp; }</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; if (!success)</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; sprintf( last_oci_call_ms_error + =
strlen(last_oci_call_ms_error), &quot;. SQL statement: %s&quot;, =
query_str );</FONT>
<BR><FONT SIZE=3D2>&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp; if (ERROR( =
&quot;msOracleSpatialLayerWhichShapes()&quot;, layerinfo ))</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; return MS_FAILURE;</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; /* should begin processing first row */</FONT>
<BR><FONT SIZE=3D2>&nbsp; layerinfo-&gt;row_num =3D layerinfo-&gt;row =
=3D 0; </FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; return MS_SUCCESS;</FONT>
<BR><FONT SIZE=3D2>}</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Mike Smith</FONT>
<BR><FONT SIZE=3D2>GIS Specialist/Physical Scientist/Oracle =
Developer</FONT>
<BR><FONT SIZE=3D2>Remote Sensing/GIS Center of Expertise</FONT>
<BR><FONT SIZE=3D2>Army Engineer Research &amp; Development Center =
</FONT>
<BR><FONT SIZE=3D2>Hanover, NH</FONT>
<BR><FONT SIZE=3D2>(603) 646-4765</FONT>
<BR><FONT SIZE=3D2>michael.smith at erdc.usace.army.mil</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp;</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Fernando S. [<A =
HREF=3D"mailto:simon at inf.univali.br">mailto:simon at inf.univali.br</A>] =
</FONT>
<BR><FONT SIZE=3D2>Sent: Monday, September 27, 2004 3:34 PM</FONT>
<BR><FONT SIZE=3D2>To: Frank Warmerdam; =
mapserver-dev at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2>Subject: Re: [Mapserver-dev] FastCGI and MapServer =
4.4</FONT>
</P>

<P><FONT SIZE=3D2>Hi,</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; It's very nice.</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; I started to write something for =
maporaclespatial some weeks ago. I liked the fastcgi idea but when do =
you intend to include this feature in the code? In the next version? =
4.4 or 4.6?</FONT></P>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; I intend to start write =
oracle/fastcgi in the next week. But I don't know if I can to finish =
until October. So, what can I follow? Exist any step by step or a how =
to use for fastcgi?</FONT></P>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; Any hints?</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; Sorry my english.</FONT>
</P>
<BR>

<P><FONT =
SIZE=3D2>---------------------------------------------------------------=
-</FONT>
<BR><FONT SIZE=3D2>Fernando Simon - simon at inf.univali.br</FONT>
<BR><FONT SIZE=3D2>G10 - Laboratorio de Computacao Aplicada <A =
HREF=3D"http://g10.cttmar.univali.br" =
TARGET=3D"_blank">http://g10.cttmar.univali.br</A></FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------------=
-</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=3D2>Frank Warmerdam wrote:</FONT>
</P>

<P><FONT SIZE=3D2>&gt; Smith, Michael ERDC-CRREL-NH wrote:</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&gt; Frank,</FONT>
<BR><FONT SIZE=3D2>&gt;&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&gt; What extra would it take to extend the =
connection pooling to Oracle.&nbsp; </FONT>
<BR><FONT SIZE=3D2>&gt;&gt; We may be able to provide that.</FONT>
<BR><FONT SIZE=3D2>&gt;&gt; If not for 4.4, then for 4.5.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; Mike,</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; My intention is to define fairly clear =
instructions on how to take </FONT>
<BR><FONT SIZE=3D2>&gt; advantage of a &quot;new&quot; connection =
pooling API and those instructions </FONT>
<BR><FONT SIZE=3D2>&gt; should make it pretty clear how it could be =
used.&nbsp; Basically, I am </FONT>
<BR><FONT SIZE=3D2>&gt; looking at an API like this:</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; void MS_DLL_EXPORT *msConnPoolRequest( layerObj =
*layer ); void </FONT>
<BR><FONT SIZE=3D2>&gt; MS_DLL_EXPORT *msConnPoolRelease( layerObj =
*layer, void * ); void </FONT>
<BR><FONT SIZE=3D2>&gt; MS_DLL_EXPORT&nbsp; msConnPoolRegister( =
layerObj *layer,</FONT>
<BR><FONT =
SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *connect_handle,</FONT>
<BR><FONT =
SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void (*close)( void * ) ); =
</FONT>
<BR><FONT SIZE=3D2>&gt; void MS_DLL_EXPORT&nbsp; =
msConnPoolMapDrawComplete(); void MS_DLL_EXPORT&nbsp; </FONT>
<BR><FONT SIZE=3D2>&gt; msConnPoolFinalCleanup();</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; Particular format providers that want to =
support connection pooling </FONT>
<BR><FONT SIZE=3D2>&gt; will call msConnPoolRequest() with their =
layer.&nbsp; The connection </FONT>
<BR><FONT SIZE=3D2>&gt; pooling code will look at the CONNECTION and =
CONNECTIONTYPE string, </FONT>
<BR><FONT SIZE=3D2>&gt; and see if there is an existing handle =
associated with that pair.&nbsp; If </FONT>
<BR><FONT SIZE=3D2>&gt; so, it will be returned (as a void *).</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; If not, the provider establishes a connection =
and then registers it </FONT>
<BR><FONT SIZE=3D2>&gt; with msConnPoolRegister(), along with a =
function to be called when it </FONT>
<BR><FONT SIZE=3D2>&gt; should be closed.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; When the LayerClose function is called for the =
provider, it would call</FONT>
<BR><FONT SIZE=3D2>&gt; msConnPoolRelease() and the connection pooling =
code would decide </FONT>
<BR><FONT SIZE=3D2>&gt; whether to invoke the low level close() or =
not.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; The connection pooling API would inspect some =
keyword(s) on the layer </FONT>
<BR><FONT SIZE=3D2>&gt; to determine whether to keep a connection =
alive, or let it close </FONT>
<BR><FONT SIZE=3D2>&gt; immediately after the last release against =
it.&nbsp; I expect to use </FONT>
<BR><FONT SIZE=3D2>&gt; PROCESSING options for this for now, though we =
might introduce a first </FONT>
<BR><FONT SIZE=3D2>&gt; class keyword for this at a later date.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; So, I believe that updating particular =
providers such as the Oracle, </FONT>
<BR><FONT SIZE=3D2>&gt; SDE, PostGIS, or OGR ones would be pretty =
straight forward.&nbsp; The main </FONT>
<BR><FONT SIZE=3D2>&gt; issue would be that it be done by some who can =
test if the code </FONT>
<BR><FONT SIZE=3D2>&gt; changes work.</FONT>
<BR><FONT SIZE=3D2>&gt; Ideally the</FONT>
<BR><FONT SIZE=3D2>&gt; Oracle connecton maintainers would implement =
(or at least test) </FONT>
<BR><FONT SIZE=3D2>&gt; changes for this.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; The actual work is likely not enough to justify =
cutting a contract of </FONT>
<BR><FONT SIZE=3D2>&gt; some kind if that is what you are =
thinking.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; Best regards,</FONT>
</P>
<BR>

<P><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>Mapserver-dev mailing list</FONT>
<BR><FONT SIZE=3D2>Mapserver-dev at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev" =
TARGET=3D"_blank">http://lists.gis.umn.edu/mailman/listinfo/mapserver-de=
v</A></FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C4A4CB.533F7CC4--



More information about the mapserver-dev mailing list