See my comments included in the patch and the upstream bugreport at http://www.sqlite.org/cvstrac/tktview?tn=3583