Dear all,

Thanks for this great looking module.

Unfortunately, it contains some typical MySQL feature, which does not exist on any other database, including PostgreSQL:

query: INSERT INTO single_login_history
                 SET uid = 1, session_id =  
'89fc6702ab35**********bdf1f26423d', date = 127*******32, ip =  
'88.160.168.33', browser = 'Mozilla/5.0 (X11; U;  
Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100402 Iceweasel/3.5.9 (like  
Firefox/3.5.9)', type = 'cookie'
                 ON DUPLICATE KEY UPDATE date = 1271166632 in  
/home/html/*************/www/sites/all/modules/single_login/single_login.module on  
line 56.

There is a nice SQL developer guide here:
http://drupal.org/node/770068

I am trying to find a solution in one query and will report back.

Comments

grub3’s picture

I think you should simply add unique indexes on:
uid, session_id, date, ip, browser
to avoid duplicated.

I see there is no index on you tables.
No index, means terrible server load.

deekayen’s picture

Title: Login security not SQL92 compatible » Single Login not SQL92 compatible
Project: Login Security » Single Login

Looks like you pegged the wrong module issue queue.

grub3’s picture

Title: Single Login not SQL92 compatible » Login security not SQL92 compatible
Project: Single Login » Login Security

Okay, some more:

$sql = "INSERT INTO {single_login} (uid, counter) VALUES (%d, %d) ON DUPLICATE KEY UPDATE counter = counter + 1";
        db_query(sprintf($sql, $user->uid, 1));
grub3’s picture

Sorry for the wrong module. Can you move it? Otherwize, close.

grub3’s picture

Project: Login Security » Single Login

Okay, moved to the right module.