/usr/ports/databases/py-MySQL
Marcus Grando
marcus at corp.grupos.com.br
Mon Dec 27 08:17:26 PST 2004
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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe at freebsd.org"
--
Marcus Grando
Grupos Internet S/A
marcus(at)corp.grupos.com.br
More information about the freebsd-ports
mailing list