[mapserver-dev] PATCH: output CONNECTIONTYPE for join object

strk strk at keybit.net
Tue Apr 20 16:39:15 EDT 2010


A patch is attached for review.
It implements output for CONNECTIONTYPE parameter of JOIN
object, currently just ignored.

I didn't actually test myself yet.

--strk;

On Tue, Apr 20, 2010 at 05:09:25PM +0200, strk wrote:
> Hi all,
> I'm trying to setup a JOIN between a PostgreSQL table
> and a CSV file.
> 
> Documentation [1] contains an example of Shapfile to CSV,
> I tried it with POSTGIS to CSV but didn't have luck.
> 
> In particular, I get this error:
> 
>    msDBFJoinConnect(): Unable to access file.
> 
> I have NOT specified a CONNECTIONTYPE, and the documentation
> says that's supposed to just work with CSV, so can't understand
> why msDBFJoinConnect is being called.
> 
> I've taken a look at the mapserver trunk code and found
> that a join's connectiontype is initialized to XBASE
> 
>  mapfile.c:void initJoin(joinObj *join):
>    join->connectiontype = MS_DB_XBASE;
> 
> So I tried explicitly asking for CSV instead, adding a CONNECTIONTYPE
> string. BUT, I'm doing the mapfile using mapscript and I don't
> find the CONNECTIONTYPE part in the resulting mapfile after save.
> No wonder, as the JOIN writer isn't writing anything for that !
> 
>  ref: mapfile.c:static void writeJoin(joinObj *join, FILE *stream)
> 
> Can we call it a couple of bugs ?
> 
> 
> [1] http://mapserver.org/mapfile/join.html
> 
> 
> --strk;
> 
>   ()   Free GIS & Flash consultant/developer
>   /\   http://strk.keybit.net/services.html
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev

-- 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
-------------- next part --------------
Index: mapfile.c
===================================================================
--- mapfile.c	(revision 10107)
+++ mapfile.c	(working copy)
@@ -566,6 +566,19 @@
   if(join->name) fprintf(stream, "        NAME \"%s\"\n", join->name);
   if(join->table) fprintf(stream, "        TABLE \"%s\"\n", join->table);
   if(join->to) fprintf(stream, "        TO \"%s\"\n", join->to);
+  switch (join->connectiontype) {
+  case(MS_DB_CSV):
+    fprintf(stream, "        CONNECTIONTYPE csv\n");
+    break;
+  case(MS_DB_MYSQL):
+    fprintf(stream, "        CONNECTIONTYPE mysql\n");
+    break;
+  case(MS_DB_POSTGRES):
+    fprintf(stream, "        CONNECTIONTYPE postgresql\n");
+    break;
+  default:
+    break;
+  }
   fprintf(stream, "        TYPE %s\n", msJoinType[join->type]);
   fprintf(stream, "      END\n");
 }


More information about the mapserver-dev mailing list