_msi.c.h 18 KB

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