StatementInvalid takes WrappedDatabaseException's place

`StatementInvalid` would be much more useful if it gave us access to the originating exception. Hoist that up from `WrappedDatabaseException` without breaking compatibility.