[Zope] ZMySQLDA compilation problems
Junio Hamano
junio@twinsun.com
21 Oct 1999 00:25:05 -0700
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));