1 guitarlp Dec 01, 2005 23:46
3 blueyed Dec 02, 2005 10:24
This is caused by MySQL strict mode.
We'll fix it in the DB schema.
You can work around this, by disabling "Strict mode" with MySQL 5 or install MySQL 4. I'd rather do the first.
Sorry.
4 xangelusx Mar 20, 2006 19:39
Is there a patch available to fix this in the source? I'd rather not disable strict mode on the DB.
5 xangelusx Mar 20, 2006 19:46
If anyone else is experiencing this, try replacing lines 85 - 157 in install/_functions_create.php with the following:
echo 'Creating table for Users... ';
$query = "CREATE TABLE T_users (
user_ID int(11) unsigned NOT NULL auto_increment,
user_login varchar(20) NOT NULL,
user_pass CHAR(32) NOT NULL,
user_firstname varchar(50) NOT NULL DEFAULT '',
user_lastname varchar(50) NOT NULL DEFAULT '',
user_nickname varchar(50) NOT NULL,
user_icq int(11) unsigned DEFAULT 0 NOT NULL,
user_email varchar(100) NOT NULL,
user_url varchar(100) NOT NULL DEFAULT '',
user_ip varchar(15) NOT NULL DEFAULT '',
user_domain varchar(200) NOT NULL DEFAULT '',
user_browser varchar(200) NOT NULL DEFAULT '',
dateYMDhour datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
user_level int unsigned DEFAULT 0 NOT NULL,
user_aim varchar(50) NOT NULL DEFAULT '',
user_msn varchar(100) NOT NULL DEFAULT '',
user_yim varchar(50) NOT NULL DEFAULT '',
user_locale varchar(20) DEFAULT 'en-EU' NOT NULL,
user_idmode varchar(20) NOT NULL DEFAULT 'login',
user_notify tinyint(1) NOT NULL default 1,
user_showonline tinyint(1) NOT NULL default 1,
user_grp_ID int(4) NOT NULL default 1,
PRIMARY KEY user_ID (user_ID),
UNIQUE user_login (user_login),
KEY user_grp_ID (user_grp_ID)
)";
$DB->query( $query );
echo "OK.<br />\n";
echo 'Creating table for Blogs... ';
$query = "CREATE TABLE T_blogs (
blog_ID int(11) unsigned NOT NULL auto_increment,
blog_shortname varchar(12) NULL default '',
blog_name varchar(50) NOT NULL default '',
blog_tagline varchar(250) NULL default '',
blog_description varchar(250) NULL default '',
blog_longdesc TEXT NULL DEFAULT NULL,
blog_locale VARCHAR(20) NOT NULL DEFAULT 'en-EU',
blog_access_type VARCHAR(10) NOT NULL DEFAULT 'index.php',
blog_siteurl varchar(120) NOT NULL default '',
blog_staticfilename varchar(30) NULL default NULL,
blog_stub VARCHAR(255) NOT NULL DEFAULT 'stub',
blog_urlname VARCHAR(255) NOT NULL DEFAULT 'urlname',
blog_notes TEXT NULL,
blog_keywords tinytext,
blog_allowcomments VARCHAR(20) NOT NULL default 'post_by_post',
blog_allowtrackbacks TINYINT(1) NOT NULL default 1,
blog_allowpingbacks TINYINT(1) NOT NULL default 0,
blog_allowblogcss TINYINT(1) NOT NULL default 1,
blog_allowusercss TINYINT(1) NOT NULL default 1,
blog_pingb2evonet TINYINT(1) NOT NULL default 0,
blog_pingtechnorati TINYINT(1) NOT NULL default 0,
blog_pingweblogs TINYINT(1) NOT NULL default 0,
blog_pingblodotgs TINYINT(1) NOT NULL default 0,
blog_default_skin VARCHAR(30) NOT NULL DEFAULT 'custom',
blog_force_skin TINYINT(1) NOT NULL default 0,
blog_disp_bloglist TINYINT(1) NOT NULL DEFAULT 1,
blog_in_bloglist TINYINT(1) NOT NULL DEFAULT 1,
blog_links_blog_ID INT(11) NULL DEFAULT NULL,
blog_commentsexpire INT(4) NOT NULL DEFAULT 0,
blog_media_location ENUM( 'default', 'subdir', 'custom', 'none' ) DEFAULT 'default' NOT NULL,
blog_media_subdir VARCHAR( 255 ) NOT NULL DEFAULT '',
blog_media_fullpath VARCHAR( 255 ) NOT NULL DEFAULT '',
blog_media_url VARCHAR( 255 ) NOT NULL DEFAULT '',
blog_UID VARCHAR(20),
PRIMARY KEY blog_ID (blog_ID),
UNIQUE KEY blog_urlname (blog_urlname)
)";
$DB->query( $query );
echo "OK.<br />\n";
6 blueyed Mar 20, 2006 21:05
As said, I'd rather disable strict mode (and would guess that there were more things involved which I've fixed for this!).
You get no benefit from using it with b2evolution (when it breaks things).
Just add the following line to the constructor (function DB()) in _db.class.php:
$this->query( 'SET sql_mode = ""' );
7 xangelusx Mar 21, 2006 16:17
Thanks. I was finding other spots where the code above actually made things worse :(
8 broderole Apr 07, 2006 14:24
I've tried this solution, but nothing happens. Heres some of the _class_db.php file:
function DB( $dbuser, $dbpassword, $dbname, $dbhost, $dbaliases, $halt_on_error = true, $db_use_transactions = false, $dbtableoptions = '' )
{
$this->query( 'SET sql_mode = ""' );
$this->halt_on_error = $halt_on_error;
Is this the correct place for the $this->query( 'SET sql_mode = ""' );?
9 blueyed Apr 07, 2006 16:59
BroderOle, you should rather put it at the end of the constructor, AFTER the connection has been established.
That should help.
10 xangelusx Jul 25, 2006 15:49
Is this fix still valid for the latest Summer Beta release?
11 blueyed Jul 25, 2006 19:07
xangelusx, there shouldn't be such errors anymore..
What MySQL version are you using? What error do you get?
12 xangelusx Jul 25, 2006 19:24
Still merging changes so I haven't tried to access the latest version yet. Just asking in case I didn't need to merge that change, or in case the method for running said query has changed.
We are running MySQL 5.0 though. I'll post any error messages that occur, if they occur.
Thanks!
13 blueyed Jul 25, 2006 19:36
I'm running MySQL 5 myself for testing, in "strict mode". So there should be no problems.
14 xangelusx Jul 25, 2006 19:41
Thanks, I'll give it a try!
15 xangelusx Jul 25, 2006 21:32
OK, Just tried to upgrade the DB using the base source code and got an erro message about truncated data after the following line:
Altering table «evo_hitlog»...
* Changed type of evo_hitlog.hit_referer_type from enum('search','blacklist','referer','direct','spam') to hit_referer_type ENUM('search','blacklist','referer','direct') NOT NULL
Adding $this->query( 'SET sql_mode = ""' ); back in resolved the issue.
16 blueyed Jul 25, 2006 21:40
Hmm.. this seems to mean that you have at least one column in T_hitlogs which has hit_referer_type = "spam" (or NULL?!).. can you please check this?
Is it correct that you got the error during upgrade? Or afterwards when a hit got logged?
17 xangelusx Jul 25, 2006 21:46
It was during upgrade. Unfortunatly I just wiped out all of the old tables so I can't see what was in there. Sorry! i know that doesn't help debug :(
18 blueyed Jul 25, 2006 21:53
I suppose it has been one or more rows with "spam" in it.
At least, this MySQL is something that appears if you insert something into an ENUM field, which is not allowed/defined. In non-strict mode it probably just inserts the default/NULL then.
However, apart from that, during normal operation, you should not need the
SET sql_mode=""
part.
But it does no harm really either.
If I try with version 0.9.1 this is the error I get when creating the database tables:
Installing b2evolution tables with sample data
Creating table for Groups... OK.
Creating default groups... OK.
Creating table for Blog-User permissions... OK.
Creating table for Settings... OK.
Creating table for Users... OK.
Creating table for Blogs... OK.
Creating table for Categories... OK.
Creating table for Posts... OK.
Creating table for Categories-to-Posts relationships... OK.
Creating table for Comments... OK.
Creating table for Hit-Logs... OK.
Creating table for Antispam Blackist... OK.
Creating default blacklist entries... OK.
Creating table for Locales... OK.
Creating default blogs... OK.
Creating sample categories... OK.
Creating sample posts for blog A... OK.
Creating default linkblog entries... OK.
Creating sample posts... OK.
Creating sample comments... OK.
Creating default users...
MySQL error!
Field 'user_firstname' doesn't have a default value(Errno=1364)
Your query:
INSERT INTO evo_users (user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_level, user_locale, dateYMDhour, user_grp_ID) VALUES ('admin', '9993d56abb9084ce3e805fa471dc238e', 'admin', 'kanderson@mybodybuildingblog.com', '127.0.0.1', 'localhost', 10, 'en-US', '2005-12-01 14:59:40', 1)