[ticket/12711] Fix contact form migration failing on MSSQL

Cast values to string such that they are quoted in SQL queries.

The value is stored in a text column and the key is stored in a varchar. Some
DBMSes do not like it when we insert integers into text columns. Cast both to
string to be on the safe side.

This also refactors set_array() to use sql_build_array() for the update query.

https://tracker.phpbb.com/browse/PHPBB3-12711