TinyPortal

Development => Feedback => Bugs/Errors => Topic started by: pgc_boss on April 25, 2008, 03:06:05 PM

Title: Getting Default Value Errors
Post by: pgc_boss on April 25, 2008, 03:06:05 PM
I'm using a clean install to test the latest TinyPortal and I'm running into problems.

Specifications

OS:Windows 2003 SP1
WebServer:Apache 2.0.59
PHP:5.2.3
DB:MySQL 5.0.37
SMF:1.1.4
TP:1.052

Specifically the error is occurring when I attempt to add a new article.

QuoteDatabase Error
Field xxxxxx doesn't have a default value
File: D:\Data\Websites\Content\smf\Sources\TPortalAdmin.php
Line: 867

where the field started off as 'shortname'. I searched the site and checked the resolution. I resolved this by setting the 'shortname' field as NOT NULL. Then the error pops up for 'sticky', and now 'topic' has turned up after setting 'sticky' to NOT NULL.

Line 867 reads:
db_query("INSERT INTO {$tp_prefix}articles (date,body,intro,useintro,category,frontpage,subject,authorID,author,frame,approved,off,options,parse,comments,comments_var,views,rating,voters,ID_THEME,fileimport)
VALUES('$artd','$artbb','$arti','$artu','$artc','$artf','$arts','$nameb','$name','$artframe','$artpp','0','$artoptions',0,0,'',0,'','',0,'$artimp')", __FILE__, __LINE__);


This error is still happening after running manual_tp_install.php
All the fields in smf_tp_articles are set to NOT NULL (bear in mind that this is a clean install as well).
Title: Re: Getting Default Value Errors
Post by: Dragooon on April 25, 2008, 04:36:32 PM
Can you tell what field is that.......
Title: Re: Getting Default Value Errors
Post by: pgc_boss on April 25, 2008, 04:45:32 PM
Quote from: Dragooon on April 25, 2008, 04:36:32 PM
Can you tell what field is that.......
I've shelved my testing of this for the time being.

Looking through the files, it seems that when the new smf_tp_articles table is created, all the fields are set to NOT NULL but they aren't given a default value.

When the query on line 867 runs, there are several fields that aren't being populated (including 'shortname', 'topic' and 'sticky'). Since they're set to NOT NULL without a default value, I'm getting the error repeatedly.
Title: Re: Getting Default Value Errors
Post by: Dragooon on April 25, 2008, 05:18:36 PM
I know why you are getting those problems and I know that they don't got a default value, the reason for the error is TP is not inserting the value to a field which is set a NOT NULL but since it doesn't got a default value MySQL gets angry

Now if you want it to be fixed, you need to tell us the Field which is throwing the error......
Title: Re: Getting Default Value Errors
Post by: bloc on April 25, 2008, 06:07:28 PM
This will be resolved in the next beta.
Title: Re: Getting Default Value Errors
Post by: pgc_boss on April 26, 2008, 12:59:23 PM
Quote from: Dragooon on April 25, 2008, 05:18:36 PM
Now if you want it to be fixed, you need to tell us the Field which is throwing the error......

As I said in my last post, I'm getting the error repeatedly. All the missing fields in that query are throwing this error at me. As soon as I've fixed one error, the next field throws an error. A quick cross-reference between the query and the table shows me that the following fields are throwing the error:

Given that Bloc says that it's to be fixed in the next beta, I'm happy to hold off on my testing until that's ready.