[Zope] ZMySQLDA compilation problems]

Mike Schmitz mschmitz@colug.org
Mon, 25 Oct 1999 18:18:03 -0700


--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii

Please help me.  I need to have the MySQL adapter working.  My previous 
message is attached.

-- 
  Mike Schmitz     mschmitz@colug.org     http://mschmitz.colug.org/
  Don't blame me - I voted libertarian!   http://www.lp.org/
  Use Debian Linux - the free Gnu/Linux   http://www.debian.org/
				  -----------        
      "If encryption is outlawed, only outlaws will have encryption" 

--huq684BweRXVnRxX
Content-Type: message/rfc822
Content-Description: Forwarded message from Mike Schmitz <mschmitz@colug.org>

Message-ID: <19991021154038.A261@colug.org>
Date: Thu, 21 Oct 1999 15:40:38 -0700
From: Mike Schmitz <mschmitz@colug.org>
To: Junio Hamano <junio@twinsun.com>
Cc: zope@zope.org
Subject: Re: [Zope] ZMySQLDA compilation problems
References: <19991020200523.A28321@colug.org> <7vbt9tb2ge.fsf@shine.twinsun.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 0.93.2i
In-Reply-To: <7vbt9tb2ge.fsf@shine.twinsun.com>; from Junio Hamano on Thu, Oct 21, 1999 at 12:25:05AM -0700

On Thu, Oct 21, 1999 at 12:25:05AM -0700, Junio Hamano wrote:
> The header file mysql.h has changed the definition of
> mysql_fetch_field_direct between 3.22.25 and 3.22.27.
> MySQLmodule.c as written upstream assumes 3.22.25 style
> definition.  Here is a quick patch.
> 
> --- MySQLmodule.c	1999/10/20 05:25:09	1.4
> +++ MySQLmodule.c	1999/10/20 05:33:24
> @@ -158,6 +158,11 @@
>  
>  #include "Python.h"
>  #include "mysql.h"
> +#if MYSQL_VERSION_ID > 32225
> +#define Mysql_fetch_field_direct(a,b) mysql_fetch_field_direct(a,b)
> +#else
> +#define Mysql_fetch_field_direct(a,b) &(mysql_fetch_field_direct(a,b))
> +#endif
>  
>  static char MySQL_Version[] = "MySQLmodule-1.4: A Python interface to the MySQL database.";
>  
> @@ -232,7 +237,7 @@
>      PyObject *rowlist, *fieldobj;
>      MYSQL_FIELD *tf;
>      int i, n;
> -    unsigned int *lengths;
> +    unsigned long *lengths;
>  
>      n = mysql_num_fields(res);
>      lengths = mysql_fetch_lengths(res);
> @@ -381,7 +386,7 @@
>      if (reslist == NULL) return NULL;
>      n = mysql_num_fields(res);
>      for (i = 0; i < n; i++) {
> -        tf = &(mysql_fetch_field_direct(res, i));
> +        tf = Mysql_fetch_field_direct(res, i);
>  	if (tf == NULL) {
>  	    if (res->handle && mysql_error(res->handle)[0] != 0) {
>  	        PyErr_SetString(MySQLError,mysql_error(res->handle));
> @@ -1122,7 +1127,7 @@
>      if (rows > 0) {
>          cols = mysql_num_fields(self->res);
>          for (j=0; j<cols; j++) {
> - 	    tf = &(mysql_fetch_field_direct(self->res,j));
> + 	    tf = Mysql_fetch_field_direct(self->res,j);
>  	    if (tf == NULL) {
>  		if (self->res->handle && mysql_error(self->res->handle)[0] != 0) {
>  		    PyErr_SetString(MySQLError,mysql_error(self->res->handle));
> @@ -1144,7 +1149,7 @@
>  	    rowlist = PyList_GetItem(datalist,i);
>  	    if (rowlist == NULL) goto error;
>  	    for (j=0; j<cols; j++) {
> -	        tf = &(mysql_fetch_field_direct(self->res,j));
> +	        tf = Mysql_fetch_field_direct(self->res,j);
>  		if (tf == NULL) {
>  		    if (self->res->handle && mysql_error(self->res->handle)[0] != 0) {
>  		        PyErr_SetString(MySQLError,mysql_error(self->res->handle));

zserv:/var/lib/zope/lib/python/Products/ZMySQLDA/src# patch <Junio.patch
patching file `MySQLmodule.c'
Hunk #3 FAILED at 386.
Hunk #4 FAILED at 1127.
Hunk #5 FAILED at 1149.
3 out of 5 hunks FAILED -- saving rejects to MySQLmodule.c.rej
lizserv:/var/lib/zope/lib/python/Products/ZMySQLDA/src#


and MySQLmodule.c.rej:


***************
*** 381,387 ****
      if (reslist == NULL) return NULL;
      n = mysql_num_fields(res);
      for (i = 0; i < n; i++) {
-         tf = &(mysql_fetch_field_direct(res, i));
         if (tf == NULL) {
             if (res->handle && mysql_error(res->handle)[0] != 0) {
                 PyErr_SetString(MySQLError,mysql_error(res->handle));
--- 386,392 ----
      if (reslist == NULL) return NULL;
      n = mysql_num_fields(res);
      for (i = 0; i < n; i++) {
+         tf = Mysql_fetch_field_direct(res, i);
         if (tf == NULL) {
             if (res->handle && mysql_error(res->handle)[0] != 0) {
                 PyErr_SetString(MySQLError,mysql_error(res->handle));
***************
*** 1122,1128 ****
      if (rows > 0) {
          cols = mysql_num_fields(self->res);
          for (j=0; j<cols; j++) {
-            tf = &(mysql_fetch_field_direct(self->res,j));
             if (tf == NULL) {
                 if (self->res->handle && mysql_error(self->res->handle)[0] != 0) {
                     PyErr_SetString(MySQLError,mysql_error(self->res->handle));
--- 1127,1133 ----
      if (rows > 0) {
          cols = mysql_num_fields(self->res);
          for (j=0; j<cols; j++) {
+            tf = Mysql_fetch_field_direct(self->res,j);
             if (tf == NULL) {
                 if (self->res->handle && mysql_error(self->res->handle)[0] != 0) {
                     PyErr_SetString(MySQLError,mysql_error(self->res->handle));
***************
*** 1144,1150 ****
             rowlist = PyList_GetItem(datalist,i);
             if (rowlist == NULL) goto error;
             for (j=0; j<cols; j++) {
-                tf = &(mysql_fetch_field_direct(self->res,j));
                 if (tf == NULL) {
                     if (self->res->handle && mysql_error(self->res->handle)[0]
  != 0) {
--- 1149,1155 ----
             rowlist = PyList_GetItem(datalist,i);
             if (rowlist == NULL) goto error;
             for (j=0; j<cols; j++) {
+                tf = Mysql_fetch_field_direct(self->res,j);
                 if (tf == NULL) {
                     if (self->res->handle && mysql_error(self->res->handle)[0]
  != 0) {

-- 
  Mike Schmitz     mschmitz@colug.org     http://mschmitz.colug.org/
  Don't blame me - I voted libertarian!   http://www.lp.org/
  Use Debian Linux - the free Gnu/Linux   http://www.debian.org/
				  -----------        
      "If encryption is outlawed, only outlaws will have encryption" 

--huq684BweRXVnRxX--