Make prepared statement status thread and instance-specific
#36949

984854
97jaz wants to merge 97jaz:thread-local-prepared-statements into rails:master

We do not currently have an analysis of these two commits