#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 , 16 years ago
milestone: | → 1.0 beta |
---|---|
Owner: | changed from | to
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 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 , 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 , 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 , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.