diff options
author | tsarna <tsarna> | 2000-02-27 18:21:44 +0000 |
---|---|---|
committer | tsarna <tsarna> | 2000-02-27 18:21:44 +0000 |
commit | 7e9fe45f871f35f3be2f1f729ecead6cd80d0e80 (patch) | |
tree | 7ea0506da3cf8eca4c0ac2277a9d6240e6cc026e /databases | |
parent | b476c476a379e22bbadf4dc088824df955c87a0e (diff) | |
download | pkgsrc-7e9fe45f871f35f3be2f1f729ecead6cd80d0e80.tar.gz |
Update to use py-mysqldb. Bump version to 1.1.3nb1.
Diffstat (limited to 'databases')
-rw-r--r-- | databases/zope-mysql/Makefile | 20 | ||||
-rw-r--r-- | databases/zope-mysql/patches/patch-aa | 145 |
2 files changed, 156 insertions, 9 deletions
diff --git a/databases/zope-mysql/Makefile b/databases/zope-mysql/Makefile index 5ea0668ae97..e6969793914 100644 --- a/databases/zope-mysql/Makefile +++ b/databases/zope-mysql/Makefile @@ -1,16 +1,16 @@ -# $NetBSD: Makefile,v 1.7 1999/12/28 04:56:10 wiz Exp $ +# $NetBSD: Makefile,v 1.8 2000/02/27 18:21:44 tsarna Exp $ # DISTNAME= ZMySQLDA-1.1.3-nonbin -PKGNAME= zope-mysql-1.1.3 -CATEGORIES= www -MASTER_SITES= http://www.zope.org/Download/ZMySQLDA/ +PKGNAME= zope-mysql-1.1.3nb1 +CATEGORIES= databases www +MASTER_SITES= http://www.zope.org/Members/MikeP/ZMySQLDA/ MAINTAINER= tsarna@netbsd.org -HOMEPAGE= http://www.zope.org/ +HOMEPAGE= http://www.zope.org/Members/MikeP/ZMySQLDA -DEPENDS+= zope-2.0.1:../../www/zope -DEPENDS+= py-mysql-1.4:../../databases/py-mysql +DEPENDS+= zope-2.*:../../www/zope +DEPENDS+= py-mysqldb-0.1.2:../../databases/py-mysqldb WRKSRC= ${WRKDIR}/lib @@ -23,13 +23,15 @@ do-configure: (cd ${WRKDIR}/${DAPATH}; ${RM} -rf Makefile* *.pyc *.orig src Setup) do-build: + ${PREFIX}/bin/python ${PREFIX}/lib/python1.5/compileall.py \ + ${WRKDIR}/${DAPATH} + ${PREFIX}/bin/python -O ${PREFIX}/lib/python1.5/compileall.py \ + ${WRKDIR}/${DAPATH} do-install: ${CAT} ${PKGDIR}/PLIST.pre >${PLIST_SRC} (cd ${WRKDIR}; ${PAX} -r -w lib ${ZOPEDIR}) ${CHMOD} -R a+rX ${ZOPEDIR}/${DAPATH} - ${PREFIX}/bin/python ${PREFIX}/lib/python1.5/compileall.py \ - ${WRKDIR}/${DAPATH} (cd ${PREFIX}; ${FIND} lib/zope/${DAPATH} -type f -print >>${PLIST_SRC}) ${ECHO} "@dirrm lib/zope/${DAPATH}" >> ${PLIST_SRC} diff --git a/databases/zope-mysql/patches/patch-aa b/databases/zope-mysql/patches/patch-aa new file mode 100644 index 00000000000..ad3df72ecb1 --- /dev/null +++ b/databases/zope-mysql/patches/patch-aa @@ -0,0 +1,145 @@ +$NetBSD: patch-aa,v 1.3 2000/02/27 18:21:44 tsarna Exp $ + +Patch from MySQLdb distribution to let the ZMySQL DA work with it +instead of with MySQLmodule, with patch paths modified for pkg use. + +--- + +This patch should convert ZMySQLDA from using MySQLmodule-1.4 to _mysql. +Why _mysql and not MySQLdb? Well, look at the patch. :) It's basically puny. +ZMySQLDA ends up abstracting away the Python DB API interface anyway, so why +wrap another wrapper? Plus, by default MySQLdb attempts to do type +conversions, which Zope doesn't want at this point. + +I made some changes, partially to help Zopistas, to both _mysql and MySQLdb. +The main one is removing type_conv as part of _mysql. It now needs to be +passed to _mysql.connect() as the conv keyword argument; if it is not present, +it uses an empty dictionary (return everything as strings). MySQLdb now owns +type_conv, and passes a copy if you don't supply your own converter. Thanks +to Thilo Mezger for pointing out that Zope DOES expect numbers to be returned +as numbers, so now a minimal type converter dictionary is passed. + +To apply the patch, you probably want to do something like this: + + cd ZOPEHOME # whatever that is + tar xvfz ZMySQLDA.tar.gz # the original, unadulterated version + patch -p1 <ZMySQLDA.patch # adulterate it + +Then, follow the README instructions for building MySQLdb and install +it where Python can find it. Finally, you will need to restart Zope. + +Andy Dustman <adustman@comstar.net> +1999-10-11 + +--- python/Products/ZMySQLDA/DA.py.orig Mon Jan 25 10:42:45 1999 ++++ python/Products/ZMySQLDA/DA.py Wed Sep 15 20:16:32 1999 +@@ -133,18 +133,6 @@ + + def factory(self): return DB + +- def sql_quote__(self, v, escapes={ +- '\\': '\\\\', +- '\"': '\\\"', +- '\'': '\\\'', +- '\0': '\\0', +- '\n': '\\n', +- '\t': '\\t', +- '\r': '\\r', +- '\b': '\\n', +- }): +- find=string.find +- for c in "\\\"\'\0\n\t\r\b": +- if find(v,c) > -1: +- v=string.join(string.split(v,c),escapes[c]) +- return "'%s'" % v ++ def sql_quote__(self, v, escapes={}): ++ from _mysql import escape_string ++ return "'%s'" % escape_string(v) +--- python/Products/ZMySQLDA/db.py.orig Mon Jan 25 10:42:45 1999 ++++ python/Products/ZMySQLDA/db.py Mon Oct 11 21:29:07 1999 +@@ -103,7 +103,8 @@ + """Db connection implementation""" + __version__='$Revision: 1.3 $'[11:-2] + +-import MySQL, regex, sys ++import _mysql, regex, sys ++from _mysql import FIELD_TYPE + from string import strip, split, find, join + from time import gmtime, strftime + +@@ -118,13 +119,26 @@ + class DB: + + defs={ +- "short": "i", "long": "i", "char": "s", "double": "n", "decimal": "n", +- "float": "n", "tiny blob": "t", "medium blob": "t", "long blob": "t", +- "blob": "t", "date": "d", "time": "s", "datetime": "d", +- "timestamp": "d", "varchar": "t", "string": "t", ++ FIELD_TYPE.CHAR: "i", FIELD_TYPE.DATE: "d", ++ FIELD_TYPE.DATETIME: "d", FIELD_TYPE.DECIMAL: "n", ++ FIELD_TYPE.DOUBLE: "n", FIELD_TYPE.FLOAT: "n", FIELD_TYPE.INT24: "i", ++ FIELD_TYPE.LONG: "i", FIELD_TYPE.LONGLONG: "l", ++ FIELD_TYPE.SHORT: "i", FIELD_TYPE.TIMESTAMP: "d", ++ FIELD_TYPE.TINY: "i", FIELD_TYPE.YEAR: "i", + } + +- Database_Error=MySQL.error ++ conv={ ++ FIELD_TYPE.TINY: int, ++ FIELD_TYPE.SHORT: int, ++ FIELD_TYPE.LONG: int, ++ FIELD_TYPE.FLOAT: float, ++ FIELD_TYPE.DOUBLE: float, ++ FIELD_TYPE.LONGLONG: long, ++ FIELD_TYPE.INT24: int, ++ FIELD_TYPE.YEAR: int ++ } ++ ++ Database_Error=_mysql.Error + + def __init__(self,connection): + self.connection=connection +@@ -138,8 +152,7 @@ + if len(dbhost) == 1: db, host = dbhost[0], 'localhost' + else: [db, host] = dbhost + +- c=MySQL.connect(host,user,pw) +- c.selectdb(db) ++ c=_mysql.connect(host=host,user=user,passwd=pw,db=db,conv=self.conv) + self.db=c + return + +@@ -168,10 +181,11 @@ + result=() + desc=None + for qs in queries: +- c=db.query(qs) ++ db.query(qs) ++ c=db.store_result() + try: +- desc=c.fields() +- r=c.fetchrows() ++ desc=c.describe() ++ r=c.fetch_all_rows() + except: r=None + if not r: continue + if result: +@@ -182,15 +196,15 @@ + except self.Database_Error, mess: + raise sys.exc_type, sys.exc_value, sys.exc_traceback + +- if desc is None: return (), () ++ if not desc: return (), () + + items=[] + func=items.append + defs=self.defs + for d in desc: + item={'name': d[0], +- 'type': defs[d[2]], +- 'width': d[3], ++ 'type': defs.get(d[1],"t"), ++ 'width': d[2], + } + func(item) + return items, result |