@@ -67,6 +67,7 @@ static PyObject *Connection_GetCurrentSchema(udt_Connection*, void*);
6767static PyObject * Connection_GetEdition (udt_Connection * , void * );
6868static PyObject * Connection_GetExternalName (udt_Connection * , void * );
6969static PyObject * Connection_GetInternalName (udt_Connection * , void * );
70+ static PyObject * Connection_GetException (udt_Connection * , void * );
7071static int Connection_SetStmtCacheSize (udt_Connection * , PyObject * , void * );
7172static int Connection_SetAction (udt_Connection * , PyObject * , void * );
7273static int Connection_SetClientIdentifier (udt_Connection * , PyObject * , void * );
@@ -153,6 +154,26 @@ static PyGetSetDef g_ConnectionCalcMembers[] = {
153154 { "edition" , (getter ) Connection_GetEdition , 0 , 0 , 0 },
154155 { "ltxid" , (getter ) Connection_GetLTXID , 0 , 0 , 0 },
155156 { "handle" , (getter ) Connection_GetHandle , 0 , 0 , 0 },
157+ { "Error" , (getter ) Connection_GetException , NULL , NULL ,
158+ & g_ErrorException },
159+ { "Warning" , (getter ) Connection_GetException , NULL , NULL ,
160+ & g_WarningException },
161+ { "InterfaceError" , (getter ) Connection_GetException , NULL , NULL ,
162+ & g_InterfaceErrorException },
163+ { "DatabaseError" , (getter ) Connection_GetException , NULL , NULL ,
164+ & g_DatabaseErrorException },
165+ { "InternalError" , (getter ) Connection_GetException , NULL , NULL ,
166+ & g_InternalErrorException },
167+ { "OperationalError" , (getter ) Connection_GetException , NULL , NULL ,
168+ & g_OperationalErrorException },
169+ { "ProgrammingError" , (getter ) Connection_GetException , NULL , NULL ,
170+ & g_ProgrammingErrorException },
171+ { "IntegrityError" , (getter ) Connection_GetException , NULL , NULL ,
172+ & g_IntegrityErrorException },
173+ { "DataError" , (getter ) Connection_GetException , NULL , NULL ,
174+ & g_DataErrorException },
175+ { "NotSupportedError" , (getter ) Connection_GetException , NULL , NULL ,
176+ & g_NotSupportedErrorException },
156177 { NULL }
157178};
158179
@@ -1354,6 +1375,19 @@ static PyObject *Connection_GetInternalName(udt_Connection* self, void* unused)
13541375}
13551376
13561377
1378+ //-----------------------------------------------------------------------------
1379+ // Connection_GetException()
1380+ // Return the requested exception.
1381+ //-----------------------------------------------------------------------------
1382+ static PyObject * Connection_GetException (udt_Connection * self , void * arg )
1383+ {
1384+ PyObject * exc = * (PyObject * * ) arg ;
1385+
1386+ Py_INCREF (exc );
1387+ return exc ;
1388+ }
1389+
1390+
13571391//-----------------------------------------------------------------------------
13581392// Connection_SetAction()
13591393// Set the action associated with the connection.
0 commit comments