1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 PyDoc_STRVAR(_msi_UuidCreate__doc__,
6 "UuidCreate($module, /)\n"
7 "--\n"
8 "\n"
9 "Return the string representation of a new unique identifier.");
10
11 #define _MSI_UUIDCREATE_METHODDEF \
12 {"UuidCreate", (PyCFunction)_msi_UuidCreate, METH_NOARGS, _msi_UuidCreate__doc__},
13
14 static PyObject *
15 _msi_UuidCreate_impl(PyObject *module);
16
17 static PyObject *
_msi_UuidCreate(PyObject * module,PyObject * Py_UNUSED (ignored))18 _msi_UuidCreate(PyObject *module, PyObject *Py_UNUSED(ignored))
19 {
20 return _msi_UuidCreate_impl(module);
21 }
22
23 PyDoc_STRVAR(_msi_FCICreate__doc__,
24 "FCICreate($module, cabname, files, /)\n"
25 "--\n"
26 "\n"
27 "Create a new CAB file.\n"
28 "\n"
29 " cabname\n"
30 " the name of the CAB file\n"
31 " files\n"
32 " a list of tuples, each containing the name of the file on disk,\n"
33 " and the name of the file inside the CAB file");
34
35 #define _MSI_FCICREATE_METHODDEF \
36 {"FCICreate", (PyCFunction)(void(*)(void))_msi_FCICreate, METH_FASTCALL, _msi_FCICreate__doc__},
37
38 static PyObject *
39 _msi_FCICreate_impl(PyObject *module, const char *cabname, PyObject *files);
40
41 static PyObject *
_msi_FCICreate(PyObject * module,PyObject * const * args,Py_ssize_t nargs)42 _msi_FCICreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
43 {
44 PyObject *return_value = NULL;
45 const char *cabname;
46 PyObject *files;
47
48 if (!_PyArg_CheckPositional("FCICreate", nargs, 2, 2)) {
49 goto exit;
50 }
51 if (!PyUnicode_Check(args[0])) {
52 _PyArg_BadArgument("FCICreate", "argument 1", "str", args[0]);
53 goto exit;
54 }
55 Py_ssize_t cabname_length;
56 cabname = PyUnicode_AsUTF8AndSize(args[0], &cabname_length);
57 if (cabname == NULL) {
58 goto exit;
59 }
60 if (strlen(cabname) != (size_t)cabname_length) {
61 PyErr_SetString(PyExc_ValueError, "embedded null character");
62 goto exit;
63 }
64 files = args[1];
65 return_value = _msi_FCICreate_impl(module, cabname, files);
66
67 exit:
68 return return_value;
69 }
70
71 PyDoc_STRVAR(_msi_Database_Close__doc__,
72 "Close($self, /)\n"
73 "--\n"
74 "\n"
75 "Close the database object.");
76
77 #define _MSI_DATABASE_CLOSE_METHODDEF \
78 {"Close", (PyCFunction)_msi_Database_Close, METH_NOARGS, _msi_Database_Close__doc__},
79
80 static PyObject *
81 _msi_Database_Close_impl(msiobj *self);
82
83 static PyObject *
_msi_Database_Close(msiobj * self,PyObject * Py_UNUSED (ignored))84 _msi_Database_Close(msiobj *self, PyObject *Py_UNUSED(ignored))
85 {
86 return _msi_Database_Close_impl(self);
87 }
88
89 PyDoc_STRVAR(_msi_Record_GetFieldCount__doc__,
90 "GetFieldCount($self, /)\n"
91 "--\n"
92 "\n"
93 "Return the number of fields of the record.");
94
95 #define _MSI_RECORD_GETFIELDCOUNT_METHODDEF \
96 {"GetFieldCount", (PyCFunction)_msi_Record_GetFieldCount, METH_NOARGS, _msi_Record_GetFieldCount__doc__},
97
98 static PyObject *
99 _msi_Record_GetFieldCount_impl(msiobj *self);
100
101 static PyObject *
_msi_Record_GetFieldCount(msiobj * self,PyObject * Py_UNUSED (ignored))102 _msi_Record_GetFieldCount(msiobj *self, PyObject *Py_UNUSED(ignored))
103 {
104 return _msi_Record_GetFieldCount_impl(self);
105 }
106
107 PyDoc_STRVAR(_msi_Record_GetInteger__doc__,
108 "GetInteger($self, field, /)\n"
109 "--\n"
110 "\n"
111 "Return the value of field as an integer where possible.");
112
113 #define _MSI_RECORD_GETINTEGER_METHODDEF \
114 {"GetInteger", (PyCFunction)_msi_Record_GetInteger, METH_O, _msi_Record_GetInteger__doc__},
115
116 static PyObject *
117 _msi_Record_GetInteger_impl(msiobj *self, unsigned int field);
118
119 static PyObject *
_msi_Record_GetInteger(msiobj * self,PyObject * arg)120 _msi_Record_GetInteger(msiobj *self, PyObject *arg)
121 {
122 PyObject *return_value = NULL;
123 unsigned int field;
124
125 field = (unsigned int)PyLong_AsUnsignedLongMask(arg);
126 if (field == (unsigned int)-1 && PyErr_Occurred()) {
127 goto exit;
128 }
129 return_value = _msi_Record_GetInteger_impl(self, field);
130
131 exit:
132 return return_value;
133 }
134
135 PyDoc_STRVAR(_msi_Record_GetString__doc__,
136 "GetString($self, field, /)\n"
137 "--\n"
138 "\n"
139 "Return the value of field as a string where possible.");
140
141 #define _MSI_RECORD_GETSTRING_METHODDEF \
142 {"GetString", (PyCFunction)_msi_Record_GetString, METH_O, _msi_Record_GetString__doc__},
143
144 static PyObject *
145 _msi_Record_GetString_impl(msiobj *self, unsigned int field);
146
147 static PyObject *
_msi_Record_GetString(msiobj * self,PyObject * arg)148 _msi_Record_GetString(msiobj *self, PyObject *arg)
149 {
150 PyObject *return_value = NULL;
151 unsigned int field;
152
153 field = (unsigned int)PyLong_AsUnsignedLongMask(arg);
154 if (field == (unsigned int)-1 && PyErr_Occurred()) {
155 goto exit;
156 }
157 return_value = _msi_Record_GetString_impl(self, field);
158
159 exit:
160 return return_value;
161 }
162
163 PyDoc_STRVAR(_msi_Record_ClearData__doc__,
164 "ClearData($self, /)\n"
165 "--\n"
166 "\n"
167 "Set all fields of the record to 0.");
168
169 #define _MSI_RECORD_CLEARDATA_METHODDEF \
170 {"ClearData", (PyCFunction)_msi_Record_ClearData, METH_NOARGS, _msi_Record_ClearData__doc__},
171
172 static PyObject *
173 _msi_Record_ClearData_impl(msiobj *self);
174
175 static PyObject *
_msi_Record_ClearData(msiobj * self,PyObject * Py_UNUSED (ignored))176 _msi_Record_ClearData(msiobj *self, PyObject *Py_UNUSED(ignored))
177 {
178 return _msi_Record_ClearData_impl(self);
179 }
180
181 PyDoc_STRVAR(_msi_Record_SetString__doc__,
182 "SetString($self, field, value, /)\n"
183 "--\n"
184 "\n"
185 "Set field to a string value.");
186
187 #define _MSI_RECORD_SETSTRING_METHODDEF \
188 {"SetString", (PyCFunction)(void(*)(void))_msi_Record_SetString, METH_FASTCALL, _msi_Record_SetString__doc__},
189
190 static PyObject *
191 _msi_Record_SetString_impl(msiobj *self, int field, const Py_UNICODE *value);
192
193 static PyObject *
_msi_Record_SetString(msiobj * self,PyObject * const * args,Py_ssize_t nargs)194 _msi_Record_SetString(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
195 {
196 PyObject *return_value = NULL;
197 int field;
198 const Py_UNICODE *value;
199
200 if (!_PyArg_CheckPositional("SetString", nargs, 2, 2)) {
201 goto exit;
202 }
203 field = _PyLong_AsInt(args[0]);
204 if (field == -1 && PyErr_Occurred()) {
205 goto exit;
206 }
207 if (!PyUnicode_Check(args[1])) {
208 _PyArg_BadArgument("SetString", "argument 2", "str", args[1]);
209 goto exit;
210 }
211 #if USE_UNICODE_WCHAR_CACHE
212 value = _PyUnicode_AsUnicode(args[1]);
213 #else /* USE_UNICODE_WCHAR_CACHE */
214 value = PyUnicode_AsWideCharString(args[1], NULL);
215 #endif /* USE_UNICODE_WCHAR_CACHE */
216 if (value == NULL) {
217 goto exit;
218 }
219 return_value = _msi_Record_SetString_impl(self, field, value);
220
221 exit:
222 /* Cleanup for value */
223 #if !USE_UNICODE_WCHAR_CACHE
224 PyMem_Free((void *)value);
225 #endif /* USE_UNICODE_WCHAR_CACHE */
226
227 return return_value;
228 }
229
230 PyDoc_STRVAR(_msi_Record_SetStream__doc__,
231 "SetStream($self, field, value, /)\n"
232 "--\n"
233 "\n"
234 "Set field to the contents of the file named value.");
235
236 #define _MSI_RECORD_SETSTREAM_METHODDEF \
237 {"SetStream", (PyCFunction)(void(*)(void))_msi_Record_SetStream, METH_FASTCALL, _msi_Record_SetStream__doc__},
238
239 static PyObject *
240 _msi_Record_SetStream_impl(msiobj *self, int field, const Py_UNICODE *value);
241
242 static PyObject *
_msi_Record_SetStream(msiobj * self,PyObject * const * args,Py_ssize_t nargs)243 _msi_Record_SetStream(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
244 {
245 PyObject *return_value = NULL;
246 int field;
247 const Py_UNICODE *value;
248
249 if (!_PyArg_CheckPositional("SetStream", nargs, 2, 2)) {
250 goto exit;
251 }
252 field = _PyLong_AsInt(args[0]);
253 if (field == -1 && PyErr_Occurred()) {
254 goto exit;
255 }
256 if (!PyUnicode_Check(args[1])) {
257 _PyArg_BadArgument("SetStream", "argument 2", "str", args[1]);
258 goto exit;
259 }
260 #if USE_UNICODE_WCHAR_CACHE
261 value = _PyUnicode_AsUnicode(args[1]);
262 #else /* USE_UNICODE_WCHAR_CACHE */
263 value = PyUnicode_AsWideCharString(args[1], NULL);
264 #endif /* USE_UNICODE_WCHAR_CACHE */
265 if (value == NULL) {
266 goto exit;
267 }
268 return_value = _msi_Record_SetStream_impl(self, field, value);
269
270 exit:
271 /* Cleanup for value */
272 #if !USE_UNICODE_WCHAR_CACHE
273 PyMem_Free((void *)value);
274 #endif /* USE_UNICODE_WCHAR_CACHE */
275
276 return return_value;
277 }
278
279 PyDoc_STRVAR(_msi_Record_SetInteger__doc__,
280 "SetInteger($self, field, value, /)\n"
281 "--\n"
282 "\n"
283 "Set field to an integer value.");
284
285 #define _MSI_RECORD_SETINTEGER_METHODDEF \
286 {"SetInteger", (PyCFunction)(void(*)(void))_msi_Record_SetInteger, METH_FASTCALL, _msi_Record_SetInteger__doc__},
287
288 static PyObject *
289 _msi_Record_SetInteger_impl(msiobj *self, int field, int value);
290
291 static PyObject *
_msi_Record_SetInteger(msiobj * self,PyObject * const * args,Py_ssize_t nargs)292 _msi_Record_SetInteger(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
293 {
294 PyObject *return_value = NULL;
295 int field;
296 int value;
297
298 if (!_PyArg_CheckPositional("SetInteger", nargs, 2, 2)) {
299 goto exit;
300 }
301 field = _PyLong_AsInt(args[0]);
302 if (field == -1 && PyErr_Occurred()) {
303 goto exit;
304 }
305 value = _PyLong_AsInt(args[1]);
306 if (value == -1 && PyErr_Occurred()) {
307 goto exit;
308 }
309 return_value = _msi_Record_SetInteger_impl(self, field, value);
310
311 exit:
312 return return_value;
313 }
314
315 PyDoc_STRVAR(_msi_SummaryInformation_GetProperty__doc__,
316 "GetProperty($self, field, /)\n"
317 "--\n"
318 "\n"
319 "Return a property of the summary.\n"
320 "\n"
321 " field\n"
322 " the name of the property, one of the PID_* constants");
323
324 #define _MSI_SUMMARYINFORMATION_GETPROPERTY_METHODDEF \
325 {"GetProperty", (PyCFunction)_msi_SummaryInformation_GetProperty, METH_O, _msi_SummaryInformation_GetProperty__doc__},
326
327 static PyObject *
328 _msi_SummaryInformation_GetProperty_impl(msiobj *self, int field);
329
330 static PyObject *
_msi_SummaryInformation_GetProperty(msiobj * self,PyObject * arg)331 _msi_SummaryInformation_GetProperty(msiobj *self, PyObject *arg)
332 {
333 PyObject *return_value = NULL;
334 int field;
335
336 field = _PyLong_AsInt(arg);
337 if (field == -1 && PyErr_Occurred()) {
338 goto exit;
339 }
340 return_value = _msi_SummaryInformation_GetProperty_impl(self, field);
341
342 exit:
343 return return_value;
344 }
345
346 PyDoc_STRVAR(_msi_SummaryInformation_GetPropertyCount__doc__,
347 "GetPropertyCount($self, /)\n"
348 "--\n"
349 "\n"
350 "Return the number of summary properties.");
351
352 #define _MSI_SUMMARYINFORMATION_GETPROPERTYCOUNT_METHODDEF \
353 {"GetPropertyCount", (PyCFunction)_msi_SummaryInformation_GetPropertyCount, METH_NOARGS, _msi_SummaryInformation_GetPropertyCount__doc__},
354
355 static PyObject *
356 _msi_SummaryInformation_GetPropertyCount_impl(msiobj *self);
357
358 static PyObject *
_msi_SummaryInformation_GetPropertyCount(msiobj * self,PyObject * Py_UNUSED (ignored))359 _msi_SummaryInformation_GetPropertyCount(msiobj *self, PyObject *Py_UNUSED(ignored))
360 {
361 return _msi_SummaryInformation_GetPropertyCount_impl(self);
362 }
363
364 PyDoc_STRVAR(_msi_SummaryInformation_SetProperty__doc__,
365 "SetProperty($self, field, value, /)\n"
366 "--\n"
367 "\n"
368 "Set a property.\n"
369 "\n"
370 " field\n"
371 " the name of the property, one of the PID_* constants\n"
372 " value\n"
373 " the new value of the property (integer or string)");
374
375 #define _MSI_SUMMARYINFORMATION_SETPROPERTY_METHODDEF \
376 {"SetProperty", (PyCFunction)(void(*)(void))_msi_SummaryInformation_SetProperty, METH_FASTCALL, _msi_SummaryInformation_SetProperty__doc__},
377
378 static PyObject *
379 _msi_SummaryInformation_SetProperty_impl(msiobj *self, int field,
380 PyObject *data);
381
382 static PyObject *
_msi_SummaryInformation_SetProperty(msiobj * self,PyObject * const * args,Py_ssize_t nargs)383 _msi_SummaryInformation_SetProperty(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
384 {
385 PyObject *return_value = NULL;
386 int field;
387 PyObject *data;
388
389 if (!_PyArg_CheckPositional("SetProperty", nargs, 2, 2)) {
390 goto exit;
391 }
392 field = _PyLong_AsInt(args[0]);
393 if (field == -1 && PyErr_Occurred()) {
394 goto exit;
395 }
396 data = args[1];
397 return_value = _msi_SummaryInformation_SetProperty_impl(self, field, data);
398
399 exit:
400 return return_value;
401 }
402
403 PyDoc_STRVAR(_msi_SummaryInformation_Persist__doc__,
404 "Persist($self, /)\n"
405 "--\n"
406 "\n"
407 "Write the modified properties to the summary information stream.");
408
409 #define _MSI_SUMMARYINFORMATION_PERSIST_METHODDEF \
410 {"Persist", (PyCFunction)_msi_SummaryInformation_Persist, METH_NOARGS, _msi_SummaryInformation_Persist__doc__},
411
412 static PyObject *
413 _msi_SummaryInformation_Persist_impl(msiobj *self);
414
415 static PyObject *
_msi_SummaryInformation_Persist(msiobj * self,PyObject * Py_UNUSED (ignored))416 _msi_SummaryInformation_Persist(msiobj *self, PyObject *Py_UNUSED(ignored))
417 {
418 return _msi_SummaryInformation_Persist_impl(self);
419 }
420
421 PyDoc_STRVAR(_msi_View_Execute__doc__,
422 "Execute($self, params, /)\n"
423 "--\n"
424 "\n"
425 "Execute the SQL query of the view.\n"
426 "\n"
427 " params\n"
428 " a record describing actual values of the parameter tokens\n"
429 " in the query or None");
430
431 #define _MSI_VIEW_EXECUTE_METHODDEF \
432 {"Execute", (PyCFunction)_msi_View_Execute, METH_O, _msi_View_Execute__doc__},
433
434 PyDoc_STRVAR(_msi_View_Fetch__doc__,
435 "Fetch($self, /)\n"
436 "--\n"
437 "\n"
438 "Return a result record of the query.");
439
440 #define _MSI_VIEW_FETCH_METHODDEF \
441 {"Fetch", (PyCFunction)_msi_View_Fetch, METH_NOARGS, _msi_View_Fetch__doc__},
442
443 static PyObject *
444 _msi_View_Fetch_impl(msiobj *self);
445
446 static PyObject *
_msi_View_Fetch(msiobj * self,PyObject * Py_UNUSED (ignored))447 _msi_View_Fetch(msiobj *self, PyObject *Py_UNUSED(ignored))
448 {
449 return _msi_View_Fetch_impl(self);
450 }
451
452 PyDoc_STRVAR(_msi_View_GetColumnInfo__doc__,
453 "GetColumnInfo($self, kind, /)\n"
454 "--\n"
455 "\n"
456 "Return a record describing the columns of the view.\n"
457 "\n"
458 " kind\n"
459 " MSICOLINFO_NAMES or MSICOLINFO_TYPES");
460
461 #define _MSI_VIEW_GETCOLUMNINFO_METHODDEF \
462 {"GetColumnInfo", (PyCFunction)_msi_View_GetColumnInfo, METH_O, _msi_View_GetColumnInfo__doc__},
463
464 static PyObject *
465 _msi_View_GetColumnInfo_impl(msiobj *self, int kind);
466
467 static PyObject *
_msi_View_GetColumnInfo(msiobj * self,PyObject * arg)468 _msi_View_GetColumnInfo(msiobj *self, PyObject *arg)
469 {
470 PyObject *return_value = NULL;
471 int kind;
472
473 kind = _PyLong_AsInt(arg);
474 if (kind == -1 && PyErr_Occurred()) {
475 goto exit;
476 }
477 return_value = _msi_View_GetColumnInfo_impl(self, kind);
478
479 exit:
480 return return_value;
481 }
482
483 PyDoc_STRVAR(_msi_View_Modify__doc__,
484 "Modify($self, kind, data, /)\n"
485 "--\n"
486 "\n"
487 "Modify the view.\n"
488 "\n"
489 " kind\n"
490 " one of the MSIMODIFY_* constants\n"
491 " data\n"
492 " a record describing the new data");
493
494 #define _MSI_VIEW_MODIFY_METHODDEF \
495 {"Modify", (PyCFunction)(void(*)(void))_msi_View_Modify, METH_FASTCALL, _msi_View_Modify__doc__},
496
497 static PyObject *
498 _msi_View_Modify_impl(msiobj *self, int kind, PyObject *data);
499
500 static PyObject *
_msi_View_Modify(msiobj * self,PyObject * const * args,Py_ssize_t nargs)501 _msi_View_Modify(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
502 {
503 PyObject *return_value = NULL;
504 int kind;
505 PyObject *data;
506
507 if (!_PyArg_CheckPositional("Modify", nargs, 2, 2)) {
508 goto exit;
509 }
510 kind = _PyLong_AsInt(args[0]);
511 if (kind == -1 && PyErr_Occurred()) {
512 goto exit;
513 }
514 data = args[1];
515 return_value = _msi_View_Modify_impl(self, kind, data);
516
517 exit:
518 return return_value;
519 }
520
521 PyDoc_STRVAR(_msi_View_Close__doc__,
522 "Close($self, /)\n"
523 "--\n"
524 "\n"
525 "Close the view.");
526
527 #define _MSI_VIEW_CLOSE_METHODDEF \
528 {"Close", (PyCFunction)_msi_View_Close, METH_NOARGS, _msi_View_Close__doc__},
529
530 static PyObject *
531 _msi_View_Close_impl(msiobj *self);
532
533 static PyObject *
_msi_View_Close(msiobj * self,PyObject * Py_UNUSED (ignored))534 _msi_View_Close(msiobj *self, PyObject *Py_UNUSED(ignored))
535 {
536 return _msi_View_Close_impl(self);
537 }
538
539 PyDoc_STRVAR(_msi_Database_OpenView__doc__,
540 "OpenView($self, sql, /)\n"
541 "--\n"
542 "\n"
543 "Return a view object.\n"
544 "\n"
545 " sql\n"
546 " the SQL statement to execute");
547
548 #define _MSI_DATABASE_OPENVIEW_METHODDEF \
549 {"OpenView", (PyCFunction)_msi_Database_OpenView, METH_O, _msi_Database_OpenView__doc__},
550
551 static PyObject *
552 _msi_Database_OpenView_impl(msiobj *self, const Py_UNICODE *sql);
553
554 static PyObject *
_msi_Database_OpenView(msiobj * self,PyObject * arg)555 _msi_Database_OpenView(msiobj *self, PyObject *arg)
556 {
557 PyObject *return_value = NULL;
558 const Py_UNICODE *sql;
559
560 if (!PyUnicode_Check(arg)) {
561 _PyArg_BadArgument("OpenView", "argument", "str", arg);
562 goto exit;
563 }
564 #if USE_UNICODE_WCHAR_CACHE
565 sql = _PyUnicode_AsUnicode(arg);
566 #else /* USE_UNICODE_WCHAR_CACHE */
567 sql = PyUnicode_AsWideCharString(arg, NULL);
568 #endif /* USE_UNICODE_WCHAR_CACHE */
569 if (sql == NULL) {
570 goto exit;
571 }
572 return_value = _msi_Database_OpenView_impl(self, sql);
573
574 exit:
575 /* Cleanup for sql */
576 #if !USE_UNICODE_WCHAR_CACHE
577 PyMem_Free((void *)sql);
578 #endif /* USE_UNICODE_WCHAR_CACHE */
579
580 return return_value;
581 }
582
583 PyDoc_STRVAR(_msi_Database_Commit__doc__,
584 "Commit($self, /)\n"
585 "--\n"
586 "\n"
587 "Commit the changes pending in the current transaction.");
588
589 #define _MSI_DATABASE_COMMIT_METHODDEF \
590 {"Commit", (PyCFunction)_msi_Database_Commit, METH_NOARGS, _msi_Database_Commit__doc__},
591
592 static PyObject *
593 _msi_Database_Commit_impl(msiobj *self);
594
595 static PyObject *
_msi_Database_Commit(msiobj * self,PyObject * Py_UNUSED (ignored))596 _msi_Database_Commit(msiobj *self, PyObject *Py_UNUSED(ignored))
597 {
598 return _msi_Database_Commit_impl(self);
599 }
600
601 PyDoc_STRVAR(_msi_Database_GetSummaryInformation__doc__,
602 "GetSummaryInformation($self, count, /)\n"
603 "--\n"
604 "\n"
605 "Return a new summary information object.\n"
606 "\n"
607 " count\n"
608 " the maximum number of updated values");
609
610 #define _MSI_DATABASE_GETSUMMARYINFORMATION_METHODDEF \
611 {"GetSummaryInformation", (PyCFunction)_msi_Database_GetSummaryInformation, METH_O, _msi_Database_GetSummaryInformation__doc__},
612
613 static PyObject *
614 _msi_Database_GetSummaryInformation_impl(msiobj *self, int count);
615
616 static PyObject *
_msi_Database_GetSummaryInformation(msiobj * self,PyObject * arg)617 _msi_Database_GetSummaryInformation(msiobj *self, PyObject *arg)
618 {
619 PyObject *return_value = NULL;
620 int count;
621
622 count = _PyLong_AsInt(arg);
623 if (count == -1 && PyErr_Occurred()) {
624 goto exit;
625 }
626 return_value = _msi_Database_GetSummaryInformation_impl(self, count);
627
628 exit:
629 return return_value;
630 }
631
632 PyDoc_STRVAR(_msi_OpenDatabase__doc__,
633 "OpenDatabase($module, path, persist, /)\n"
634 "--\n"
635 "\n"
636 "Return a new database object.\n"
637 "\n"
638 " path\n"
639 " the file name of the MSI file\n"
640 " persist\n"
641 " the persistence mode");
642
643 #define _MSI_OPENDATABASE_METHODDEF \
644 {"OpenDatabase", (PyCFunction)(void(*)(void))_msi_OpenDatabase, METH_FASTCALL, _msi_OpenDatabase__doc__},
645
646 static PyObject *
647 _msi_OpenDatabase_impl(PyObject *module, const Py_UNICODE *path, int persist);
648
649 static PyObject *
_msi_OpenDatabase(PyObject * module,PyObject * const * args,Py_ssize_t nargs)650 _msi_OpenDatabase(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
651 {
652 PyObject *return_value = NULL;
653 const Py_UNICODE *path;
654 int persist;
655
656 if (!_PyArg_CheckPositional("OpenDatabase", nargs, 2, 2)) {
657 goto exit;
658 }
659 if (!PyUnicode_Check(args[0])) {
660 _PyArg_BadArgument("OpenDatabase", "argument 1", "str", args[0]);
661 goto exit;
662 }
663 #if USE_UNICODE_WCHAR_CACHE
664 path = _PyUnicode_AsUnicode(args[0]);
665 #else /* USE_UNICODE_WCHAR_CACHE */
666 path = PyUnicode_AsWideCharString(args[0], NULL);
667 #endif /* USE_UNICODE_WCHAR_CACHE */
668 if (path == NULL) {
669 goto exit;
670 }
671 persist = _PyLong_AsInt(args[1]);
672 if (persist == -1 && PyErr_Occurred()) {
673 goto exit;
674 }
675 return_value = _msi_OpenDatabase_impl(module, path, persist);
676
677 exit:
678 /* Cleanup for path */
679 #if !USE_UNICODE_WCHAR_CACHE
680 PyMem_Free((void *)path);
681 #endif /* USE_UNICODE_WCHAR_CACHE */
682
683 return return_value;
684 }
685
686 PyDoc_STRVAR(_msi_CreateRecord__doc__,
687 "CreateRecord($module, count, /)\n"
688 "--\n"
689 "\n"
690 "Return a new record object.\n"
691 "\n"
692 " count\n"
693 " the number of fields of the record");
694
695 #define _MSI_CREATERECORD_METHODDEF \
696 {"CreateRecord", (PyCFunction)_msi_CreateRecord, METH_O, _msi_CreateRecord__doc__},
697
698 static PyObject *
699 _msi_CreateRecord_impl(PyObject *module, int count);
700
701 static PyObject *
_msi_CreateRecord(PyObject * module,PyObject * arg)702 _msi_CreateRecord(PyObject *module, PyObject *arg)
703 {
704 PyObject *return_value = NULL;
705 int count;
706
707 count = _PyLong_AsInt(arg);
708 if (count == -1 && PyErr_Occurred()) {
709 goto exit;
710 }
711 return_value = _msi_CreateRecord_impl(module, count);
712
713 exit:
714 return return_value;
715 }
716 /*[clinic end generated code: output=49debf733ee5cab2 input=a9049054013a1b77]*/
717