keyword "connection" needs to be protected in sql query otherwise it causes sql errors (at least with MySQL 5.0.32 here). See attached patch...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mathieu’s picture

FileSize
5.4 KB

Forgot a few, new patch.

robertDouglass’s picture

Yes, and this has to be extended to code like this:

$sql = 'SELECT MIN(' . tw_quote_column($colname) . ') FROM `{' . $tablename . '}`';

It can happen that the $tablename is also a reserved word. For example, I ran into:

SELECT MIN(blah) FROM grant;

robertDouglass’s picture

FileSize
7.87 KB

Rerolled and added backticks for issue in #2. Agree that this is a critical issue.

mikeryan’s picture

Assigned: mathieu » mikeryan
Status: Needs review » Needs work

It's just too gross to call tw_quote_column() on all those queries... I'm going to rename the field (say, to dbconnection), the code will be much cleaner.

mikeryan’s picture

Status: Needs work » Fixed

OK, I've committed fixes:

  • connection renamed to dbconnection
  • tw_quote_column() renamed to tw_quote_identifier()
  • tw_quote_identifier() applied to table names

Thanks!

robertDouglass’s picture

Status: Fixed » Needs review
FileSize
762 bytes

Here's another place.

mikeryan’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.