PDA

View Full Version : Invalid Default Value


dsboyce8624
07-01-2005, 12:36 AM
Okay, with newer version we are not allowed to use DEFAULT '0' like we were and this is causing problems in some older, but still popular hacks. Shoutbox, and Member Album to name a couple.

If we are will to to make the corrections we need to know what changes to make.

In Shoutbox there is this code:

$query['new'][] = 'CREATE TABLE '.TABLE_PREFIX.'shoutbox_posts (
`shoutid` BIGINT (255) UNSIGNED DEFAULT \'0\' AUTO_INCREMENT,
`text` TEXT,
`userid` BIGINT (255) UNSIGNED DEFAULT \'0\',
`username` VARCHAR (255) DEFAULT \'0\',
`ip` VARCHAR (25) DEFAULT \'0\',
`time` BIGINT (20) UNSIGNED DEFAULT \'0\',
`edittime` BIGINT (20) UNSIGNED DEFAULT \'0\',
`edituser` VARCHAR (255) DEFAULT \'0\',
`deleted` TINYINT(1) UNSIGNED DEFAULT \'0\',
PRIMARY KEY(`shoutid`))';

$query['new'][] = 'ALTER TABLE '.TABLE_PREFIX.'usergroup
ADD `shoutboxpermissions` INT(10) UNSIGNED DEFAULT \'0\' NOT NULL,
ADD `shouthierarchy` TINYINT(5) UNSIGNED DEFAULT \'0\' NOT NULL,
ADD `shoutmaxdaily` TINYINT(5) UNSIGNED DEFAULT \'0\' NOT NULL';

$query['new'][] = 'ALTER TABLE '.TABLE_PREFIX.'user
ADD `shouts` BIGINT(10) UNSIGNED DEFAULT \'0\' NOT NULL,
ADD`shoutbanned` TINYINT(1) UNSIGNED DEFAULT \'0\' NOT NULL';

And I know it breaks there, because mine broke there.

There doesn't seem to be any support for this, at least not enough to make it worth mentioning. So, can somebody tell me how to modify these queries so they work?

Thanks a bunch.

Marco van Herwaarden
07-01-2005, 07:30 AM
New version of what? vB, MySQL?

And what doesn't work, you get an error message?

And please post questions about a hack in the thread about that hack.

dsboyce8624
07-01-2005, 03:05 PM
New versions of MySQL.

Yes there is an error, Invalid Default Value '0'

This is not about the hack, this is about correcting queries.

Marco van Herwaarden
07-01-2005, 03:06 PM
And what is the exact error you are getting?

Marco van Herwaarden
07-01-2005, 03:08 PM
Ahh just checked those queries now. There is 1 error in them:
`shoutid` BIGINT (255) UNSIGNED DEFAULT \'0\' AUTO_INCREMENT,

You can not have a default value for an auto increment field. Change that line to:
`shoutid` BIGINT (255) UNSIGNED AUTO_INCREMENT,

Marco van Herwaarden
07-01-2005, 03:12 PM
Actually if you would have posted this in the Shoutbox thread, i think someone would have been able to help you much faster, since the answer to your question is already there: https://vborg.vbsupport.ru/showthread.php?p=639730&highlight=increment#post639730

dsboyce8624
07-02-2005, 02:02 AM
Beleive it or not, I read the whole damned thing, and missed it.

I guess it was just too much.

Thanks.