Received this error message when attempting to add a limit:

user warning: Table 'XXX.node_limitnumber_rules' doesn't exist query: SELECT * FROM node_limitnumber_rules WHERE class = 'role' in /home/XXX/public_html/XXX/drupal/includes/database.mysql.inc on line 172.

Comments

nachenko’s picture

The table was not created. I can't check it now, but if you know MySQL you should check install file of the module.

Sorry for any inconveniencies.

Anonymous’s picture

Hi shawnspqr and nachenko,

the table is not created because of a MySQL syntax error. I deleted the "FIRST" keyword after "Primary First" at the end of the second line and now it works.

CREATE TABLE {node_limitnumber_rules} (
	`id` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST,
	`class` ENUM( 'role', 'user' ) NOT NULL ,
	`item` INT UNSIGNED NOT NULL ,
	`pubtype` VARCHAR( 32 ) NOT NULL ,
	`max` TINYINT UNSIGNED NOT NULL
) ENGINE = MYISAM ;

Best regards,

Mike

nachenko’s picture

Status: Active » Fixed

Thanks hailstorm. I fixed it and committed the change. Now, there should be a new release for tomorrow.

scedwar’s picture

Status: Fixed » Active

I get no errors when adding a node limit - in fact, I get the ok message! However, no node limit is listed which makes sense given that there is no table created by the installer! In the log I get the following log message:

Table 'mydb_drupal.node_limitnumber_rules' doesn't exist query: SELECT * FROM node_limitnumber_rules WHERE class = 'role' in /home/user1/public_html/includes/database.mysql.inc on line 172.

I'm using the latest release, downloaded 8 hours ago.

nachenko’s picture

OK, look this code:

CREATE TABLE {node_limitnumber_rules} (
				`id` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
				`class` ENUM( 'role', 'user' ) NOT NULL ,
				`item` INT UNSIGNED NOT NULL ,
				`pubtype` VARCHAR( 32 ) NOT NULL ,
				`max` TINYINT UNSIGNED NOT NULL
				) ENGINE = MYISAM ;

This is the code that creates the table in a MySQL database. Could you please execute it (remember to prefix the table name) using PHPMyAdmin or whatever and tell me what happens?

Please notice the installer only works on MySQL as I don't know the syntax for other databases.

gorcon’s picture

Version: 5.x-1.0 » 5.x-1.1-1

I'm getting the same error. When I run the SQL code directly as you suggest, I get the following error:

ERROR 1064 (42000): 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 '{node_limitnumber_rules} (
`id` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY' at line 1

FYI, my MySQL version is recent (5.0.37). If you have any suggestions, I'd appreciate hearing them. Let me know if you need any more info. Thanks in advance.

gorcon’s picture

Running the table creation SQL directly works when I remove the {} surrounding the table name.

When I directly create the node_limitnumber table using SQL -- bypassing the node_limitnumber.install script -- the module appears to work properly for me.

After removing the {} in the create table statement in the .install script, the table still does not get created when installing the module. The script drops the table properly if I uninstall the module -- with or without the {} surrounding the table name in the DROP TABLE statement.

So, while I don't have much php experience, my guess is that the MySQL syntax is correct but something is just slightly off with the php syntax involving the table creation portion of the script. Maybe this is a syntax/version issue with php? I'm running v. 5.2.4. Is the php syntax in the .install script more suitable for php4 ? Just a thought.

scedwar’s picture

I'm sorry I've not been able to return to this issue to investigate since I mentioned it, however I can confirm that our host (the very excellent HotDrupal btw) is also on the very latest stable builds of PHP and MySQL (whatever that is right now).

nachenko’s picture

Status: Active » Needs review

Fixed in 1.1.2 release.

It will be available soon. Please someone have a try.

gorcon’s picture

Version: 5.x-1.1-1 » 5.x-1.1-2

The 1.1.2 release seems to be working perfectly for me. Thanks for the help.

nachenko’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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

mcurry’s picture

I know this is marked closed, but I had to fix this in the 5.x-1.1 version I just downloaded and installed (the latest recommended 5.x release listed on the project page)

I had to use this format on my MySQL installation:

CREATE TABLE  `node_limitnumber_rules` (
  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
  `class` enum('role','user') NOT NULL,
  `item` int(10) unsigned NOT NULL,
  `pubtype` varchar(32) NOT NULL,
  `max` tinyint(3) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

The difference? The line:

`id` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,

'PRIMARY_KEY' needed to be removed;
and I added:

  PRIMARY KEY (`id`)

to the end of the column definitions.

This happened on MySQL Version 5.1.30, so it seems the syntax has changed.

Should I be using a later release of the node_limitnumber module? I don't see one listed as recommended. Please advise.

nachenko’s picture

Hi, grateful_drupal_user.

The 1.1.3 release should be recommended, my mistake, but I can't change it from this computer (I don't know why). You can download it here:

http://drupal.org/node/305419

Thanks for your interest on this module.