won't correctly update a zero value

8 views
Skip to first unread message

Brian

unread,
Jul 8, 2010, 12:44:12 AM7/8/10
to SQL Buddy
Just installed, and sqlbuddy failed the first thing I tried: editing a
row in an existing table. A zero entered in the UI results in a null
in the table. It wasn't even a value I was changing, though explicitly
entering a zero also results in null.

Lepe

unread,
Jul 8, 2010, 11:21:06 PM7/8/10
to SQL Buddy
I can confirm this behavior.
The problem is located in file: ajaxsaveedit.php
line: 130

Replace this:
} else if (!$value && $nulls[$keyname] == "YES") {

With this:
} else if ($value === "" && $nulls[$keyname] == "YES") {

As !$value will return true on "0", so we have to be sure it is an
empty string what we want to convert to NULL. or not?
If you don't want to convert empty strings to null, then just comment
out that line and the next one.
Or you can specify (dirty solution) your own string to use as null,
for example:

} else if ($value == "_NULL_" && $nulls[$keyname] == "YES") {

I think there could be a checkbox next to the field name to mark it as
null. But anyway... this is a temporally solution.

Long

unread,
Jul 24, 2010, 2:54:03 PM7/24/10
to SQL Buddy
For some reason, that fix didn't work for me. Also, I found that code
on line 64, not 130. I think I'm using the latest version (1.3.2) -
what version are you using, Lepe?

Lepe

unread,
Aug 24, 2010, 9:33:25 PM8/24/10
to SQL Buddy
I'm using version 1.3.2 too...
Sorry! you are right its line 64 (I entered the total number of
lines...)

This is what I have in line 64:

} else if ($value == "NULL" && $nulls[$keyname] == "YES") {

In my case, I decided to use "NULL" string to specify NULL value.

Let me know if it worked. (sorry for my late response)

Long Ouyang

unread,
Aug 24, 2010, 9:52:20 PM8/24/10
to sql-...@googlegroups.com
I re-tried the original fix you recommended; it worked for some reason.

Thanks!
Reply all
Reply to author
Forward
0 new messages