emma cannot insert records into tables containing a field that is a keyword
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
emma (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: emma
To reproduce this, create a table with a field that is a keyword, eg `key`. For example:
CREATE TABLE `settings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=
Then attempt to insert a record into the table using emma.
When you press the green tick to execute the insert, Emma reports an SQL error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server for the right syntax to use near 'key='test''.
ie Emma isn't wrapping the fieldnames in ``, so it is issuing:
INSERT INTO `settings` (key) VALUES ('test')
instead of the SQL:
INSERT INTO `settings` (`key`) VALUES ('test')
Updating existing records works just fine.
ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: emma 0.6-4
Uname: Linux 2.6.37-rc2-dtresp x86_64
NonfreeKernelMo
Architecture: amd64
CheckboxSubmission: 1bd8e90541d49b9
CheckboxSystem: d00f84de8a55581
Date: Thu Nov 18 09:08:02 2010
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Alpha amd64 (20100224.1)
PackageArchitec
ProcEnviron:
PATH=(custom, user)
LANG=en_AU.utf8
SHELL=/bin/bash
SourcePackage: emma
The insert statement is constructed in __init__.py. This patch fixes the problem for me.