Support the standard ZOOM options "serverImplementationId",
authorMike Taylor <mike@indexdata.com>
Mon, 24 Nov 2003 11:25:07 +0000 (11:25 +0000)
committerMike Taylor <mike@indexdata.com>
Mon, 24 Nov 2003 11:25:07 +0000 (11:25 +0000)
"serverImplementationName" and "serverImplementationVersion" (as
specified in the forthcoming AAPI 1.4), but continue also to support
the old "targetImplementationId", "targetImplementationName" and
"targetImplementationVersion" for the benefit of old applications.)

src/zoom-c.c

index 492c190..0c3e85f 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 2000-2003, Index Data
  * See the file LICENSE for details.
  *
  * Copyright (c) 2000-2003, Index Data
  * See the file LICENSE for details.
  *
- * $Id: zoom-c.c,v 1.4 2003-11-19 19:07:26 adam Exp $
+ * $Id: zoom-c.c,v 1.5 2003-11-24 11:25:07 mike Exp $
  *
  * ZOOM layer for C, connections, result sets, queries.
  */
  *
  * ZOOM layer for C, connections, result sets, queries.
  */
@@ -928,7 +928,7 @@ static zoom_ret ZOOM_connection_send_init (ZOOM_connection c)
     
     impver = ZOOM_options_get (c->options, "implementationVersion");
     ireq->implementationVersion =
     
     impver = ZOOM_options_get (c->options, "implementationVersion");
     ireq->implementationVersion =
-       (char *) odr_malloc (c->odr_out, strlen("$Revision: 1.4 $") + 2 +
+       (char *) odr_malloc (c->odr_out, strlen("$Revision: 1.5 $") + 2 +
                             (impver ? strlen(impver) : 0));
     strcpy (ireq->implementationVersion, "");
     if (impver)
                             (impver ? strlen(impver) : 0));
     strcpy (ireq->implementationVersion, "");
     if (impver)
@@ -936,7 +936,7 @@ static zoom_ret ZOOM_connection_send_init (ZOOM_connection c)
        strcat (ireq->implementationVersion, impver);
        strcat (ireq->implementationVersion, "/");
     }                                         
        strcat (ireq->implementationVersion, impver);
        strcat (ireq->implementationVersion, "/");
     }                                         
-    strcat (ireq->implementationVersion, "$Revision: 1.4 $");
+    strcat (ireq->implementationVersion, "$Revision: 1.5 $");
 
     *ireq->maximumRecordSize =
        ZOOM_options_get_int (c->options, "maximumRecordSize", 1024*1024);
 
     *ireq->maximumRecordSize =
        ZOOM_options_get_int (c->options, "maximumRecordSize", 1024*1024);
@@ -2565,6 +2565,16 @@ static void handle_apdu (ZOOM_connection c, Z_APDU *apdu)
     {
     case Z_APDU_initResponse:
        initrs = apdu->u.initResponse;
     {
     case Z_APDU_initResponse:
        initrs = apdu->u.initResponse;
+        ZOOM_connection_option_set(c, "serverImplementationId",
+                                   initrs->implementationId ?
+                                   initrs->implementationId : "");
+        ZOOM_connection_option_set(c, "serverImplementationName",
+                                   initrs->implementationName ?
+                                   initrs->implementationName : "");
+        ZOOM_connection_option_set(c, "serverImplementationVersion",
+                                   initrs->implementationVersion ?
+                                   initrs->implementationVersion : "");
+       /* Set the three old options too, for old applications */
         ZOOM_connection_option_set(c, "targetImplementationId",
                                    initrs->implementationId ?
                                    initrs->implementationId : "");
         ZOOM_connection_option_set(c, "targetImplementationId",
                                    initrs->implementationId ?
                                    initrs->implementationId : "");