Date: Mon, 27 Dec 2004 14:17:19 -0200 From: Marcus Grando <marcus@corp.grupos.com.br> To: ports@freebsd.org Subject: Re: /usr/ports/databases/py-MySQL Message-ID: <41D0358F.7050206@corp.grupos.com.br> In-Reply-To: <41CFFBC0.5070309@comsys.com.ua> References: <41CFFBC0.5070309@comsys.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
From databases/py-MySQL/pkg-message ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WARNING: This port is a very old Python MySQL interface which doesn't actively maintained by its authors anymore. Some efforts were required to make it working with newest versions of MySQL, and it is highly likely that further MySQL development would make hard or even impossible to get this module working in the future. The better port named py-MySQLdb available, which should be used in all cases where compatability and future maintainability is desirable. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Regards Sergey Smitienko wrote: > Make py-MySQL compile and work with mysql-4-client libraries installed. > btw, I'm not sure, but I guess py-MySQL must be linked against > libmysqlclient_r.so.12 (not included in the patch). > > ldd /usr/local/lib/python2.2/site-packages/MySQLmodule.so: > libmysqlclient.so.12 => > /usr/local/lib/mysql/libmysqlclient.so.12 (0x4811d000) > > > --- work/MySQLmodule-1.4/MySQLmodule.c Mon Dec 27 15:05:56 2004 > +++ MySQLmodule.c Mon Dec 27 15:04:12 2004 > @@ -512,7 +512,8 @@ > DBH->dbh_use_result = 0; > DBH->handle = &DBH->connection; > DBH->sth = NULL; > - if (!(mysql_connect(DBH->handle, dbhost, dbuser, dbpass))) { > + mysql_init(DBH->handle); > + if (!(mysql_real_connect(DBH->handle, dbhost, dbuser, dbpass, NULL, > 0, NULL, 0l))) { > if (mysql_error(DBH->handle)[0] != 0) { > PyErr_SetString(MySQLError,mysql_error(DBH->handle)); > } else { > @@ -735,12 +736,20 @@ > PyObject *args; > { > char *dbname; > - > + char query[512]; > + int rc; > if (!PyArg_ParseTuple(args, "s:create", &dbname)) return NULL; > if (self->sth && clear_channel(self->sth)) return NULL; > Py_XDECREF(self->sth); > self->sth = NULL; > - if (mysql_create_db(self->handle, dbname)) { > + > + rc = snprintf(query, sizeof(query), "CREATE DATABASE %s", dbname); > + if (rc > sizeof(query)-1) { > + PyErr_SetString(MySQLError,"Database name too long"); > + return NULL; > + } > + > + if (mysql_query(self->handle, query)) { > PyErr_SetString(MySQLError, mysql_error(self->handle)); > return NULL; > } > @@ -867,12 +876,21 @@ > PyObject *args; > { > char *dbname; > + char query[512]; > + int rc; > > if (!PyArg_ParseTuple(args, "s:drop", &dbname)) return NULL; > if (self->sth && clear_channel(self->sth)) return NULL; > Py_XDECREF(self->sth); > self->sth = NULL; > - if (mysql_drop_db(self->handle, dbname)) { > + > + rc = snprintf(query, sizeof(query), "DROP DATABASE %s", dbname); > + if (rc > sizeof(query)-1) { > + PyErr_SetString(MySQLError,"Database name too long"); > + return NULL; > + } > + > + if (mysql_query(self->handle, dbname)) { > PyErr_SetString(MySQLError, mysql_error(self->handle)); > return NULL; > } > _______________________________________________ > freebsd-ports@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-ports > To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org" -- Marcus Grando Grupos Internet S/A marcus(at)corp.grupos.com.br
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41D0358F.7050206>