db_mysql: fixed condition checking the parameter for db uri parsing

- on a report generated by cppcheck sent by David Binderman

(cherry picked from commit c0b2e567b2a27d5d29ede39409d6299f7d375d87)
(cherry picked from commit 75203caf1a7a8c582b8eaff67af891b00100f232)
db_mysql: remove line accessing freed result

(cherry picked from commit e114105450d8a5152448afd28de16e290297e38d)
(cherry picked from commit 045b6ead1eace226ec316e3ae776f7bc35e54341)
db_mysql: reset prev_token to avoid double free in case of url parse error

- when db api v2 is used (ser modules)

(cherry picked from commit f65bf2c37bfaae740dd3cd8d686308cfa44b42f2)
(cherry picked from commit 340768948df423e25812d083fcdf09396ef763e3)
db_mysql: properly free db result structure if db_mysql_convert_result() fails

- reported by Torrey Searle, FS#420

(cherry picked from commit 37983c9f57536c57c5d34ce2d8a1c8f411e61e39)
(cherry picked from commit 402e2122d1aa353ee8c10321aa1eb9315a81cd81)