[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> int success, apply_window, i;</FONT>
<BR><FONT SIZE=3D2> char query_str[6000];</FONT>
<BR><FONT SIZE=3D2> char table_name[2000], geom_column_name[100], =
srid[100];</FONT>
<BR><FONT SIZE=3D2> OCIDefine *adtp =3D NULL, *items[ARRAY_SIZE] =
=3D { NULL };</FONT>
</P>
<P><FONT SIZE=3D2> /* get layerinfo */</FONT>
<BR><FONT SIZE=3D2> msOracleSpatialLayerInfo *layerinfo =3D =
(msOracleSpatialLayerInfo *)layer->layerinfo;</FONT>
<BR><FONT SIZE=3D2> if (layerinfo =3D=3D NULL) {</FONT>
<BR><FONT SIZE=3D2> msSetError( =
MS_ORACLESPATIALERR,</FONT>
<BR><FONT SIZE=3D2> =
"msOracleSpatialLayerWhichShapes called on unopened =
layer",</FONT>
<BR><FONT SIZE=3D2> =
"msOracleSpatialLayerWhichShapes()" );</FONT>
<BR><FONT SIZE=3D2> return MS_FAILURE;</FONT>
<BR><FONT SIZE=3D2> }</FONT>
</P>
<P><FONT SIZE=3D2> /* allocate enough space for items */</FONT>
<BR><FONT SIZE=3D2> if (layer->numitems > 0) {</FONT>
<BR><FONT SIZE=3D2> layerinfo->items =3D =
(item_text_array *)malloc( sizeof(item_text_array) * layer->numitems =
);</FONT>
<BR><FONT SIZE=3D2> if (layerinfo->items =3D=3D =
NULL) {</FONT>
<BR><FONT SIZE=3D2> msSetError( =
MS_ORACLESPATIALERR,</FONT>
<BR><FONT SIZE=3D2> =
"Cannot allocate items buffer",</FONT>
<BR><FONT SIZE=3D2> =
"msOracleSpatialLayerWhichShapes()" );</FONT>
<BR><FONT SIZE=3D2> return =
MS_FAILURE;</FONT>
<BR><FONT SIZE=3D2> }</FONT>
<BR><FONT SIZE=3D2> }</FONT>
</P>
<P><FONT SIZE=3D2> /* parse geom_column_name and table_name =
*/</FONT>
<BR><FONT SIZE=3D2> if (!msSplitData( layer->data, =
geom_column_name, table_name, srid )) {</FONT>
<BR><FONT SIZE=3D2> msSetError( =
MS_ORACLESPATIALERR,</FONT>
<BR><FONT SIZE=3D2> "Error parsing =
OracleSpatial DATA variable. Must be "</FONT>
<BR><FONT SIZE=3D2> =
"'geometry_column FROM table_name [USING SRID srid#]' or =
"</FONT>
<BR><FONT SIZE=3D2> =
"'geometry_column FROM (SELECT stmt)'.", </FONT>
<BR><FONT SIZE=3D2> =
"msOracleSpatialLayerWhichShapes()" );</FONT>
<BR><FONT SIZE=3D2> return MS_FAILURE;</FONT>
<BR><FONT SIZE=3D2> }</FONT>
</P>
<P><FONT SIZE=3D2> /* define SQL query */</FONT>
<BR><FONT SIZE=3D2> apply_window =3D (table_name[0] !=3D '('); /* =
table isn=B4t a SELECT statement */</FONT>
<BR><FONT SIZE=3D2> strcpy( query_str, "SELECT rownum" =
);</FONT>
<BR><FONT SIZE=3D2> for( i=3D0; i<layer->numitems; ++i =
)</FONT>
<BR><FONT SIZE=3D2> sprintf( query_str + =
strlen(query_str), ", %s", layer->items[i] );</FONT>
<BR><FONT SIZE=3D2> sprintf( query_str + strlen(query_str), =
", %s FROM %s", geom_column_name, table_name );</FONT>
<BR><FONT SIZE=3D2> if (apply_window || layer->filter.string =
!=3D NULL)</FONT>
<BR><FONT SIZE=3D2> strcat( query_str, " WHERE =
" );</FONT>
<BR><FONT SIZE=3D2> if (layer->filter.string !=3D NULL) =
{</FONT>
<BR><FONT SIZE=3D2> strcat( query_str, =
layer->filter.string );</FONT>
<BR><FONT SIZE=3D2> if (apply_window) strcat( =
query_str, " AND " );</FONT>
<BR><FONT SIZE=3D2> }</FONT>
<BR><FONT SIZE=3D2> if (applywindow){</FONT>
<BR><FONT SIZE=3D2> if =
(srid>=3D8192)&&(srid<=3D8316){</FONT>
<BR><FONT SIZE=3D2> sprintf( query_str + =
strlen(query_str),</FONT>
<BR><FONT SIZE=3D2> =
"SDO_FILTER( %s.%s, SDO_CS.VIEWPORT_TRANSFORM("</FONT>
<BR><FONT =
SIZE=3D2> =
"MDSYS.SDO_GEOMETRY("</FONT>
<BR><FONT =
SIZE=3D2> =
"2003, 0, NULL,"</FONT>
<BR><FONT =
SIZE=3D2> =
"MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),"</FONT>
<BR><FONT =
SIZE=3D2> =
"MDSYS.SDO_ORDINATE_ARRAY(%.9g,%.9g,%.9g,%.9g) ), =
%s),"</FONT>
<BR><FONT SIZE=3D2> =
"'querytype=3Dwindow') =3D 'TRUE'",</FONT>
<BR><FONT SIZE=3D2> =
table_name, geom_column_name,</FONT>
<BR><FONT SIZE=3D2> =
rect.minx, rect.miny, rect.maxx, rect.maxy, srid )}</FONT>
<BR><FONT SIZE=3D2> else</FONT>
<BR><FONT SIZE=3D2> {sprintf( query_str + =
strlen(query_str),</FONT>
<BR><FONT SIZE=3D2> =
"SDO_FILTER( %s.%s, MDSYS.SDO_GEOMETRY("</FONT>
<BR><FONT =
SIZE=3D2> =
"2003, %s, NULL,"</FONT>
<BR><FONT =
SIZE=3D2> =
"MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),"</FONT>
<BR><FONT =
SIZE=3D2> =
"MDSYS.SDO_ORDINATE_ARRAY(%.9g,%.9g,%.9g,%.9g) ),"</FONT>
<BR><FONT SIZE=3D2> =
"'querytype=3Dwindow') =3D 'TRUE'",</FONT>
<BR><FONT SIZE=3D2> =
table_name, geom_column_name, srid,</FONT>
<BR><FONT SIZE=3D2> =
rect.minx, rect.miny, rect.maxx, rect.maxy )</FONT>
<BR><FONT SIZE=3D2> }</FONT>
<BR><FONT SIZE=3D2> };</FONT>
</P>
<P><FONT SIZE=3D2> /* parse and execute SQL query */</FONT>
<BR><FONT SIZE=3D2> success =3D TRY( layerinfo,</FONT>
<BR><FONT SIZE=3D2> /* prepare */</FONT>
<BR><FONT SIZE=3D2> OCIStmtPrepare( =
layerinfo->stmthp, layerinfo->errhp, (text *)query_str, =
(ub4)strlen(query_str), (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT) =
);</FONT></P>
<P><FONT SIZE=3D2> if (success && layer->numitems > =
0) {</FONT>
<BR><FONT SIZE=3D2> for( i=3D0; =
i<layer->numitems && success; ++i )</FONT>
<BR><FONT SIZE=3D2> success =3D TRY( =
layerinfo,</FONT>
<BR><FONT SIZE=3D2> =
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 ) );</FONT></P>
<P><FONT SIZE=3D2> }</FONT>
</P>
<P><FONT SIZE=3D2> if (success) {</FONT>
<BR><FONT SIZE=3D2> success =3D TRY( =
layerinfo,</FONT>
<BR><FONT SIZE=3D2> /* define spatial =
position adtp ADT object */</FONT>
<BR><FONT SIZE=3D2> 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) )</FONT></P>
<P><FONT SIZE=3D2> && TRY( layerinfo,</FONT>
<BR><FONT SIZE=3D2> /* define object tdo =
from adtp */</FONT>
<BR><FONT SIZE=3D2> OCIDefineObject( =
adtp, layerinfo->errhp, layerinfo->tdo, (dvoid =
**)layerinfo->obj, (ub4 *)0, (dvoid **)layerinfo->ind, (ub4 *)0 ) =
)</FONT></P>
<P><FONT SIZE=3D2> && TRY( layerinfo,</FONT>
<BR><FONT SIZE=3D2> /* execute */</FONT>
<BR><FONT SIZE=3D2> OCIStmtExecute( =
layerinfo->svchp, layerinfo->stmthp, layerinfo->errhp, =
(ub4)ARRAY_SIZE, (ub4)0, (OCISnapshot *)NULL, (OCISnapshot *)NULL, =
(ub4)OCI_DEFAULT ) )</FONT></P>
<P><FONT SIZE=3D2> && TRY( =
layerinfo,</FONT>
<BR><FONT SIZE=3D2> /* get rows fetched =
*/</FONT>
<BR><FONT SIZE=3D2> OCIAttrGet( (dvoid =
*)layerinfo->stmthp, (ub4)OCI_HTYPE_STMT, (dvoid =
*)&layerinfo->rows_fetched, (ub4 *)0, (ub4)OCI_ATTR_ROW_COUNT, =
layerinfo->errhp ) );</FONT></P>
<P><FONT SIZE=3D2> }</FONT>
</P>
<P><FONT SIZE=3D2> if (!success)</FONT>
<BR><FONT SIZE=3D2> sprintf( last_oci_call_ms_error + =
strlen(last_oci_call_ms_error), ". SQL statement: %s", =
query_str );</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2> if (ERROR( =
"msOracleSpatialLayerWhichShapes()", layerinfo ))</FONT>
<BR><FONT SIZE=3D2> return MS_FAILURE;</FONT>
</P>
<P><FONT SIZE=3D2> /* should begin processing first row */</FONT>
<BR><FONT SIZE=3D2> layerinfo->row_num =3D layerinfo->row =
=3D 0; </FONT>
</P>
<P><FONT SIZE=3D2> 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 & 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> </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> It's very nice.</FONT>
<BR><FONT SIZE=3D2> 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> 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> Any hints?</FONT>
<BR><FONT SIZE=3D2> 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>> Smith, Michael ERDC-CRREL-NH wrote:</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>>> Frank,</FONT>
<BR><FONT SIZE=3D2>>></FONT>
<BR><FONT SIZE=3D2>>> What extra would it take to extend the =
connection pooling to Oracle. </FONT>
<BR><FONT SIZE=3D2>>> We may be able to provide that.</FONT>
<BR><FONT SIZE=3D2>>> If not for 4.4, then for 4.5.</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> Mike,</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> My intention is to define fairly clear =
instructions on how to take </FONT>
<BR><FONT SIZE=3D2>> advantage of a "new" connection =
pooling API and those instructions </FONT>
<BR><FONT SIZE=3D2>> should make it pretty clear how it could be =
used. Basically, I am </FONT>
<BR><FONT SIZE=3D2>> looking at an API like this:</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> void MS_DLL_EXPORT *msConnPoolRequest( layerObj =
*layer ); void </FONT>
<BR><FONT SIZE=3D2>> MS_DLL_EXPORT *msConnPoolRelease( layerObj =
*layer, void * ); void </FONT>
<BR><FONT SIZE=3D2>> MS_DLL_EXPORT msConnPoolRegister( =
layerObj *layer,</FONT>
<BR><FONT =
SIZE=3D2>>  =
;  =
;  =
; void *connect_handle,</FONT>
<BR><FONT =
SIZE=3D2>>  =
;  =
;  =
; void (*close)( void * ) ); =
</FONT>
<BR><FONT SIZE=3D2>> void MS_DLL_EXPORT =
msConnPoolMapDrawComplete(); void MS_DLL_EXPORT </FONT>
<BR><FONT SIZE=3D2>> msConnPoolFinalCleanup();</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> Particular format providers that want to =
support connection pooling </FONT>
<BR><FONT SIZE=3D2>> will call msConnPoolRequest() with their =
layer. The connection </FONT>
<BR><FONT SIZE=3D2>> pooling code will look at the CONNECTION and =
CONNECTIONTYPE string, </FONT>
<BR><FONT SIZE=3D2>> and see if there is an existing handle =
associated with that pair. If </FONT>
<BR><FONT SIZE=3D2>> so, it will be returned (as a void *).</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> If not, the provider establishes a connection =
and then registers it </FONT>
<BR><FONT SIZE=3D2>> with msConnPoolRegister(), along with a =
function to be called when it </FONT>
<BR><FONT SIZE=3D2>> should be closed.</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> When the LayerClose function is called for the =
provider, it would call</FONT>
<BR><FONT SIZE=3D2>> msConnPoolRelease() and the connection pooling =
code would decide </FONT>
<BR><FONT SIZE=3D2>> whether to invoke the low level close() or =
not.</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> The connection pooling API would inspect some =
keyword(s) on the layer </FONT>
<BR><FONT SIZE=3D2>> to determine whether to keep a connection =
alive, or let it close </FONT>
<BR><FONT SIZE=3D2>> immediately after the last release against =
it. I expect to use </FONT>
<BR><FONT SIZE=3D2>> PROCESSING options for this for now, though we =
might introduce a first </FONT>
<BR><FONT SIZE=3D2>> class keyword for this at a later date.</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> So, I believe that updating particular =
providers such as the Oracle, </FONT>
<BR><FONT SIZE=3D2>> SDE, PostGIS, or OGR ones would be pretty =
straight forward. The main </FONT>
<BR><FONT SIZE=3D2>> issue would be that it be done by some who can =
test if the code </FONT>
<BR><FONT SIZE=3D2>> changes work.</FONT>
<BR><FONT SIZE=3D2>> Ideally the</FONT>
<BR><FONT SIZE=3D2>> Oracle connecton maintainers would implement =
(or at least test) </FONT>
<BR><FONT SIZE=3D2>> changes for this.</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> The actual work is likely not enough to justify =
cutting a contract of </FONT>
<BR><FONT SIZE=3D2>> some kind if that is what you are =
thinking.</FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> 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