Patch for rss_page to resolve reserved word in schema

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Patch for rss_page to resolve reserved word in schema

McBride, Ian S.
I've attached a patch that renames the fields rss_page_last_read[key] and rss_page_feed[key] to "rkey". I was unable to install the module initially because key is a reserved schema word and Drupal does not properly escape column names in primary key definitions for CREATE statements (full description here http://drupal.org/node/371). So the CREATE for rss_page_last_read was failing because it was executing:

CREATE TABLE rss_page_last_read ( `key` BIGINT unsigned NOT NULL DEFAULT 0, `uid` INT unsigned NOT NULL, `atime` INT NOT NULL, PRIMARY KEY (key, uid) );

Where you can see key and uid are unescaped in the primary key definition.

The patch touches rss_page.install to define the base schema and adds rss_page_update_6202 to drop the primary keys on those tables and rename the fields. I've also edited rss_page.module to change this in queries and variable names. The change appears to work in testing for basic MM functionality, but could use a review for the portal-specific functions in the module that we're not set up to test.

I recall from our meeting that you wanted us to keep bug reports and patches on the mailing list, rather than entering them in Trac for now, which is why I've added this here, but I'm happy to do either.

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=422603
or send a blank email to [hidden email]

rss_page.patch (20K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Patch for rss_page to resolve reserved word in schema

Dan Wilga-2
Thanks for the patch, Ian. In order to be more consistent with other
Drupal tables, I renamed the field further to "fid". I got the feed
viewer working, too.

I also had to rework the hook_update quite a bit. Your patch was
missing a $ in the return statement, and didn't take into account the
hoops one has to go through to redefine the primary key that is
already autoincrement. I learned a long time ago to always try to
test my update hooks before committing them--painful as that often is.

On the plus side, my testing of the feed viewer pointed out a really
nasty typo in monster_menus.module that is fixed in r2983.
--
Dan Wilga                                 [hidden email]
Web System Administrator/Programmer             http://www.amherst.edu
Amherst College                                      Tel: 413-542-2175
Amherst, MA  01002

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=423100
or send a blank email to [hidden email]
Loading...