Moodle

support null fields in backup/restore

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8
  • Fix Version/s: 1.9
  • Component/s: Backup
  • Labels:
    None
  • Database:
    Any
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

We can now have NULL fields in database, however currently we have no way of representing them in the xml for backups. If we have <data></data> it gets read as an empty string by restore. We plan to use a special string NULL to indicate a value of NULL in the xml, and restore that value during restore using insert_record().

-Add special NULL string to "full_tag()"
-Recover special NULL string from "backup_todb()"

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

Sounds peeeerfect!

Show
Eloy Lafuente (stronk7) added a comment - Sounds peeeerfect!
Hide
Yu Zhang added a comment -

in CVS.

Show
Yu Zhang added a comment - in CVS.
Hide
Wen Hao Chuang added a comment -

This was not backported to 1.8 and 1.7, should I backport this to 1.8, 1.7 and 1.6 too? Thanks!

Show
Wen Hao Chuang added a comment - This was not backported to 1.8 and 1.7, should I backport this to 1.8, 1.7 and 1.6 too? Thanks!
Hide
Eloy Lafuente (stronk7) added a comment -

Hi Wen,

I really think this haven't been ported to previous releases because NULL treatment wasn't necessary before 1.9. Until then, all fields in Moodle had some 0 (for ints) and empty string (for varchars) default, so we were NULL-free.

The cause for these defaults is one historic MySQL limit (3.x series if I'm nor wrong). But we have been started to use proper NULLs since 1.9 (and their use will grow, for sure). But not before 1.9.

So, my +1 to reclose this as is now. Ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Wen, I really think this haven't been ported to previous releases because NULL treatment wasn't necessary before 1.9. Until then, all fields in Moodle had some 0 (for ints) and empty string (for varchars) default, so we were NULL-free. The cause for these defaults is one historic MySQL limit (3.x series if I'm nor wrong). But we have been started to use proper NULLs since 1.9 (and their use will grow, for sure). But not before 1.9. So, my +1 to reclose this as is now. Ciao
Hide
Dan Marsden added a comment -

flagging as fixed!

Dan

Show
Dan Marsden added a comment - flagging as fixed! Dan
Hide
Petr Škoda (skodak) added a comment - - edited

closing, works fine so far

Show
Petr Škoda (skodak) added a comment - - edited closing, works fine so far

Dates

  • Created:
    Updated:
    Resolved: