summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-07-01 18:53:07 (GMT)
committerGitHub <noreply@github.com>2020-07-01 18:53:07 (GMT)
commit5d5c84ef78b19211671c2bfa68fe073485135eed (patch)
treedcf9d1a3475a77d658a7fa3e85ceff0deef61535 /PC
parentd0981e61a5869c48e0a70a512967558391272a93 (diff)
downloadcpython-5d5c84ef78b19211671c2bfa68fe073485135eed.zip
cpython-5d5c84ef78b19211671c2bfa68fe073485135eed.tar.gz
cpython-5d5c84ef78b19211671c2bfa68fe073485135eed.tar.bz2
bpo-41187: Convert the _msi module to Argument Clinic (GH-21264)
Diffstat (limited to 'PC')
-rw-r--r--PC/_msi.c524
-rw-r--r--PC/clinic/_msi.c.h728
2 files changed, 1069 insertions, 183 deletions
diff --git a/PC/_msi.c b/PC/_msi.c
index 60a0c3a..9f10158 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -12,10 +12,26 @@
#include <msidefs.h>
#include <rpc.h>
+/*[clinic input]
+module _msi
+class _msi.Record "msiobj *" "&record_Type"
+class _msi.SummaryInformation "msiobj *" "&summary_Type"
+class _msi.View "msiobj *" "&msiview_Type"
+class _msi.Database "msiobj *" "&msidb_Type"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=89a3605762cf4bdc]*/
+
static PyObject *MSIError;
-static PyObject*
-uuidcreate(PyObject* obj, PyObject*args)
+/*[clinic input]
+_msi.UuidCreate
+
+Return the string representation of a new unique identifier.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_UuidCreate_impl(PyObject *module)
+/*[clinic end generated code: output=534ecf36f10af98e input=168024ab4b3e832b]*/
{
UUID result;
wchar_t *cresult;
@@ -225,19 +241,28 @@ static FNFCIGETOPENINFO(cb_getopeninfo)
return result;
}
-static PyObject* fcicreate(PyObject* obj, PyObject* args)
+/*[clinic input]
+_msi.FCICreate
+ cabname: str
+ the name of the CAB file
+ files: object
+ a list of tuples, each containing the name of the file on disk,
+ and the name of the file inside the CAB file
+ /
+
+Create a new CAB file.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_FCICreate_impl(PyObject *module, const char *cabname, PyObject *files)
+/*[clinic end generated code: output=55dc05728361b799 input=1d2d75fdc8b44b71]*/
{
- char *cabname, *p;
- PyObject *files;
+ const char *p;
CCAB ccab;
HFCI hfci;
ERF erf;
Py_ssize_t i;
-
- if (!PyArg_ParseTuple(args, "sO:FCICreate", &cabname, &files))
- return NULL;
-
if (!PyList_Check(files)) {
PyErr_SetString(PyExc_TypeError, "FCICreate expects a list");
return NULL;
@@ -387,34 +412,56 @@ msierror(int status)
return NULL;
}
-static PyObject*
-msidb_close(msiobj* msidb, PyObject *args)
+#include "clinic/_msi.c.h"
+
+/*[clinic input]
+_msi.Database.Close
+
+Close the database object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Database_Close_impl(msiobj *self)
+/*[clinic end generated code: output=ddf2d7712ea804f1 input=104330ce4a486187]*/
{
int status;
- if ((status = MsiCloseHandle(msidb->h)) != ERROR_SUCCESS) {
+ if ((status = MsiCloseHandle(self->h)) != ERROR_SUCCESS) {
return msierror(status);
}
- msidb->h = 0;
+ self->h = 0;
Py_RETURN_NONE;
}
/*************************** Record objects **********************/
-static PyObject*
-record_getfieldcount(msiobj* record, PyObject* args)
+/*[clinic input]
+_msi.Record.GetFieldCount
+
+Return the number of fields of the record.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_GetFieldCount_impl(msiobj *self)
+/*[clinic end generated code: output=112795079c904398 input=5fb9d4071b28897b]*/
{
- return PyLong_FromLong(MsiRecordGetFieldCount(record->h));
+ return PyLong_FromLong(MsiRecordGetFieldCount(self->h));
}
-static PyObject*
-record_getinteger(msiobj* record, PyObject* args)
+/*[clinic input]
+_msi.Record.GetInteger
+ field: unsigned_int(bitwise=True)
+ /
+
+Return the value of field as an integer where possible.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_GetInteger_impl(msiobj *self, unsigned int field)
+/*[clinic end generated code: output=7174ebb6e8ed1c79 input=d19209947e2bfe61]*/
{
- unsigned int field;
int status;
- if (!PyArg_ParseTuple(args, "I:GetInteger", &field))
- return NULL;
- status = MsiRecordGetInteger(record->h, field);
+ status = MsiRecordGetInteger(self->h, field);
if (status == MSI_NULL_INTEGER){
PyErr_SetString(MSIError, "could not convert record field to integer");
return NULL;
@@ -422,24 +469,30 @@ record_getinteger(msiobj* record, PyObject* args)
return PyLong_FromLong((long) status);
}
-static PyObject*
-record_getstring(msiobj* record, PyObject* args)
+/*[clinic input]
+_msi.Record.GetString
+ field: unsigned_int(bitwise=True)
+ /
+
+Return the value of field as a string where possible.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_GetString_impl(msiobj *self, unsigned int field)
+/*[clinic end generated code: output=f670d1b484cfa47c input=ffa11f21450b77d8]*/
{
- unsigned int field;
unsigned int status;
WCHAR buf[2000];
WCHAR *res = buf;
DWORD size = sizeof(buf);
PyObject* string;
- if (!PyArg_ParseTuple(args, "I:GetString", &field))
- return NULL;
- status = MsiRecordGetStringW(record->h, field, res, &size);
+ status = MsiRecordGetStringW(self->h, field, res, &size);
if (status == ERROR_MORE_DATA) {
res = (WCHAR*) malloc((size + 1)*sizeof(WCHAR));
if (res == NULL)
return PyErr_NoMemory();
- status = MsiRecordGetStringW(record->h, field, res, &size);
+ status = MsiRecordGetStringW(self->h, field, res, &size);
}
if (status != ERROR_SUCCESS)
return msierror((int) status);
@@ -449,59 +502,81 @@ record_getstring(msiobj* record, PyObject* args)
return string;
}
-static PyObject*
-record_cleardata(msiobj* record, PyObject *args)
+/*[clinic input]
+_msi.Record.ClearData
+
+Set all fields of the record to 0.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_ClearData_impl(msiobj *self)
+/*[clinic end generated code: output=1891467214b977f4 input=2a911c95aaded102]*/
{
- int status = MsiRecordClearData(record->h);
+ int status = MsiRecordClearData(self->h);
if (status != ERROR_SUCCESS)
return msierror(status);
Py_RETURN_NONE;
}
-static PyObject*
-record_setstring(msiobj* record, PyObject *args)
+/*[clinic input]
+_msi.Record.SetString
+ field: int
+ value: Py_UNICODE
+ /
+
+Set field to a string value.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_SetString_impl(msiobj *self, int field, const Py_UNICODE *value)
+/*[clinic end generated code: output=2e37505b0f11f985 input=fb8ec70a2a6148e0]*/
{
int status;
- int field;
- wchar_t *data;
-
- if (!PyArg_ParseTuple(args, "iu:SetString", &field, &data))
- return NULL;
- if ((status = MsiRecordSetStringW(record->h, field, data)) != ERROR_SUCCESS)
+ if ((status = MsiRecordSetStringW(self->h, field, value)) != ERROR_SUCCESS)
return msierror(status);
Py_RETURN_NONE;
}
-static PyObject*
-record_setstream(msiobj* record, PyObject *args)
+/*[clinic input]
+_msi.Record.SetStream
+ field: int
+ value: Py_UNICODE
+ /
+
+Set field to the contents of the file named value.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_SetStream_impl(msiobj *self, int field, const Py_UNICODE *value)
+/*[clinic end generated code: output=442facac16913b48 input=a07aa19b865e8292]*/
{
int status;
- int field;
- wchar_t *data;
- if (!PyArg_ParseTuple(args, "iu:SetStream", &field, &data))
- return NULL;
-
- if ((status = MsiRecordSetStreamW(record->h, field, data)) != ERROR_SUCCESS)
+ if ((status = MsiRecordSetStreamW(self->h, field, value)) != ERROR_SUCCESS)
return msierror(status);
Py_RETURN_NONE;
}
-static PyObject*
-record_setinteger(msiobj* record, PyObject *args)
+/*[clinic input]
+_msi.Record.SetInteger
+ field: int
+ value: int
+ /
+
+Set field to an integer value.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_SetInteger_impl(msiobj *self, int field, int value)
+/*[clinic end generated code: output=669e8647775d0ce7 input=c571aa775e7e451b]*/
{
int status;
- int field;
- int data;
-
- if (!PyArg_ParseTuple(args, "ii:SetInteger", &field, &data))
- return NULL;
- if ((status = MsiRecordSetInteger(record->h, field, data)) != ERROR_SUCCESS)
+ if ((status = MsiRecordSetInteger(self->h, field, value)) != ERROR_SUCCESS)
return msierror(status);
Py_RETURN_NONE;
@@ -510,20 +585,13 @@ record_setinteger(msiobj* record, PyObject *args)
static PyMethodDef record_methods[] = {
- { "GetFieldCount", (PyCFunction)record_getfieldcount, METH_NOARGS,
- PyDoc_STR("GetFieldCount() -> int\nWraps MsiRecordGetFieldCount")},
- { "GetInteger", (PyCFunction)record_getinteger, METH_VARARGS,
- PyDoc_STR("GetInteger(field) -> int\nWraps MsiRecordGetInteger")},
- { "GetString", (PyCFunction)record_getstring, METH_VARARGS,
- PyDoc_STR("GetString(field) -> string\nWraps MsiRecordGetString")},
- { "SetString", (PyCFunction)record_setstring, METH_VARARGS,
- PyDoc_STR("SetString(field,str) -> None\nWraps MsiRecordSetString")},
- { "SetStream", (PyCFunction)record_setstream, METH_VARARGS,
- PyDoc_STR("SetStream(field,filename) -> None\nWraps MsiRecordSetInteger")},
- { "SetInteger", (PyCFunction)record_setinteger, METH_VARARGS,
- PyDoc_STR("SetInteger(field,int) -> None\nWraps MsiRecordSetInteger")},
- { "ClearData", (PyCFunction)record_cleardata, METH_NOARGS,
- PyDoc_STR("ClearData() -> int\nWraps MsiRecordGClearData")},
+ _MSI_RECORD_GETFIELDCOUNT_METHODDEF
+ _MSI_RECORD_GETINTEGER_METHODDEF
+ _MSI_RECORD_GETSTRING_METHODDEF
+ _MSI_RECORD_SETSTRING_METHODDEF
+ _MSI_RECORD_SETSTREAM_METHODDEF
+ _MSI_RECORD_SETINTEGER_METHODDEF
+ _MSI_RECORD_CLEARDATA_METHODDEF
{ NULL, NULL }
};
@@ -587,11 +655,20 @@ record_new(MSIHANDLE h)
/*************************** SummaryInformation objects **************/
-static PyObject*
-summary_getproperty(msiobj* si, PyObject *args)
+/*[clinic input]
+_msi.SummaryInformation.GetProperty
+ field: int
+ the name of the property, one of the PID_* constants
+ /
+
+Return a property of the summary.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_SummaryInformation_GetProperty_impl(msiobj *self, int field)
+/*[clinic end generated code: output=f8946a33ee14f6ef input=f8dfe2c890d6cb8b]*/
{
int status;
- int field;
PyObject *result;
UINT type;
INT ival;
@@ -600,10 +677,7 @@ summary_getproperty(msiobj* si, PyObject *args)
char *sval = sbuf;
DWORD ssize = sizeof(sbuf);
- if (!PyArg_ParseTuple(args, "i:GetProperty", &field))
- return NULL;
-
- status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
+ status = MsiSummaryInfoGetProperty(self->h, field, &type, &ival,
&fval, sval, &ssize);
if (status == ERROR_MORE_DATA) {
ssize++;
@@ -611,7 +685,7 @@ summary_getproperty(msiobj* si, PyObject *args)
if (sval == NULL) {
return PyErr_NoMemory();
}
- status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
+ status = MsiSummaryInfoGetProperty(self->h, field, &type, &ival,
&fval, sval, &ssize);
}
if (status != ERROR_SUCCESS) {
@@ -644,42 +718,67 @@ summary_getproperty(msiobj* si, PyObject *args)
return result;
}
-static PyObject*
-summary_getpropertycount(msiobj* si, PyObject *args)
+/*[clinic input]
+_msi.SummaryInformation.GetPropertyCount
+
+Return the number of summary properties.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_SummaryInformation_GetPropertyCount_impl(msiobj *self)
+/*[clinic end generated code: output=68e94b2aeee92b3d input=2e71e985586d82dc]*/
{
int status;
UINT result;
- status = MsiSummaryInfoGetPropertyCount(si->h, &result);
+ status = MsiSummaryInfoGetPropertyCount(self->h, &result);
if (status != ERROR_SUCCESS)
return msierror(status);
return PyLong_FromLong(result);
}
-static PyObject*
-summary_setproperty(msiobj* si, PyObject *args)
+/*[clinic input]
+_msi.SummaryInformation.SetProperty
+ field: int
+ the name of the property, one of the PID_* constants
+ value as data: object
+ the new value of the property (integer or string)
+ /
+
+Set a property.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_SummaryInformation_SetProperty_impl(msiobj *self, int field,
+ PyObject *data)
+/*[clinic end generated code: output=3d4692c8984bb675 input=f2a7811b905abbed]*/
{
int status;
- int field;
- PyObject* data;
-
- if (!PyArg_ParseTuple(args, "iO:SetProperty", &field, &data))
- return NULL;
if (PyUnicode_Check(data)) {
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const WCHAR *value = _PyUnicode_AsUnicode(data);
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+ WCHAR *value = PyUnicode_AsWideCharString(data, NULL);
+#endif /* USE_UNICODE_WCHAR_CACHE */
if (value == NULL) {
return NULL;
}
- status = MsiSummaryInfoSetPropertyW(si->h, field, VT_LPSTR,
+ status = MsiSummaryInfoSetPropertyW(self->h, field, VT_LPSTR,
0, NULL, value);
+#if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free(value);
+#endif /* USE_UNICODE_WCHAR_CACHE */
} else if (PyLong_CheckExact(data)) {
long value = PyLong_AsLong(data);
if (value == -1 && PyErr_Occurred()) {
return NULL;
}
- status = MsiSummaryInfoSetProperty(si->h, field, VT_I4,
+ status = MsiSummaryInfoSetProperty(self->h, field, VT_I4,
value, NULL, NULL);
} else {
PyErr_SetString(PyExc_TypeError, "unsupported type");
@@ -693,26 +792,29 @@ summary_setproperty(msiobj* si, PyObject *args)
}
-static PyObject*
-summary_persist(msiobj* si, PyObject *args)
+/*[clinic input]
+_msi.SummaryInformation.Persist
+
+Write the modified properties to the summary information stream.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_SummaryInformation_Persist_impl(msiobj *self)
+/*[clinic end generated code: output=c564bd17f5e122c9 input=e3dda9d530095ef7]*/
{
int status;
- status = MsiSummaryInfoPersist(si->h);
+ status = MsiSummaryInfoPersist(self->h);
if (status != ERROR_SUCCESS)
return msierror(status);
Py_RETURN_NONE;
}
static PyMethodDef summary_methods[] = {
- { "GetProperty", (PyCFunction)summary_getproperty, METH_VARARGS,
- PyDoc_STR("GetProperty(propid) -> value\nWraps MsiSummaryInfoGetProperty")},
- { "GetPropertyCount", (PyCFunction)summary_getpropertycount, METH_NOARGS,
- PyDoc_STR("GetProperty() -> int\nWraps MsiSummaryInfoGetPropertyCount")},
- { "SetProperty", (PyCFunction)summary_setproperty, METH_VARARGS,
- PyDoc_STR("SetProperty(value) -> None\nWraps MsiSummaryInfoProperty")},
- { "Persist", (PyCFunction)summary_persist, METH_NOARGS,
- PyDoc_STR("Persist() -> None\nWraps MsiSummaryInfoPersist")},
+ _MSI_SUMMARYINFORMATION_GETPROPERTY_METHODDEF
+ _MSI_SUMMARYINFORMATION_GETPROPERTYCOUNT_METHODDEF
+ _MSI_SUMMARYINFORMATION_SETPROPERTY_METHODDEF
+ _MSI_SUMMARYINFORMATION_PERSIST_METHODDEF
{ NULL, NULL }
};
@@ -762,15 +864,22 @@ static PyTypeObject summary_Type = {
/*************************** View objects **************/
-static PyObject*
-view_execute(msiobj *view, PyObject*args)
+/*[clinic input]
+_msi.View.Execute
+ params as oparams: object
+ a record describing actual values of the parameter tokens
+ in the query or None
+ /
+
+Execute the SQL query of the view.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_Execute(msiobj *self, PyObject *oparams)
+/*[clinic end generated code: output=f0f65fd2900bcb4e input=cb163a15d453348e]*/
{
int status;
MSIHANDLE params = 0;
- PyObject *oparams = Py_None;
-
- if (!PyArg_ParseTuple(args, "O:Execute", &oparams))
- return NULL;
if (oparams != Py_None) {
if (oparams->ob_type != &record_Type) {
@@ -780,20 +889,27 @@ view_execute(msiobj *view, PyObject*args)
params = ((msiobj*)oparams)->h;
}
- status = MsiViewExecute(view->h, params);
+ status = MsiViewExecute(self->h, params);
if (status != ERROR_SUCCESS)
return msierror(status);
Py_RETURN_NONE;
}
-static PyObject*
-view_fetch(msiobj *view, PyObject*args)
+/*[clinic input]
+_msi.View.Fetch
+
+Return a result record of the query.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_Fetch_impl(msiobj *self)
+/*[clinic end generated code: output=ba154a3794537d4e input=7f3e3d06c449001c]*/
{
int status;
MSIHANDLE result;
- status = MsiViewFetch(view->h, &result);
+ status = MsiViewFetch(self->h, &result);
if (status == ERROR_NO_MORE_ITEMS) {
Py_RETURN_NONE;
} else if (status != ERROR_SUCCESS) {
@@ -803,65 +919,80 @@ view_fetch(msiobj *view, PyObject*args)
return record_new(result);
}
-static PyObject*
-view_getcolumninfo(msiobj *view, PyObject *args)
+/*[clinic input]
+_msi.View.GetColumnInfo
+ kind: int
+ MSICOLINFO_NAMES or MSICOLINFO_TYPES
+ /
+
+Return a record describing the columns of the view.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_GetColumnInfo_impl(msiobj *self, int kind)
+/*[clinic end generated code: output=e7c1697db9403660 input=afedb892bf564a3b]*/
{
int status;
- int kind;
MSIHANDLE result;
- if (!PyArg_ParseTuple(args, "i:GetColumnInfo", &kind))
- return NULL;
-
- if ((status = MsiViewGetColumnInfo(view->h, kind, &result)) != ERROR_SUCCESS)
+ if ((status = MsiViewGetColumnInfo(self->h, kind, &result)) != ERROR_SUCCESS)
return msierror(status);
return record_new(result);
}
-static PyObject*
-view_modify(msiobj *view, PyObject *args)
+/*[clinic input]
+_msi.View.Modify
+ kind: int
+ one of the MSIMODIFY_* constants
+ data: object
+ a record describing the new data
+ /
+
+Modify the view.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_Modify_impl(msiobj *self, int kind, PyObject *data)
+/*[clinic end generated code: output=69aaf3ce8ddac0ba input=2828de22de0d47b4]*/
{
- int kind;
- PyObject *data;
int status;
- if (!PyArg_ParseTuple(args, "iO:Modify", &kind, &data))
- return NULL;
-
if (data->ob_type != &record_Type) {
PyErr_SetString(PyExc_TypeError, "Modify expects a record object");
return NULL;
}
- if ((status = MsiViewModify(view->h, kind, ((msiobj*)data)->h)) != ERROR_SUCCESS)
+ if ((status = MsiViewModify(self->h, kind, ((msiobj*)data)->h)) != ERROR_SUCCESS)
return msierror(status);
Py_RETURN_NONE;
}
-static PyObject*
-view_close(msiobj *view, PyObject*args)
+/*[clinic input]
+_msi.View.Close
+
+Close the view.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_Close_impl(msiobj *self)
+/*[clinic end generated code: output=488f7b8645ca104a input=de6927d1308c401c]*/
{
int status;
- if ((status = MsiViewClose(view->h)) != ERROR_SUCCESS)
+ if ((status = MsiViewClose(self->h)) != ERROR_SUCCESS)
return msierror(status);
Py_RETURN_NONE;
}
static PyMethodDef view_methods[] = {
- { "Execute", (PyCFunction)view_execute, METH_VARARGS,
- PyDoc_STR("Execute(params=None) -> None\nWraps MsiViewExecute")},
- { "GetColumnInfo", (PyCFunction)view_getcolumninfo, METH_VARARGS,
- PyDoc_STR("GetColumnInfo() -> result\nWraps MsiGetColumnInfo")},
- { "Fetch", (PyCFunction)view_fetch, METH_NOARGS,
- PyDoc_STR("Fetch() -> result\nWraps MsiViewFetch")},
- { "Modify", (PyCFunction)view_modify, METH_VARARGS,
- PyDoc_STR("Modify(mode,record) -> None\nWraps MsiViewModify")},
- { "Close", (PyCFunction)view_close, METH_NOARGS,
- PyDoc_STR("Close() -> result\nWraps MsiViewClose")},
+ _MSI_VIEW_EXECUTE_METHODDEF
+ _MSI_VIEW_GETCOLUMNINFO_METHODDEF
+ _MSI_VIEW_FETCH_METHODDEF
+ _MSI_VIEW_MODIFY_METHODDEF
+ _MSI_VIEW_CLOSE_METHODDEF
{ NULL, NULL }
};
@@ -911,18 +1042,24 @@ static PyTypeObject msiview_Type = {
/*************************** Database objects **************/
-static PyObject*
-msidb_openview(msiobj *msidb, PyObject *args)
+/*[clinic input]
+_msi.Database.OpenView
+ sql: Py_UNICODE
+ the SQL statement to execute
+ /
+
+Return a view object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Database_OpenView_impl(msiobj *self, const Py_UNICODE *sql)
+/*[clinic end generated code: output=e712e6a11229abfd input=50f1771f37e500df]*/
{
int status;
- const wchar_t *sql;
MSIHANDLE hView;
msiobj *result;
- if (!PyArg_ParseTuple(args, "u:OpenView", &sql))
- return NULL;
-
- if ((status = MsiDatabaseOpenViewW(msidb->h, sql, &hView)) != ERROR_SUCCESS)
+ if ((status = MsiDatabaseOpenViewW(self->h, sql, &hView)) != ERROR_SUCCESS)
return msierror(status);
result = PyObject_New(struct msiobj, &msiview_Type);
@@ -935,29 +1072,42 @@ msidb_openview(msiobj *msidb, PyObject *args)
return (PyObject*)result;
}
-static PyObject*
-msidb_commit(msiobj *msidb, PyObject *args)
+/*[clinic input]
+_msi.Database.Commit
+
+Commit the changes pending in the current transaction.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Database_Commit_impl(msiobj *self)
+/*[clinic end generated code: output=f33021feb8b0cdd8 input=375bb120d402266d]*/
{
int status;
- if ((status = MsiDatabaseCommit(msidb->h)) != ERROR_SUCCESS)
+ if ((status = MsiDatabaseCommit(self->h)) != ERROR_SUCCESS)
return msierror(status);
Py_RETURN_NONE;
}
-static PyObject*
-msidb_getsummaryinformation(msiobj *db, PyObject *args)
+/*[clinic input]
+_msi.Database.GetSummaryInformation
+ count: int
+ the maximum number of updated values
+ /
+
+Return a new summary information object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Database_GetSummaryInformation_impl(msiobj *self, int count)
+/*[clinic end generated code: output=781e51a4ea4da847 input=18a899ead6521735]*/
{
int status;
- int count;
MSIHANDLE result;
msiobj *oresult;
- if (!PyArg_ParseTuple(args, "i:GetSummaryInformation", &count))
- return NULL;
-
- status = MsiGetSummaryInformation(db->h, NULL, count, &result);
+ status = MsiGetSummaryInformation(self->h, NULL, count, &result);
if (status != ERROR_SUCCESS)
return msierror(status);
@@ -972,14 +1122,10 @@ msidb_getsummaryinformation(msiobj *db, PyObject *args)
}
static PyMethodDef db_methods[] = {
- { "OpenView", (PyCFunction)msidb_openview, METH_VARARGS,
- PyDoc_STR("OpenView(sql) -> viewobj\nWraps MsiDatabaseOpenView")},
- { "Commit", (PyCFunction)msidb_commit, METH_NOARGS,
- 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")},
+ _MSI_DATABASE_OPENVIEW_METHODDEF
+ _MSI_DATABASE_COMMIT_METHODDEF
+ _MSI_DATABASE_GETSUMMARYINFORMATION_METHODDEF
+ _MSI_DATABASE_CLOSE_METHODDEF
{ NULL, NULL }
};
@@ -1038,15 +1184,25 @@ static PyTypeObject msidb_Type = {
Py_NOT_PERSIST(x, MSIDBOPEN_CREATE) && \
Py_NOT_PERSIST(x, MSIDBOPEN_CREATEDIRECT))
-static PyObject* msiopendb(PyObject *obj, PyObject *args)
+/*[clinic input]
+_msi.OpenDatabase
+ path: Py_UNICODE
+ the file name of the MSI file
+ persist: int
+ the persistence mode
+ /
+
+Return a new database object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_OpenDatabase_impl(PyObject *module, const Py_UNICODE *path, int persist)
+/*[clinic end generated code: output=d34b7202b745de05 input=1300f3b97659559b]*/
{
int status;
- const wchar_t *path;
- int persist;
MSIHANDLE h;
msiobj *result;
- if (!PyArg_ParseTuple(args, "ui:MSIOpenDatabase", &path, &persist))
- return NULL;
+
/* We need to validate that persist is a valid MSIDBOPEN_* value. Otherwise,
MsiOpenDatabase may treat the value as a pointer, leading to unexpected
behavior. */
@@ -1065,15 +1221,21 @@ static PyObject* msiopendb(PyObject *obj, PyObject *args)
return (PyObject*)result;
}
-static PyObject*
-createrecord(PyObject *o, PyObject *args)
+/*[clinic input]
+_msi.CreateRecord
+ count: int
+ the number of fields of the record
+ /
+
+Return a new record object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_CreateRecord_impl(PyObject *module, int count)
+/*[clinic end generated code: output=0ba0a00beea3e99e input=53f17d5b5d9b077d]*/
{
- int count;
MSIHANDLE h;
- if (!PyArg_ParseTuple(args, "i:CreateRecord", &count))
- return NULL;
-
h = MsiCreateRecord(count);
if (h == 0)
return msierror(0);
@@ -1083,14 +1245,10 @@ createrecord(PyObject *o, PyObject *args)
static PyMethodDef msi_methods[] = {
- {"UuidCreate", (PyCFunction)uuidcreate, METH_NOARGS,
- PyDoc_STR("UuidCreate() -> string")},
- {"FCICreate", (PyCFunction)fcicreate, METH_VARARGS,
- PyDoc_STR("fcicreate(cabname,files) -> None")},
- {"OpenDatabase", (PyCFunction)msiopendb, METH_VARARGS,
- PyDoc_STR("OpenDatabase(name, flags) -> dbobj\nWraps MsiOpenDatabase")},
- {"CreateRecord", (PyCFunction)createrecord, METH_VARARGS,
- PyDoc_STR("OpenDatabase(name, flags) -> dbobj\nWraps MsiCreateRecord")},
+ _MSI_UUIDCREATE_METHODDEF
+ _MSI_FCICREATE_METHODDEF
+ _MSI_OPENDATABASE_METHODDEF
+ _MSI_CREATERECORD_METHODDEF
{NULL, NULL} /* sentinel */
};
diff --git a/PC/clinic/_msi.c.h b/PC/clinic/_msi.c.h
new file mode 100644
index 0000000..895bf39
--- /dev/null
+++ b/PC/clinic/_msi.c.h
@@ -0,0 +1,728 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_msi_UuidCreate__doc__,
+"UuidCreate($module, /)\n"
+"--\n"
+"\n"
+"Return the string representation of a new unique identifier.");
+
+#define _MSI_UUIDCREATE_METHODDEF \
+ {"UuidCreate", (PyCFunction)_msi_UuidCreate, METH_NOARGS, _msi_UuidCreate__doc__},
+
+static PyObject *
+_msi_UuidCreate_impl(PyObject *module);
+
+static PyObject *
+_msi_UuidCreate(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_UuidCreate_impl(module);
+}
+
+PyDoc_STRVAR(_msi_FCICreate__doc__,
+"FCICreate($module, cabname, files, /)\n"
+"--\n"
+"\n"
+"Create a new CAB file.\n"
+"\n"
+" cabname\n"
+" the name of the CAB file\n"
+" files\n"
+" a list of tuples, each containing the name of the file on disk,\n"
+" and the name of the file inside the CAB file");
+
+#define _MSI_FCICREATE_METHODDEF \
+ {"FCICreate", (PyCFunction)(void(*)(void))_msi_FCICreate, METH_FASTCALL, _msi_FCICreate__doc__},
+
+static PyObject *
+_msi_FCICreate_impl(PyObject *module, const char *cabname, PyObject *files);
+
+static PyObject *
+_msi_FCICreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ const char *cabname;
+ PyObject *files;
+
+ if (!_PyArg_CheckPositional("FCICreate", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("FCICreate", "argument 1", "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t cabname_length;
+ cabname = PyUnicode_AsUTF8AndSize(args[0], &cabname_length);
+ if (cabname == NULL) {
+ goto exit;
+ }
+ if (strlen(cabname) != (size_t)cabname_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ files = args[1];
+ return_value = _msi_FCICreate_impl(module, cabname, files);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Database_Close__doc__,
+"Close($self, /)\n"
+"--\n"
+"\n"
+"Close the database object.");
+
+#define _MSI_DATABASE_CLOSE_METHODDEF \
+ {"Close", (PyCFunction)_msi_Database_Close, METH_NOARGS, _msi_Database_Close__doc__},
+
+static PyObject *
+_msi_Database_Close_impl(msiobj *self);
+
+static PyObject *
+_msi_Database_Close(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_Database_Close_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Record_GetFieldCount__doc__,
+"GetFieldCount($self, /)\n"
+"--\n"
+"\n"
+"Return the number of fields of the record.");
+
+#define _MSI_RECORD_GETFIELDCOUNT_METHODDEF \
+ {"GetFieldCount", (PyCFunction)_msi_Record_GetFieldCount, METH_NOARGS, _msi_Record_GetFieldCount__doc__},
+
+static PyObject *
+_msi_Record_GetFieldCount_impl(msiobj *self);
+
+static PyObject *
+_msi_Record_GetFieldCount(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_Record_GetFieldCount_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Record_GetInteger__doc__,
+"GetInteger($self, field, /)\n"
+"--\n"
+"\n"
+"Return the value of field as an integer where possible.");
+
+#define _MSI_RECORD_GETINTEGER_METHODDEF \
+ {"GetInteger", (PyCFunction)_msi_Record_GetInteger, METH_O, _msi_Record_GetInteger__doc__},
+
+static PyObject *
+_msi_Record_GetInteger_impl(msiobj *self, unsigned int field);
+
+static PyObject *
+_msi_Record_GetInteger(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ unsigned int field;
+
+ field = (unsigned int)PyLong_AsUnsignedLongMask(arg);
+ if (field == (unsigned int)-1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_Record_GetInteger_impl(self, field);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_GetString__doc__,
+"GetString($self, field, /)\n"
+"--\n"
+"\n"
+"Return the value of field as a string where possible.");
+
+#define _MSI_RECORD_GETSTRING_METHODDEF \
+ {"GetString", (PyCFunction)_msi_Record_GetString, METH_O, _msi_Record_GetString__doc__},
+
+static PyObject *
+_msi_Record_GetString_impl(msiobj *self, unsigned int field);
+
+static PyObject *
+_msi_Record_GetString(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ unsigned int field;
+
+ field = (unsigned int)PyLong_AsUnsignedLongMask(arg);
+ if (field == (unsigned int)-1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_Record_GetString_impl(self, field);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_ClearData__doc__,
+"ClearData($self, /)\n"
+"--\n"
+"\n"
+"Set all fields of the record to 0.");
+
+#define _MSI_RECORD_CLEARDATA_METHODDEF \
+ {"ClearData", (PyCFunction)_msi_Record_ClearData, METH_NOARGS, _msi_Record_ClearData__doc__},
+
+static PyObject *
+_msi_Record_ClearData_impl(msiobj *self);
+
+static PyObject *
+_msi_Record_ClearData(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_Record_ClearData_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Record_SetString__doc__,
+"SetString($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set field to a string value.");
+
+#define _MSI_RECORD_SETSTRING_METHODDEF \
+ {"SetString", (PyCFunction)(void(*)(void))_msi_Record_SetString, METH_FASTCALL, _msi_Record_SetString__doc__},
+
+static PyObject *
+_msi_Record_SetString_impl(msiobj *self, int field, const Py_UNICODE *value);
+
+static PyObject *
+_msi_Record_SetString(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int field;
+ const Py_UNICODE *value;
+
+ if (!_PyArg_CheckPositional("SetString", nargs, 2, 2)) {
+ goto exit;
+ }
+ field = _PyLong_AsInt(args[0]);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("SetString", "argument 2", "str", args[1]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ _Py_COMP_DIAG_PUSH
+ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
+ value = _PyUnicode_AsUnicode(args[1]);
+ _Py_COMP_DIAG_POP
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ value = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (value == NULL) {
+ goto exit;
+ }
+ return_value = _msi_Record_SetString_impl(self, field, value);
+
+exit:
+ /* Cleanup for value */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)value);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_SetStream__doc__,
+"SetStream($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set field to the contents of the file named value.");
+
+#define _MSI_RECORD_SETSTREAM_METHODDEF \
+ {"SetStream", (PyCFunction)(void(*)(void))_msi_Record_SetStream, METH_FASTCALL, _msi_Record_SetStream__doc__},
+
+static PyObject *
+_msi_Record_SetStream_impl(msiobj *self, int field, const Py_UNICODE *value);
+
+static PyObject *
+_msi_Record_SetStream(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int field;
+ const Py_UNICODE *value;
+
+ if (!_PyArg_CheckPositional("SetStream", nargs, 2, 2)) {
+ goto exit;
+ }
+ field = _PyLong_AsInt(args[0]);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("SetStream", "argument 2", "str", args[1]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ _Py_COMP_DIAG_PUSH
+ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
+ value = _PyUnicode_AsUnicode(args[1]);
+ _Py_COMP_DIAG_POP
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ value = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (value == NULL) {
+ goto exit;
+ }
+ return_value = _msi_Record_SetStream_impl(self, field, value);
+
+exit:
+ /* Cleanup for value */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)value);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_SetInteger__doc__,
+"SetInteger($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set field to an integer value.");
+
+#define _MSI_RECORD_SETINTEGER_METHODDEF \
+ {"SetInteger", (PyCFunction)(void(*)(void))_msi_Record_SetInteger, METH_FASTCALL, _msi_Record_SetInteger__doc__},
+
+static PyObject *
+_msi_Record_SetInteger_impl(msiobj *self, int field, int value);
+
+static PyObject *
+_msi_Record_SetInteger(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int field;
+ int value;
+
+ if (!_PyArg_CheckPositional("SetInteger", nargs, 2, 2)) {
+ goto exit;
+ }
+ field = _PyLong_AsInt(args[0]);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ value = _PyLong_AsInt(args[1]);
+ if (value == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_Record_SetInteger_impl(self, field, value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_GetProperty__doc__,
+"GetProperty($self, field, /)\n"
+"--\n"
+"\n"
+"Return a property of the summary.\n"
+"\n"
+" field\n"
+" the name of the property, one of the PID_* constants");
+
+#define _MSI_SUMMARYINFORMATION_GETPROPERTY_METHODDEF \
+ {"GetProperty", (PyCFunction)_msi_SummaryInformation_GetProperty, METH_O, _msi_SummaryInformation_GetProperty__doc__},
+
+static PyObject *
+_msi_SummaryInformation_GetProperty_impl(msiobj *self, int field);
+
+static PyObject *
+_msi_SummaryInformation_GetProperty(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int field;
+
+ field = _PyLong_AsInt(arg);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_SummaryInformation_GetProperty_impl(self, field);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_GetPropertyCount__doc__,
+"GetPropertyCount($self, /)\n"
+"--\n"
+"\n"
+"Return the number of summary properties.");
+
+#define _MSI_SUMMARYINFORMATION_GETPROPERTYCOUNT_METHODDEF \
+ {"GetPropertyCount", (PyCFunction)_msi_SummaryInformation_GetPropertyCount, METH_NOARGS, _msi_SummaryInformation_GetPropertyCount__doc__},
+
+static PyObject *
+_msi_SummaryInformation_GetPropertyCount_impl(msiobj *self);
+
+static PyObject *
+_msi_SummaryInformation_GetPropertyCount(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_SummaryInformation_GetPropertyCount_impl(self);
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_SetProperty__doc__,
+"SetProperty($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set a property.\n"
+"\n"
+" field\n"
+" the name of the property, one of the PID_* constants\n"
+" value\n"
+" the new value of the property (integer or string)");
+
+#define _MSI_SUMMARYINFORMATION_SETPROPERTY_METHODDEF \
+ {"SetProperty", (PyCFunction)(void(*)(void))_msi_SummaryInformation_SetProperty, METH_FASTCALL, _msi_SummaryInformation_SetProperty__doc__},
+
+static PyObject *
+_msi_SummaryInformation_SetProperty_impl(msiobj *self, int field,
+ PyObject *data);
+
+static PyObject *
+_msi_SummaryInformation_SetProperty(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int field;
+ PyObject *data;
+
+ if (!_PyArg_CheckPositional("SetProperty", nargs, 2, 2)) {
+ goto exit;
+ }
+ field = _PyLong_AsInt(args[0]);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ data = args[1];
+ return_value = _msi_SummaryInformation_SetProperty_impl(self, field, data);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_Persist__doc__,
+"Persist($self, /)\n"
+"--\n"
+"\n"
+"Write the modified properties to the summary information stream.");
+
+#define _MSI_SUMMARYINFORMATION_PERSIST_METHODDEF \
+ {"Persist", (PyCFunction)_msi_SummaryInformation_Persist, METH_NOARGS, _msi_SummaryInformation_Persist__doc__},
+
+static PyObject *
+_msi_SummaryInformation_Persist_impl(msiobj *self);
+
+static PyObject *
+_msi_SummaryInformation_Persist(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_SummaryInformation_Persist_impl(self);
+}
+
+PyDoc_STRVAR(_msi_View_Execute__doc__,
+"Execute($self, params, /)\n"
+"--\n"
+"\n"
+"Execute the SQL query of the view.\n"
+"\n"
+" params\n"
+" a record describing actual values of the parameter tokens\n"
+" in the query or None");
+
+#define _MSI_VIEW_EXECUTE_METHODDEF \
+ {"Execute", (PyCFunction)_msi_View_Execute, METH_O, _msi_View_Execute__doc__},
+
+PyDoc_STRVAR(_msi_View_Fetch__doc__,
+"Fetch($self, /)\n"
+"--\n"
+"\n"
+"Return a result record of the query.");
+
+#define _MSI_VIEW_FETCH_METHODDEF \
+ {"Fetch", (PyCFunction)_msi_View_Fetch, METH_NOARGS, _msi_View_Fetch__doc__},
+
+static PyObject *
+_msi_View_Fetch_impl(msiobj *self);
+
+static PyObject *
+_msi_View_Fetch(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_View_Fetch_impl(self);
+}
+
+PyDoc_STRVAR(_msi_View_GetColumnInfo__doc__,
+"GetColumnInfo($self, kind, /)\n"
+"--\n"
+"\n"
+"Return a record describing the columns of the view.\n"
+"\n"
+" kind\n"
+" MSICOLINFO_NAMES or MSICOLINFO_TYPES");
+
+#define _MSI_VIEW_GETCOLUMNINFO_METHODDEF \
+ {"GetColumnInfo", (PyCFunction)_msi_View_GetColumnInfo, METH_O, _msi_View_GetColumnInfo__doc__},
+
+static PyObject *
+_msi_View_GetColumnInfo_impl(msiobj *self, int kind);
+
+static PyObject *
+_msi_View_GetColumnInfo(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int kind;
+
+ kind = _PyLong_AsInt(arg);
+ if (kind == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_View_GetColumnInfo_impl(self, kind);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_View_Modify__doc__,
+"Modify($self, kind, data, /)\n"
+"--\n"
+"\n"
+"Modify the view.\n"
+"\n"
+" kind\n"
+" one of the MSIMODIFY_* constants\n"
+" data\n"
+" a record describing the new data");
+
+#define _MSI_VIEW_MODIFY_METHODDEF \
+ {"Modify", (PyCFunction)(void(*)(void))_msi_View_Modify, METH_FASTCALL, _msi_View_Modify__doc__},
+
+static PyObject *
+_msi_View_Modify_impl(msiobj *self, int kind, PyObject *data);
+
+static PyObject *
+_msi_View_Modify(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int kind;
+ PyObject *data;
+
+ if (!_PyArg_CheckPositional("Modify", nargs, 2, 2)) {
+ goto exit;
+ }
+ kind = _PyLong_AsInt(args[0]);
+ if (kind == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ data = args[1];
+ return_value = _msi_View_Modify_impl(self, kind, data);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_View_Close__doc__,
+"Close($self, /)\n"
+"--\n"
+"\n"
+"Close the view.");
+
+#define _MSI_VIEW_CLOSE_METHODDEF \
+ {"Close", (PyCFunction)_msi_View_Close, METH_NOARGS, _msi_View_Close__doc__},
+
+static PyObject *
+_msi_View_Close_impl(msiobj *self);
+
+static PyObject *
+_msi_View_Close(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_View_Close_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Database_OpenView__doc__,
+"OpenView($self, sql, /)\n"
+"--\n"
+"\n"
+"Return a view object.\n"
+"\n"
+" sql\n"
+" the SQL statement to execute");
+
+#define _MSI_DATABASE_OPENVIEW_METHODDEF \
+ {"OpenView", (PyCFunction)_msi_Database_OpenView, METH_O, _msi_Database_OpenView__doc__},
+
+static PyObject *
+_msi_Database_OpenView_impl(msiobj *self, const Py_UNICODE *sql);
+
+static PyObject *
+_msi_Database_OpenView(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const Py_UNICODE *sql;
+
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("OpenView", "argument", "str", arg);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ _Py_COMP_DIAG_PUSH
+ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
+ sql = _PyUnicode_AsUnicode(arg);
+ _Py_COMP_DIAG_POP
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ sql = PyUnicode_AsWideCharString(arg, NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (sql == NULL) {
+ goto exit;
+ }
+ return_value = _msi_Database_OpenView_impl(self, sql);
+
+exit:
+ /* Cleanup for sql */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sql);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Database_Commit__doc__,
+"Commit($self, /)\n"
+"--\n"
+"\n"
+"Commit the changes pending in the current transaction.");
+
+#define _MSI_DATABASE_COMMIT_METHODDEF \
+ {"Commit", (PyCFunction)_msi_Database_Commit, METH_NOARGS, _msi_Database_Commit__doc__},
+
+static PyObject *
+_msi_Database_Commit_impl(msiobj *self);
+
+static PyObject *
+_msi_Database_Commit(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_Database_Commit_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Database_GetSummaryInformation__doc__,
+"GetSummaryInformation($self, count, /)\n"
+"--\n"
+"\n"
+"Return a new summary information object.\n"
+"\n"
+" count\n"
+" the maximum number of updated values");
+
+#define _MSI_DATABASE_GETSUMMARYINFORMATION_METHODDEF \
+ {"GetSummaryInformation", (PyCFunction)_msi_Database_GetSummaryInformation, METH_O, _msi_Database_GetSummaryInformation__doc__},
+
+static PyObject *
+_msi_Database_GetSummaryInformation_impl(msiobj *self, int count);
+
+static PyObject *
+_msi_Database_GetSummaryInformation(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int count;
+
+ count = _PyLong_AsInt(arg);
+ if (count == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_Database_GetSummaryInformation_impl(self, count);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_OpenDatabase__doc__,
+"OpenDatabase($module, path, persist, /)\n"
+"--\n"
+"\n"
+"Return a new database object.\n"
+"\n"
+" path\n"
+" the file name of the MSI file\n"
+" persist\n"
+" the persistence mode");
+
+#define _MSI_OPENDATABASE_METHODDEF \
+ {"OpenDatabase", (PyCFunction)(void(*)(void))_msi_OpenDatabase, METH_FASTCALL, _msi_OpenDatabase__doc__},
+
+static PyObject *
+_msi_OpenDatabase_impl(PyObject *module, const Py_UNICODE *path, int persist);
+
+static PyObject *
+_msi_OpenDatabase(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ const Py_UNICODE *path;
+ int persist;
+
+ if (!_PyArg_CheckPositional("OpenDatabase", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("OpenDatabase", "argument 1", "str", args[0]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ _Py_COMP_DIAG_PUSH
+ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
+ path = _PyUnicode_AsUnicode(args[0]);
+ _Py_COMP_DIAG_POP
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ path = PyUnicode_AsWideCharString(args[0], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (path == NULL) {
+ goto exit;
+ }
+ persist = _PyLong_AsInt(args[1]);
+ if (persist == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_OpenDatabase_impl(module, path, persist);
+
+exit:
+ /* Cleanup for path */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)path);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_CreateRecord__doc__,
+"CreateRecord($module, count, /)\n"
+"--\n"
+"\n"
+"Return a new record object.\n"
+"\n"
+" count\n"
+" the number of fields of the record");
+
+#define _MSI_CREATERECORD_METHODDEF \
+ {"CreateRecord", (PyCFunction)_msi_CreateRecord, METH_O, _msi_CreateRecord__doc__},
+
+static PyObject *
+_msi_CreateRecord_impl(PyObject *module, int count);
+
+static PyObject *
+_msi_CreateRecord(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int count;
+
+ count = _PyLong_AsInt(arg);
+ if (count == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_CreateRecord_impl(module, count);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=39807788326ad0e9 input=a9049054013a1b77]*/