Skip to content

Commit

Permalink
Fix for issue981 Django showing all migrations as unaplied (ibmdb#982)
Browse files Browse the repository at this point in the history
* Fix for issue981 Django showing all migrations as unaplied
---------
Signed-off-by: Balram Choudhary <[email protected]>
  • Loading branch information
bchoudhary6415 authored Dec 24, 2024
1 parent 671bf02 commit c67d1bb
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions ibm_db_dbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,6 @@ def close(self):
raise ProgrammingError("Connection cannot be closed; "
"connection is no longer active.")
else:
LogMsg(DEBUG, f"Closing connection: conn_handler={self.conn_handler}")
return_value = ibm_db.close(self.conn_handler)
LogMsg(INFO, "Connection closed.")
except Exception as inst:
Expand Down Expand Up @@ -1388,8 +1387,6 @@ def __init__(self, conn_handler, conn_object=None):
self.messages = []
self.FIX_RETURN_TYPE = conn_object.FIX_RETURN_TYPE
LogMsg(INFO, "Cursor object initialized.")
LogMsg(DEBUG, f"Connection handler: {self.conn_handler}")
LogMsg(DEBUG, f"Connection object: {self.__connection}")

# This method closes the statemente associated with the cursor object.
# It takes no argument.
Expand Down Expand Up @@ -1491,8 +1488,7 @@ def callproc(self, procname, parameters=None):
else:
self.stmt_handler = result
self._result_set_produced = True
LogMsg(DEBUG,
f"callproc executed successfully. stmt_handler={self.stmt_handler}, return_value={return_value}")
LogMsg(DEBUG, "callproc executed successfully.")
LogMsg(INFO, "exit callproc()")
return return_value

Expand Down Expand Up @@ -1802,6 +1798,8 @@ def _fetch_helper(self, fetch_size=-1):
if len(row_list) == 0:
raise self.messages[len(self.messages) - 1]
else:
LogMsg(DEBUG, f"Returning {row_list} from _fetch_helper()")
LogMsg(INFO, "exit _fetch_helper()")
return row_list

if row != False:
Expand All @@ -1810,8 +1808,11 @@ def _fetch_helper(self, fetch_size=-1):
else:
row_list.append(row)
else:
LogMsg(DEBUG, f"Returning {row_list} from _fetch_helper()")
LogMsg(INFO, "exit _fetch_helper()")
return row_list
rows_fetched = rows_fetched + 1
LogMsg(DEBUG, f"Returning {row_list} from _fetch_helper()")
LogMsg(INFO, "exit _fetch_helper()")
return row_list

Expand Down Expand Up @@ -1854,10 +1855,12 @@ def fetchmany(self, size=0):
self.messages.append(ProgrammingError("fetchmany argument size expected to be positive."))
raise self.messages[len(self.messages) - 1]

message = f"Fetched {len(self._fetch_helper(size))} rows successfully."
fetch_nrows = self._fetch_helper(size)
nrows = len(fetch_nrows)
message = f"Fetched {nrows} rows successfully."
LogMsg(DEBUG, message)
LogMsg(INFO, "exit fetchmany()")
return self._fetch_helper(size)
return fetch_nrows

def fetchall(self):
"""This method fetches all remaining rows from the database,
Expand All @@ -1866,7 +1869,8 @@ def fetchall(self):
LogMsg(INFO, "entry fetchall()")
LogMsg(INFO, "Fetching all remaining rows from the database.")
rows_fetched = self._fetch_helper()
LogMsg(DEBUG, f"Fetched {len(rows_fetched)} rows successfully.")
nrows = len(rows_fetched)
LogMsg(DEBUG, f"Fetched {nrows} rows successfully.")
LogMsg(INFO, "exit fetchall()")
return rows_fetched

Expand Down

0 comments on commit c67d1bb

Please sign in to comment.