# # patch "ChangeLog" # from [07a3a4cede2b580ac1a42ee7321a17c9a062aefb] # to [dab94ee29cfd692c0edd8f90bdf3a94427502b18] # # patch "database.cc" # from [90130ac538f5b50fda7a2838fbd5eafbcb51c736] # to [e164fc8fa3aae345a62da1bade010e1e87a97e66] # ======================================================================== --- ChangeLog 07a3a4cede2b580ac1a42ee7321a17c9a062aefb +++ ChangeLog dab94ee29cfd692c0edd8f90bdf3a94427502b18 @@ -1,5 +1,11 @@ 2005-08-24 Nathaniel Smith + * database.cc (assert_sqlite3_ok): Don't print the raw sqlite + error code. Do add some auxiliary information when sqlite errors + are confusing. + +2005-08-24 Nathaniel Smith + * Back out most changes since b580c6ac5bf8eea1f442b8bddc60283b047ade1e. Handling charsets properly by working in utf8 and then converting sucks. Problems ======================================================================== --- database.cc 90130ac538f5b50fda7a2838fbd5eafbcb51c736 +++ database.cc e164fc8fa3aae345a62da1bade010e1e87a97e66 @@ -166,7 +166,23 @@ const char * errmsg = sqlite3_errmsg(s); - E(errcode == SQLITE_OK, F("sqlite error [%d]: %s") % errcode % errmsg); + // sometimes sqlite is not very helpful + // so we keep a table of errors people have gotten and more helpful versions + if (errcode != SQLITE_OK) + { + // first log the code so we can find _out_ what the confusing code + // was... note that code does not uniquely identify the errmsg, unlike + // errno's. + L(F("got sqlite error: %d: %s") % errcode % errmsg); + } + std::string auxiliary_message = ""; + if (errcode == SQLITE_ERROR) + { + auxiliary_message = _("make sure database and containing directory are writeable"); + } + // if the last message is empty, the \n will be stripped off too + E(errcode == SQLITE_OK, + F("sqlite error: %s\n%s") % errcode % errmsg % auxiliary_message); } struct sqlite3 *