Skip to content

Commit

Permalink
Adjust variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
ffelixg committed Jan 28, 2024
1 parent 2d9fec2 commit c0eb022
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
29 changes: 15 additions & 14 deletions src/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ static bool DetectConfigChange(Cursor* cur)
{
return false;
}
if (cur->converted_types)
if (cur->bound_converted_types)
{
switch (PyObject_RichCompareBool(cur->converted_types, converted_types, Py_EQ))
switch (PyObject_RichCompareBool(cur->bound_converted_types, converted_types, Py_EQ))
{
case -1: // error
Py_DECREF(converted_types);
Expand All @@ -417,16 +417,16 @@ static bool DetectConfigChange(Cursor* cur)
converted_types_changed = true;
}
}
else if (cur->converted_types)
else if (cur->bound_converted_types)
{
converted_types_changed = true;
}

if (cur->UseNativeUUID != native_uuid || converted_types_changed)
if (cur->bound_native_uuid != native_uuid || converted_types_changed)
{
Py_XDECREF(cur->converted_types);
cur->converted_types = converted_types;
cur->UseNativeUUID = native_uuid;
Py_XDECREF(cur->bound_converted_types);
cur->bound_converted_types = converted_types;
cur->bound_native_uuid = native_uuid;

if (cur->description != Py_None)
{
Expand All @@ -442,6 +442,7 @@ static bool DetectConfigChange(Cursor* cur)
return true;
}


static bool free_results(Cursor* self, int flags)
{
// Internal function called any time we need to free the memory associated with query results. It is safe to call
Expand All @@ -463,7 +464,7 @@ static bool free_results(Cursor* self, int flags)
{
BindColsFree(self, PyTuple_GET_SIZE(self->description));
}
Py_XDECREF(self->converted_types);
Py_XDECREF(self->bound_converted_types);

if (self->colinfos)
{
Expand Down Expand Up @@ -702,19 +703,19 @@ static bool PrepareResults(Cursor* cur, int cCols)
}
}

cur->UseNativeUUID = UseNativeUUID();
cur->bound_native_uuid = UseNativeUUID();
if (cur->cnxn->map_sqltype_to_converter)
{
cur->converted_types = PyDict_Keys(cur->cnxn->map_sqltype_to_converter);
if (!cur->converted_types)
cur->bound_converted_types = PyDict_Keys(cur->cnxn->map_sqltype_to_converter);
if (!cur->bound_converted_types)
{
PyMem_Free(cur->colinfos);
return false;
}
}
else
{
cur->converted_types = 0;
cur->bound_converted_types = 0;
}

if (!BindCols(cur, cCols))
Expand Down Expand Up @@ -2660,8 +2661,8 @@ Cursor_New(Connection* cnxn)
cur->messages = Py_None;
cur->valueBufs = 0;
cur->cbFetchedBufs = 0;
cur->converted_types = 0;
cur->UseNativeUUID = 0;
cur->bound_converted_types = 0;
cur->bound_native_uuid = 0;

Py_INCREF(cnxn);
Py_INCREF(cur->description);
Expand Down
6 changes: 2 additions & 4 deletions src/cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,8 @@ struct Cursor
SQLLEN* cbFetchedBufs;

// Track the configuration at the time of using SQLBindCol.
bool UseNativeUUID;
PyObject* converted_types;
// SQLSMALLINT* converted_types;
// int num_converted_types;
bool bound_native_uuid;
PyObject* bound_converted_types;
};

void Cursor_init();
Expand Down

0 comments on commit c0eb022

Please sign in to comment.