Handle datetimes and null in prepared statements