DB Casts within custom field api.

For better compatibilty across the db layers and types,
cast the parameters appropriately