Skip to content

Commit a113930

Browse files
committed
_mssql.pyx: Slightly simplified logic and better error messages for rare
failures
1 parent 1a743d8 commit a113930

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

_mssql.pyx

+3-5
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ cdef class MSSQLConnection:
460460

461461
login = dblogin()
462462
if login == NULL:
463-
raise MSSQLDriverException("Out of memory")
463+
raise MSSQLDriverException("dblogin() failed")
464464

465465
appname = appname or "pymssql"
466466

@@ -1745,10 +1745,8 @@ def set_max_connections(int limit):
17451745
dbsetmaxprocs(limit)
17461746

17471747
cdef void init_mssql():
1748-
cdef RETCODE rtc
1749-
rtc = dbinit()
1750-
if rtc == FAIL:
1751-
raise MSSQLDriverException("Could not initialize communication layer")
1748+
if dbinit() == FAIL:
1749+
raise MSSQLDriverException("dbinit() failed")
17521750

17531751
dberrhandle(err_handler)
17541752
dbmsghandle(msg_handler)

0 commit comments

Comments
 (0)