From owner-freebsd-ports@FreeBSD.ORG Mon Dec 27 12:10:58 2004 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8682816A4D0 for ; Mon, 27 Dec 2004 12:10:58 +0000 (GMT) Received: from org.ukrsat.com (org.ukrsat.com [212.35.173.146]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2C06E43D2F for ; Mon, 27 Dec 2004 12:10:56 +0000 (GMT) (envelope-from hunter@comsys.com.ua) Received: from localhost (localhost [127.0.0.1]) by org.ukrsat.com (8.13.1/8.13.1/Secure) with ESMTP id iBRC9Xee013020 for ; Mon, 27 Dec 2004 14:09:39 +0200 (EET) (envelope-from hunter@comsys.com.ua) Message-ID: <41CFFBC0.5070309@comsys.com.ua> Date: Mon, 27 Dec 2004 14:10:40 +0200 From: Sergey Smitienko User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: ports@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.80/610/Sun Nov 28 23:32:08 2004 clamav-milter version 0.80j on org.ukrsat.com X-Virus-Status: Clean X-Scanned-By: MIMEDefang 2.48 on 127.0.0.1 Subject: /usr/ports/databases/py-MySQL X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Dec 2004 12:10:58 -0000 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; }