Update ODBCConnectionFactory.h

This commit is contained in:
Kseniia Sumarokova 2021-09-29 16:18:24 +03:00 committed by GitHub
parent 58fa0ac13c
commit 27132d56f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,9 +84,9 @@ T execute(nanodbc::ConnectionHolderPtr connection_holder, std::function<T(nanodb
tryLogCurrentException(__PRETTY_FUNCTION__);
/// SQLState, connection related errors start with 08 (main: 08S01), cursor invalid state is 24000.
/// Invalid cursor state is a retriable error.
/// Invalid transaction state 25000. Truncate to 4 letters, because nanodbc does it.
/// Invalid transaction state 25000. Truncate to 2 letters on purpose.
/// https://docs.microsoft.com/ru-ru/sql/odbc/reference/appendixes/appendix-a-odbc-error-codes?view=sql-server-ver15
if (e.state().starts_with("08") || e.state().starts_with("24") || e.state().starts_with("2500"))
if (e.state().starts_with("08") || e.state().starts_with("24") || e.state().starts_with("25"))
{
connection_holder->updateConnection();
return query_func(connection_holder->get());