Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jul 2000 18:25:28 -0400 (EDT)
From:      Mikhail Teterin <mi@privatelabs.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/19874: databases/mysqltcl port refreshed
Message-ID:  <200007122225.SAA07284@misha.privatelabs.com>

next in thread | raw e-mail | index | archive | help

>Number:         19874
>Category:       ports
>Synopsis:       databases/mysqltcl port refreshed
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 12 15:30:04 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Mikhail Teterin
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
Virtual Estates, Inc.
>Environment:

>Description:

	This changes do the following things:
		. make use of the (now latest) Tcl-8.3
		. update the MASTER_SITES
		. make the software actually use some of the Tcl-8.3
		  features (which is why patch-aa grew so much) --
		  especially -- get rid of most of the direct references
		  to interp->result; more should be done here...

>How-To-Repeat:

>Fix:


--- Makefile	Sat Apr  8 18:48:36 2000
+++ Makefile	Wed Jul 12 16:34:12 2000
@@ -9,4 +9,4 @@
 PORTVERSION=	1.53
-CATEGORIES=	databases tcl80
-MASTER_SITES=	http://www.mysql.com/Contrib/
+CATEGORIES=	databases tcl83
+MASTER_SITES=	http://www.mysql.com/Downloads/Contrib/
 
@@ -17,3 +17,3 @@
 
-TCL_VERSION?=	tcl8.0
+TCL_VERSION?=	tcl8.3
 TCL_NODOT=	${TCL_VERSION:S/.//}
--- files/Makefile.bsd	Thu Apr  6 00:07:45 2000
+++ files/Makefile.bsd	Wed Jul 12 17:43:50 2000
@@ -6,3 +6,3 @@
 CFLAGS +=	-I${PREFIX}/include/${TCL_VERSION}/
-CFLAGS +=	-I${PREFIX}/include/mysql/
+CFLAGS +=	-I${PREFIX}/include/mysql/ -Wall
 LDADD  +=	-L${PREFIX}/lib -l${TCL_NODOT}
--- patches/patch-aa	Thu Apr  6 00:07:46 2000
+++ patches/patch-aa	Wed Jul 12 18:20:17 2000
@@ -1,4 +1,31 @@
---- mysqltcl.c.orig	Mon Jul  6 11:35:17 1998
-+++ mysqltcl.c	Wed Sep  1 01:27:44 1999
-@@ -743,5 +743,5 @@
+--- mysqltcl.c	Mon Jul  6 11:35:17 1998
++++ mysqltcl.c	Wed Jul 12 17:46:20 2000
+@@ -34,7 +34,7 @@
+ #include <string.h>
+ #include <ctype.h>
+ #include <unistd.h>
+-
++#include <stdlib.h>
+ 
+ #define MYSQL_HANDLES      15	/* Default number of handles available. */
+ #define MYSQL_BUFF_SIZE	1024	/* Conversion buffer size for various needs. */
+@@ -60,7 +60,7 @@
+ #define MYSQL_HPREFIX_LEN 5
+ 
+ /* Array for status info, and its elements. */
+-static char *MysqlStatusArr = "mysqlstatus";
++#define MysqlStatusArr "mysqlstatus"
+ #define MYSQL_STATUS_CODE "code"
+ #define MYSQL_STATUS_CMD  "command"
+ #define MYSQL_STATUS_MSG  "message"
+@@ -686,7 +686,6 @@
+ Mysqltcl_Init (interp)
+     Tcl_Interp *interp;
+ {
+-  int i;
+   char nbuf[MYSQL_SMALL_SIZE];
+ 
+   /*
+@@ -742,7 +739,7 @@
+    * If this message appears you must change the source code and recompile.
     */
@@ -9 +36,137 @@
      {
+       fprintf (stderr, "*** mysqltcl (mysqltcl.c): handle prefix inconsistency!\n") ;
+@@ -921,13 +917,13 @@
+ 
+   if ((MysqlHandle[hand].result = mysql_store_result (MysqlHandle[hand].mysql)) == NULL)
+     {
+-      (void)strcpy (interp->result, "-1") ;
++      Tcl_SetObjResult(interp, Tcl_NewIntObj(-1));
+     }
+   else
+     {
+       MysqlHandle[hand].res_count = mysql_num_rows (MysqlHandle[hand].result) ;
+       MysqlHandle[hand].col_count = mysql_num_fields (MysqlHandle[hand].result) ;
+-      (void)sprintf (interp->result, "%d", MysqlHandle[hand].res_count) ;
++      Tcl_SetObjResult(interp, Tcl_NewIntObj(MysqlHandle[hand].res_count));
+     }
+ 
+   return TCL_OK;
+@@ -1073,7 +1069,7 @@
+ 	MysqlHandle[hand].res_count = total - row;
+       }
+ 
+-    (void)sprintf (interp->result, "%d", MysqlHandle[hand].res_count) ;
++    Tcl_SetObjResult(interp, Tcl_NewIntObj(MysqlHandle[hand].res_count));
+     return TCL_OK;
+ }
+ 
+@@ -1244,7 +1240,7 @@
+     {
+     case MYSQL_INFNAME_OPT:
+     case MYSQL_INFNAMEQ_OPT:
+-      strcpy (interp->result, MysqlHandle[hand].database) ;
++      Tcl_SetResult(interp, MysqlHandle[hand].database, TCL_STATIC);
+       break ;
+     case MYSQL_INFTABLES_OPT:
+       if ((list = mysql_list_tables (MysqlHandle[hand].mysql,(char*)NULL)) == NULL)
+@@ -1259,7 +1255,7 @@
+       break ;
+     case MYSQL_INFHOST_OPT:
+     case MYSQL_INFHOSTQ_OPT:
+-      strcpy (interp->result, MysqlHandle[hand].host) ;
++      Tcl_SetResult(interp, MysqlHandle[hand].host, TCL_STATIC);
+       break ;
+     case MYSQL_INFLIST_OPT:
+       if ((list = mysql_list_dbs (MysqlHandle[hand].mysql,(char*)NULL)) == NULL)
+@@ -1299,8 +1295,6 @@
+   int count ;
+   int hand ;
+   int idx ;
+-  MYSQL_RES* list ;
+-  MYSQL_ROW row ;
+ 
+ 
+   /* We can't fully check the handle at this stage. */
+@@ -1342,19 +1336,20 @@
+     {
+     case MYSQL_RESROWS_OPT:
+     case MYSQL_RESROWSQ_OPT:
+-      sprintf (interp->result, "%d", MysqlHandle[hand].res_count) ;
++      count = MysqlHandle[hand].res_count;
+       break ;
+     case MYSQL_RESCOLS_OPT:
+     case MYSQL_RESCOLSQ_OPT:
+-      sprintf (interp->result, "%d", MysqlHandle[hand].col_count) ;
++      count = MysqlHandle[hand].col_count;
+       break ;
+     case MYSQL_RESCUR_OPT:
+     case MYSQL_RESCURQ_OPT:
+-      sprintf (interp->result, "%d", mysql_num_rows (MysqlHandle[hand].result)
+-	       - MysqlHandle[hand].res_count) ;
++      count = mysql_num_rows (MysqlHandle[hand].result)
++               - MysqlHandle[hand].res_count;
+     default:
+-      ;
++      return TCL_OK; /* none of the above -- return without touching result */
+     }
++  Tcl_SetObjResult(interp, Tcl_NewIntObj(count));
+   return TCL_OK ;
+ }
+ 
+@@ -1500,8 +1495,12 @@
+   int hi;
+   char* hp ;
+   int numeric ;
+-  char* res ;
+-  
++  register short res;
++
++  static const char *states[] = {
++    "NOT_A_HANDLE", "UNCONNECTED", "CONNECTED", "IN_USE", "RESULT_PENDING"
++  };
++
+   if (mysql_prologue(interp, argc, argv, 2, NULL, "?-numeric? handle") < 0)
+     return TCL_ERROR;
+ 
+@@ -1511,17 +1510,18 @@
+   hp = (numeric)?argv[2]:argv[1] ;
+ 
+   if (HSYNTAX(hp,hi) < 0)
+-    res = (numeric)?"0":"NOT_A_HANDLE" ;
++    res = 0;
+   else if (MysqlHandle[hi].connection == 0)
+-    res = (numeric)?"1":"UNCONNECTED" ;
++    res = 1;
+   else if (MysqlHandle[hi].database[0] == '\0')
+-    res = (numeric)?"2":"CONNECTED" ;
++    res = 2;
+   else if (MysqlHandle[hi].result == NULL)
+-    res = (numeric)?"3":"IN_USE" ;
++    res = 3;
+   else
+-    res = (numeric)?"4":"RESULT_PENDING" ;
++    res = 4;
+ 
+-  (void)strcpy (interp->result, res) ;
++  if (numeric) Tcl_SetObjResult(interp, Tcl_NewIntObj(res));
++  else Tcl_SetResult(interp, (char *)states[res], TCL_STATIC);
+   return TCL_OK ;
+ }
+ 
+@@ -1543,7 +1543,6 @@
+      char       **argv;
+ {
+   int hand;
+-  char* res ;
+   MYSQL* mysql;
+   
+   if ((hand = mysql_prologue(interp, argc, argv, 2, get_handle_conn,
+@@ -1552,7 +1551,7 @@
+ 
+   mysql = MysqlHandle[hand].mysql;
+ 
+-  (void)sprintf (interp->result, "%d", mysql_insert_id(mysql)) ;
++  Tcl_SetObjResult(interp, Tcl_NewIntObj(mysql_insert_id(mysql)));
+ 
+   return TCL_OK;
+ }
--- patches/patch-ab	Thu Apr  6 00:07:47 2000
+++ patches/patch-ab	Wed Jul 12 16:35:45 2000
@@ -1,2 +1,2 @@
---- mysqltcl.n.orig	Mon Jul  6 12:04:27 1998
+--- mysqltcl.n	Mon Jul  6 12:04:27 1998
 +++ mysqltcl.n	Wed Sep  1 01:52:23 1999
--- pkg/DESCR	Thu Apr  6 00:07:48 2000
+++ pkg/DESCR	Wed Jul 12 18:19:47 2000
@@ -12 +12,4 @@
        replace appropriate occurrences of msql by MySQL.
+
+This port makes  use of some of  the Tcl-8.x niceties, but  more on that
+front can be done.

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007122225.SAA07284>