INSERT and UPDATE does not work with prefixed database names

doka - July 13, 2007 - 12:32
Project:Object driver
Version:5.x-1.0-beta
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

The INSERT and UPDATE statements do not function in case of database with db_prefix.

Have to change the two statements in line 516 and 520, see patch attached. There is also an extra line in patch necessary.

PS: sorry for the patch format, I do not know the usual practice.

AttachmentSize
patch_to_insert_update_prefix_bug.txt1.15 KB

#1

pwolanin - July 14, 2007 - 13:04

well, I'm a bit surprised that the original version doesn't work, but truthfully i've never tested it with a prefixed table. I'll look into this.

in terms of how to make a patch - you need diff or cvs. See: http://drupal.org/patch

#2

pwolanin - July 14, 2007 - 13:41

Maybe be simpler to make a change from this:
db_query("INSERT INTO {$table} ("

to:

db_query("INSERT INTO {". $table ."} ("

#3

pwolanin - July 14, 2007 - 13:47

here's a patch

AttachmentSize
fix_prefixing.patch 50 bytes

#4

pwolanin - July 14, 2007 - 14:17

whoops - found an even more serious bug. an empty table name was being passed to db_next_id.

Note, this patch will break things unless you manually update the sequences table (under MySQL). Maybe I'll roll some update code.

AttachmentSize
fix_prefixing_2.patch 1.97 KB

#5

pwolanin - July 14, 2007 - 15:37
Status:needs review» needs work

a more complete patch, but the update code doesn't seem quite right yet.

AttachmentSize
fix_prefixing_3.patch 3.91 KB

#6

pwolanin - July 14, 2007 - 20:10

ah a bug with update_sql, perhaps. This patch should work.

#7

pwolanin - July 14, 2007 - 20:11

patch...

AttachmentSize
fix_prefixing_4.patch 3.94 KB

#8

pwolanin - July 14, 2007 - 20:34
Status:needs work» needs review

And this one should actually work. Please try it out.

#9

pwolanin - July 14, 2007 - 20:36

hmmm, doing badly remembering to attach...

AttachmentSize
fix_prefixing_5.patch 3.97 KB

#10

coupet - August 15, 2007 - 18:56

subscribing

#11

pwolanin - September 13, 2007 - 02:08
Status:needs review» fixed

committed patch in #9

#12

Anonymous - September 27, 2007 - 02:11
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.