mod_storage_sql: fix stores and store_exists

When I wrote this, I completely forgot that the SQL storage uses type to specify the type of item stored (json, number, string, boolean, etc).

Also, stmt:rows() returns a function, not a table, I fixed that as well.