This module is much needed in Drupal, and is much appreciated, however I'm having some problems getting it to work. I have practically a skeleton install of Drupal (5.1) and am trying to add maxlength to the body of some CCK content types. When submitting the desired length contstraints in settings>>maxlength I get the error:
Warning: Table 'watchdog' was not locked with LOCK TABLES query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES ... in public_html/mysite/includes/database.mysql.inc on line 172
and, of course nothing is updated. Why would "watchdog" interfere with this? I thought it just had something to do with error logging. I don't know whats going on, here. Could somebody point me in the right direction?
Thanks
Comments
Comment #1
mariuss commentedWhen you are submitting the maxlength settings there is no maxlength specific code involved at all. Also, maxlength does not even use the watchdog function.
There must be something else wrong with your install or database, unrelated to maxlength.
Comment #2
modul commentedSame Watchdog error here. Contrary to Verlierer, I have installed quite a number of modules and I have quite a number of content types. As far as I can tell, it's the first time I get this error. I do hope some light can be shed on this problem, because Maxlength is indeed a much needed feature.
These are the errors I get:
*** in Firefox's "white screen" :
Warning: Table 'dru_system' was not locked with LOCK TABLES query: list_themes SELECT * FROM dru_system WHERE type = 'theme' in /www/ck/dru/includes/database.mysql.inc on line 172
Warning: Table 'dru_watchdog' was not locked with LOCK TABLES query: watchdog INSERT INTO dru_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', 'Duplicate entry 'maxlength_node_type_category_cont_maxlength_titl' for key 1\nquery: variable_set\nINSERT INTO dru_variable (name, value) VALUES ('maxlength_node_type_category_cont_maxlength_title', 's:0:\\"\\";') in /www/includes/database.mysql.inc op regel 172.', 2, '', 'http://www.mysite/?q=admin/settings/maxlength', 'http://www.mysite/?q=admin/settings/maxlength', '213.132.128.236', 1187771749) in /www/mysite/includes/database.mysql.inc on line 172
*** in Drupal's error frame:
# user warning: Duplicate entry 'maxlength_node_type_nieuwsbrief_cultuur_maxlengt' for key 1 query: variable_set INSERT INTO dru_variable (name, value) VALUES ('maxlength_node_type_nieuwsbrief_cultuur_maxlength_title', 's:0:\"\";') in /www/ck/dru/includes/database.mysql.inc on line 172.
# user warning: Duplicate entry 'maxlength_node_type_nieuwsbrief_cultuur_maxlengt' for key 1 query: variable_set INSERT INTO dru_variable (name, value) VALUES ('maxlength_node_type_nieuwsbrief_cultuur_maxlength_body', 's:3:\"200\";') in /www/ck/dru/includes/database.mysql.inc on line 172.
Strange thing: it reads "maxlengt", instead of "maxlength"?? Maybe a problem with the length of the variable name? Just a (probably silly) idea.
Comment #3
modul commentedSome forum browsing indicates that there may indeed be a problem with the lengt of a variable name: http://drupal.org/node/62673
I didn't do the maths, but my gut feeling is that there is a problem here, which triggers Watchdog. Maybe?
Ludo
Comment #4
mariuss commentedThanks for the pointers ludootje, it looks like you found the real issue.
I am running Drupal 5.2 and I checked the size of the name field in the variables table and it is set to 255. From your errors I can see that in your case variable names are truncated at 48 characters.
What version of Drupal are you guys using?
Comment #5
mariuss commentedI checked the size again, and I was wrong, in Drupal 5.2 it is still 48 characters.
In one of my databases it is 255, I must have changed that manually and forgot about it, sorry.
So, until this issue is fixed in Drupal (and since they know about it for a long time and the solution is dead easy, I have no clue why it is still not fixed), I can suggest two workarounds:
1. Rename your custom content types, if possible, so it is shorter. The maximum length for content types that will work is 18.
2. Increase the size of the name field in the variables table.
I am also marking this issue as a bug, I will look into changing how Maxlength is forming variable names.
Comment #6
mariuss commentedComment #7
ericpughI recently upgraded to Drupal 5.2, and had the same problem.
Changing the length in variables did the trick. Thanks. Your work is much appreciated
Comment #8
modul commentedAlways nice to contribute something - even a gut feeling :-) - to a nice project!
Ludo
Comment #9
modul commentedForgot to mention: I'm using 5.1.
Comment #10
mariuss commentedAll variable names should fit the 48 characters limit now.
Run the update.php script after upgrading to the latest version, existing variables will be automatically renamed.
Comment #11
(not verified) commented