Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#8260 closed (fixed)

MySQLDb v 1.2.1 -- no VARCHAR

Reported by: magneto Owned by: Malcolm Tredinnick
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: mysqldb
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The Change in r8318 i assumes Mysqldb 1.2.2, 1.2.1 does not have have VARCHAR as a Field Type

not too sure what to do about that, other then hard code '15' for the usage in django/db/backends/mysql/base.py.

but that seems to be the only thing about 1.2.1 v 1.2.2 that breaks the doc statement

"If you’re using MySQL, you’ll need MySQLdb, version 1.2.1p2 or higher. You will also want to read the database-specific notes for the MySQL backend."

Change History (6)

comment:1 by Malcolm Tredinnick, 16 years ago

milestone: 1.0 beta
Owner: changed from nobody to Malcolm Tredinnick
Triage Stage: UnreviewedAccepted

Whoops. Sorry about that... didn't even occur to me that might happen.

I don't know enough off the top of my head to know if hard-coding the "15" is right there (although I'd believe it is) or if we should just not do anything with 1.2.1. I'd prefer to make it work with the earlier version is possible, though. So, definitely a bug and just needs a quick check to make sure that we're not doing anything dumb there, but the proposed fix sounds like the right idea.

Marking as 1.0-beta because I broke MySQL. I'll fix it today/tonight if nobody gets there first.

comment:2 by Karen Tracey <kmtracey@…>, 16 years ago

I'm the one who pushed for this change so I'll take a look at whether the problem it's intended to fix even exists on 1.2.1p2, if you like. Just need to get a machine configured with that level of MySQLdb....

comment:3 by Karen Tracey <kmtracey@…>, 16 years ago

It seems this VARCHAR fix is not needed when running MySQLdb 1.2.1p2. I installed that level for Python 2.4.4 on one of my machines and checked the type returned for a column that has a BINARY collation:

D:\u\kmt\software\web\xword>\bin\Python2.4.4\python.exe manage.py shell
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from crossword.models import Authors
>>> a1 = Authors.objects.get(pk=131)
>>> type(a1.Author)
<type 'unicode'>
>>> ^Z

It's unicode, so all is well. By contrast using the MySQLdb 1.2.2 level installed against Python 2.5.1 on the same machine (Django r8212 so before the VARCHAR fix) returns 'str':

D:\u\kmt\software\web\xword>\bin\Python2.5.1\python.exe manage.py shell
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from crossword.models import Authors
>>> a1 = Authors.objects.get(pk=131)
>>> type(a1.Author)
<type 'str'>
>>> quit()

So the VARCHAR fix isn't needed for 1.2.1p2. (Are there other levels between those two we need to worry about?)

comment:4 by Malcolm Tredinnick, 16 years ago

Karen, that gives us full version coverage. It went from 1.2.1p2 to 1.2.2 in the official releases. Thanks for doing that.

I'll patch it by just testing for the existing of that attribute.

comment:5 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [8329]) Fixed #8260 -- Changed [8318] to also work with MySQLdb 1.2.1p2.

comment:6 by Jacob, 13 years ago

milestone: 1.0 beta

Milestone 1.0 beta deleted

Note: See TracTickets for help on using tickets.
Back to Top