# # patch "ChangeLog" # from [ed4b3b3c1194479a7c7b4767a0f32f3b5ffb5971] # to [0f79b1bab4944e0d171410d02195b6e0aa344b39] # # patch "database.cc" # from [83c0e4fe4b672da030bc50966c118ac0c2c98017] # to [4a6486b38a02fec9b281ae4a665f209bb9f3440e] # ======================================================================== --- ChangeLog ed4b3b3c1194479a7c7b4767a0f32f3b5ffb5971 +++ ChangeLog 0f79b1bab4944e0d171410d02195b6e0aa344b39 @@ -1,5 +1,12 @@ 2005-09-20 Matt Johnston
+ * database.cc (space_usage): workaround the issue that in sqlite + 3.2.6, SUM({empty set}) returns NULL. (this is part of the sql spec, + see http://www.sqlite.org/cvstrac/tktview?tn=1413 and the comment for + SUM() in sqlite docs). + +2005-09-20 Matt Johnston + * ui.cc, ui.hh, sanity.hh: replace ui.user_locale with get_user_locale(), so that we can guarantee that it will be initialised when the global_sanity object (and probably other things) ======================================================================== --- database.cc 83c0e4fe4b672da030bc50966c118ac0c2c98017 +++ database.cc 4a6486b38a02fec9b281ae4a665f209bb9f3440e @@ -757,7 +757,9 @@ database::space_usage(string const & table, string const & concatenated_columns) { results res; - string query = "SELECT SUM(LENGTH(" + concatenated_columns + ")) FROM " + table; + // COALESCE is required since SUM({empty set}) is NULL. + // the sqlite docs for SUM suggest this as a workaround + string query = "SELECT COALESCE(SUM(LENGTH(" + concatenated_columns + ")), 0) FROM " + table; fetch(res, one_col, one_row, query.c_str()); return lexical_cast