Bugs: Browse | Submit New | Admin

[#20290] a DateTime column originally set to kb_nil upon creation can't remain so when updated

Date:
2008-05-21 19:07
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
a DateTime column originally set to kb_nil upon creation can't remain so when updated

Detailed description
I have a table in which there are two DateTime columns.  My use case requires only the first to be set to a real value
upon insertion, leaving the second 'kb_nil'.  Upon updating the table, the second DateTime column isn't allowed to stay
'kb_nil' - an error is thrown.

The expected behavior is that the second DateTime column remain as it is, while other columns are updated.  I've attached
a file demonstrating the error and a workaround.

- Dimitri

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-06-27 12:28
Sender: Pavel Lukin

Updates fail because the test against nil values for vars that
contain kb_nil fails. An extra condtion var.kb_nil? is necessary.
A possible fix listed below.

631:<                unless field_type_def[:Default].nil?
631:>                unless field_type_def[:Default].nil?
|| field_type_def[:Default].kb_nil?

3083:<              and not data[f].nil?
3083:>              and not (data[f].nil? or data[f].kb_nil?)

3095:<            next if data[f].nil?
3095:>            next if data[f].nil? || data[f].kb_nil?

Attached Files:

Name Description Download
kbtest-datetime.rb KirbyBase DateTime column update error Download

Changes:

Field Old Value Date By
File Added3749: kbtest-datetime.rb2008-05-21 19:07None