Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Problem with saving DB columns as NULL?

Quote Reply
Problem with saving DB columns as NULL?
Hi,

Just noticed a problem when Modifying links on on the user side. I've been using INT and Decimal for numeric fields for some time. Now I'm getting the following error message when INT/Decimal fields are left blank by users making mods....

Field Name can not contain the value ''

These numeric fields are set to "NULL" in the admin and I Re-Sync with changes. I found that when the original records were created in those fields different values were stored. Using MySQLMan I can see that my INT/Decimal fields that were left blank are now saved as "0" instead of NULL. No Default values used either. The error arises when trying to modify a link on the user side. It doesn't seem to want to save an empty field with "0" there and spits out that error message. The only way I've been able to get around this is switch the numeric fields to VARCHAR. I tried the different numeric file types with the same problem. Is there another column type I could use so users can modify input prices, ratings, ect so I still search on them???

Anyone else notice this? Why would new INT types save blank fields as NULL and new fields as "0"

Why would some INT fields save "0" and other save NULL?

Hopefully that make since and someone may know this issue I'm referring to.

Last edited by:

Jonze: Mar 21, 2007, 4:50 PM
Quote Reply
Re: [Jonze] Problem with saving DB columns as NULL? In reply to
What version of glinks are you using? There have been issues with the checks in the code for NULL in the past, but I believe we've fixed most of them in the latest version (3.2).

Adrian
Quote Reply
Re: [brewt] Problem with saving DB columns as NULL? In reply to
Hey Adrian,

Thanks for the response...

I'm using Links 3.2.
Quote Reply
Re: [Jonze] Problem with saving DB columns as NULL? In reply to
It looks like there have been a few changes in the code since 3.2 that we haven't pushed out yet so what works on my copy might not be fixed yet. However, there have been so many of these small updates, it's quite time consuming to find them all to push out an update, so this will have to wait till the next release. I would still like to know if it's still a bug, so could you tell me what the settings for the column are? What are the "Not Null", "Default", and "Form Regex" settings set to?

Adrian
Quote Reply
Re: [brewt] Problem with saving DB columns as NULL? In reply to
Thanks again for the info!

Yeah I didn't want to call it a bug, but I think it's something you may want to look at.

I've been taking a look at my database, and something is not right with the way INT/DECIMAL column types are save in links. When those fields were left empty upon submission some fields save as "0", NULL, and sometimes older submissions are blank.

Either way users can't modify these INT or DECIMAL fields without getting that error. If the leave the field empty, they get the error. Doesn't matter if it's a "0", NULL, or blank. Weird.

My field are like this:

Name: total_items
Column Type: INT
Default: "none"
Not Null: No
Form Regex: "none"

Name: total_price
Column Type: DECIMAL
Default: "none"
Not Null: No
Form Regex: "none"

I've switched over those fields to VARCHAR and get no errors. I just tested and see I can still do search comparisons. I guess I'll just have edit, but as long as modify works...

Also I've seen a bug where a Multiselect field in the include_form.html needs to be of "TEXT" type and not "ENUM" to work properly. There a couple threads on this issue.. almost pull my hair out figuring that out.

Thanks again!