[Phpmyadmin-devel] editing and NULL values

Marc Delisle marc at infomarc.info
Fri Jul 15 19:17:00 CEST 2011


Le 2011-07-15 10:54, Ammar Yasir a écrit :
> On Fri, Jul 15, 2011 at 8:04 PM, Marc Delisle <marc at infomarc.info> wrote:
> 
>> Le 2011-07-15 10:15, Ammar Yasir a écrit :
>>> On Fri, Jul 15, 2011 at 7:40 PM, Marc Delisle <marc at infomarc.info>
>> wrote:
>>>
>>>> Le 2011-07-15 10:00, Ammar Yasir a écrit :
>>>>> On Fri, Jul 15, 2011 at 7:26 PM, Marc Delisle <marc at infomarc.info>
>>>> wrote:
>>>>>
>>>>>> Le 2011-07-14 15:39, Ammar Yasir a écrit :
>>>>>>
>>>>>>>>> There was a small thing I noticed on the row edit feature.
>>>>>>>>> When the form is displayed for row edit and some field is null, the
>>>>>> 'Null'
>>>>>>>>> checkbox is checked. When we select some value it is unchecked. It
>>>>>> should be
>>>>>>>>> checked again if we select the value empty or null but it does not.
>>>> If
>>>>>> we
>>>>>>>>> forget to check it back this will give an SQL error.
>>>>>>>>> Screenshot attached for the sakila db film table where
>>>>>>>>> original_language_id is null, and if I miss checking it back I'll
>> get
>>>>>> an SQL
>>>>>>>>> error.
>>>>>>>>>
>>>>>>>>
>>>>>>> Sorry, missed the screenshots in previous mail. They are on my blog:
>>>>>>> http://ammaryasirr.blogspot.com/
>>>>>>
>>>>>> I think you'll need to include js/tbl_change.js. There are a few
>>>>>> functions in there that deal with these kind of verifications. Beware,
>>>>>> some functions are not jQueryfied.
>>>>>>
>>>>>> I found this problem in the tbl_change.php (when you edit a row from
>> the
>>>>> table browse window) page. That includes the tbl_change.js script.
>>>>
>>>> I believed you meant when editing from zoom-search, sorry. But I tried
>>>> with browse then editing the sakila.film and I don't see a problem.
>>>>
>>>> Emptying a value is not the same thing as marking it NULL, this is why
>>>> the checkbox is there. Please give me a more precise scenario to work
>>>> with, including the SQL error you get.
>>>>
>>>>
>>>> If i try the film table in sakila database, and edit any row. The
>>> original_language_id is null initally and if I select andy value the
>> check
>>> is unchecked. Then again if I select '  '  in the select box, I though it
>>> should turn the check back on, just in case if I forget it gives an
>> error.
>>>
>>> The screen shots are on my blog http://ammaryasirr.blogspot.com/
>>
>> Ok I had played to much with my version of sakila and was missing some
>> relations. I recreated it.
>>
>> The real problem is that the list of values should not contain a blank
>> value. Now I'm wondering in which situation we need this blank line!
>> This comes from libraries/relation.lib.php in PMA_foreignDropdown().
>>
>> Checking NULL automatically is not something phpMyAdmin can decide to
>> do. However we know we can uncheck it when a value has been entered.
>>
>> The blank line comes from $ret = '<option value=""> </option>'; (in
> function PMA_foerignDropDown() in raltions.lib.php) . If you see the
> language_id field above the original_language_id, it also has a 'blank'
> option. If that is selected then also it gives SQL error. So I dont know why
> we should have 'blank' as an option. The foreign key on one table will be
> primary key of some other. Hence, never 'blank' .

Blank is a good option when user is inserting a row, as we don't know
yet which value the user will want. And it's better not to force one of
the values.

We probably need a new parameter to indicate whether we are editing or
inserting. Feel free to open a bug artifact about this.

-- 
Marc Delisle
http://infomarc.info




More information about the Developers mailing list