Mapping SQLInsert and CheckTypeExpression #502
Unanswered
RobertSchuitemaker
asked this question in
Q&A
Replies: 1 comment
-
Thinking about this further. But it looks like Postgres doesn't support returning the number of rows effected when executing a stored procedure. You could write the statement as a function and use 'GET DIAGNOSTICS' to return the number of rows effected, but you would have to write some custom validation to handle the result. So it looks like using Check.None() is the solution for this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been migrating an existing project using a SQL server database to use a Postgres database. The project uses FluentNHibernate 2.1.2.
Part of the mappings uses a Stored Procedure call to do an upsert in the DB on inserting or updating a record as follows:
The stored procedure in SQL server has no specific return value, so I expect it to return '0' (success) after it is executed.
After migrating to Postgres my code suddenly fails with
"Batch update returned unexpected row count from update; actual row count: -1; expected: 1"
The postgres stored procedure call is defined as follows:
private const string UpsertStoredProcedureCall = "CALL {0}.pAgentStatusUpsert (par_LastResponseTime:=?, par_AgentId:=?);";
What I can't figure out is why it's expecting 1? How does it determine that? SQL server is returning a 0, but Fluent doesn't throw an error on that?
The only way I have been able to get it to work is to disable checking using this
`
SqlInsert(string.Format(UpsertStoredProcedureCall, Schemas.Config)).Check.None();
`
Which seems counter productive.
Beta Was this translation helpful? Give feedback.
All reactions