pypyodbc icon indicating copy to clipboard operation
pypyodbc copied to clipboard

Removed superfluous second setting of SQL_ATTR_ACCESS_MODE in connect()

Open FenderJazz opened this issue 5 years ago • 0 comments

Removed the call to SQLSetConnectAttr that set SQL_ATTR_ACCESS_MODE every time connect() was called. Kept the call that sets SQL_ATTR_ACCESS_MODE only when the user specifies a read-only connection. My rationale for this choice is (1) that it is better practice not to explicitly set attributes that equate to default behaviour, because it plays better for our user if a (poorly designed) ODBC driver has not implemented the attribute, and (2) that this is how I believe pyodbc behaves with 'readonly'.

I think the same arguments would lead to only setting SQL_ATTR_AUTOCOMMIT if autocommit is false, but I don't have the nerve to make that change as well, or to search for other similar cases!

FenderJazz avatar Aug 04 '19 16:08 FenderJazz