Skip to content

Commit

Permalink
Fix for libdb2 for createdb and dropdb
Browse files Browse the repository at this point in the history
  • Loading branch information
Earammak committed Jun 28, 2024
1 parent fb62b7b commit 0a19b51
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ibm_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,10 @@ static int _python_ibm_db_createdb(conn_handle *conn_res, PyObject *dbNameObj, P
sqlcreatedbType sqlcreatedb;
#endif

#if defined(__MVS__)
PyErr_SetString( PyExc_Exception, "Not supported: This function not supported on this platform" );
return -1;
#endif

if ( !NIL_P( conn_res ) ) {
if ( NIL_P( dbNameObj ) ) {
Expand Down Expand Up @@ -2072,6 +2076,7 @@ static int _python_ibm_db_createdb(conn_handle *conn_res, PyObject *dbNameObj, P
}
}

#ifndef __MVS__
#ifdef _WIN32
cliLib = DLOPEN( LIBDB2 );
#elif _AIX
Expand All @@ -2085,6 +2090,7 @@ static int _python_ibm_db_createdb(conn_handle *conn_res, PyObject *dbNameObj, P
_python_clear_local_var( dbNameObj, dbName, codesetObj, codeset, modeObj, mode, isNewBuffer );
return -1;
}
#endif
Py_BEGIN_ALLOW_THREADS;
#ifdef _WIN32
sqlcreatedb = DLSYM( cliLib, "SQLCreateDbW" );
Expand Down Expand Up @@ -2151,6 +2157,11 @@ static int _python_ibm_db_dropdb(conn_handle *conn_res, PyObject *dbNameObj, int
void *cliLib;
#endif

#if defined(__MVS__)
PyErr_SetString( PyExc_Exception, "Not supported: This function not supported on this platform" );
return -1;
#endif

if ( !NIL_P( conn_res ) ) {
if ( NIL_P( dbNameObj ) ) {
PyErr_SetString( PyExc_Exception, "Supplied database name Parameter is invalid" );
Expand All @@ -2168,7 +2179,7 @@ static int _python_ibm_db_dropdb(conn_handle *conn_res, PyObject *dbNameObj, int
} else {
return -1;
}

#ifndef __MVS__
#ifdef _WIN32
cliLib = DLOPEN( LIBDB2 );
#elif _AIX
Expand All @@ -2182,6 +2193,7 @@ static int _python_ibm_db_dropdb(conn_handle *conn_res, PyObject *dbNameObj, int
_python_clear_local_var( dbNameObj, dbName, NULL, NULL, NULL, NULL, isNewBuffer );
return -1;
}
#endif
Py_BEGIN_ALLOW_THREADS;
#ifdef _WIN32
sqldropdb = DLSYM( cliLib, "SQLDropDbW" );
Expand Down

0 comments on commit 0a19b51

Please sign in to comment.