Unique field is not compatible with the Email CCK field.

Comments

teebo’s picture

Actually.... it's a bug regarding the Unique Field module when used in a Mac OS X platform (at least 10.5).

warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user '_mdnsresponder'@'localhost' (using password: NO) in /Library/WebServer/Documents/Drupal/sites/all/modules/unique_field/unique_field.module on line 154.
warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /Library/WebServer/Documents/Drupal/sites/all/modules/unique_field/unique_field.module on line 154.
warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user '_mdnsresponder'@'localhost' (using password: NO) in /Library/WebServer/Documents/Drupal/sites/all/modules/unique_field/unique_field.module on line 170.
warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /Library/WebServer/Documents/Drupal/sites/all/modules/unique_field/unique_field.module on line 170.
warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user '_mdnsresponder'@'localhost' (using password: NO) in /Library/WebServer/Documents/Drupal/sites/all/modules/unique_field/unique_field.module on line 173.
warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /Library/WebServer/Documents/Drupal/sites/all/modules/unique_field/unique_field.module on line 173.
warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user '_mdnsresponder'@'localhost' (using password: NO) in /Library/WebServer/Documents/Drupal/sites/all/modules/unique_field/unique_field.module on line 194.
warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /Library/WebServer/Documents/Drupal/sites/all/modules/unique_field/unique_field.module on line 194.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') FROM AS JOIN node AS node ON .nid = node.nid WHERE = '' AND node.type = ''' at line 1 query: SELECT DISTINCT(.nid) FROM AS JOIN node AS node ON .nid = node.nid WHERE = '' AND node.type = '' in /Library/WebServer/Documents/Drupal/includes/database.mysqli.inc on line 151.
warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /Library/WebServer/Documents/Drupal/sites/all/modules/unique_field/unique_field.module on line 206.

Is anybody else getting this error under Leopard?

_mdnsresponder is the Bonjour user for Leopard.

sigsby’s picture

the function mysql_real_escape_string requires a valid connection to the database, per it's definition at php.net:

string mysql_real_escape_string  ( string $unescaped_string  [, resource $link_identifier  ] )

It will automatically use the last open connection, the only problem is I'm using mysqli, so there is no last opened connection for mysql to use.

I've looked at the code briefly, and I'm not sure why this function is being used, and why the Drupal database abstraction functions aren't being used here. Can anyone shed any light on this? It seems that using a mysql specific function is not really a good idea, at least if you want to be database independent. I replaced all use of mysql_real_escape_string() with Drupal's db_escape_string() and those errors are gone. I'll try and roll a patch as soon as I can.

I'm getting other errors now and need to go back to the issue queue to check on those.

sigsby’s picture

I should learn to check the issue queue better next time. The mysql_real_escape_string() error is because the db calls aren't using the Drupal db abstraction functions. There is already an issue and patch for that: #250496: Does not work at all with PostgreSQL

arithmetric’s picture

Assigned: Unassigned » arithmetric
Status: Active » Fixed

This error is probably related to the database-specific code, as sigsby noted. This is fixed in the latest version.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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