mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-20486: Implement Database.Close() method in msilib (GH-4141)
This commit is contained in:
parent
3cc4c53a64
commit
a935654f06
3 changed files with 21 additions and 8 deletions
21
PC/_msi.c
21
PC/_msi.c
|
@ -286,14 +286,6 @@ msiobj_dealloc(msiobj* msidb)
|
|||
PyObject_Del(msidb);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
msiobj_close(msiobj* msidb, PyObject *args)
|
||||
{
|
||||
MsiCloseHandle(msidb->h);
|
||||
msidb->h = 0;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
msierror(int status)
|
||||
{
|
||||
|
@ -342,6 +334,17 @@ msierror(int status)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
msidb_close(msiobj* msidb, PyObject *args)
|
||||
{
|
||||
int status;
|
||||
if ((status = MsiCloseHandle(msidb->h)) != ERROR_SUCCESS) {
|
||||
return msierror(status);
|
||||
}
|
||||
msidb->h = 0;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/*************************** Record objects **********************/
|
||||
|
||||
static PyObject*
|
||||
|
@ -901,6 +904,8 @@ static PyMethodDef db_methods[] = {
|
|||
PyDoc_STR("Commit() -> None\nWraps MsiDatabaseCommit")},
|
||||
{ "GetSummaryInformation", (PyCFunction)msidb_getsummaryinformation, METH_VARARGS,
|
||||
PyDoc_STR("GetSummaryInformation(updateCount) -> viewobj\nWraps MsiGetSummaryInformation")},
|
||||
{ "Close", (PyCFunction)msidb_close, METH_NOARGS,
|
||||
PyDoc_STR("Close() -> None\nWraps MsiCloseHandle")},
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue