theSq3Lite 10.0
Loading...
Searching...
No Matches
Sq3LiteC_py.c
Go to the documentation of this file.
1
9/* LABEL-START */
10
11#define META_FILE_NAME "Sq3LiteC_py.c"
12
14
15// PY class
16#define OT_CLASS (&NS(Sq3LiteCR))
17#define OT_CLASS_NAME "Sq3LiteC"
18
19#define OT_LNG2META(O) Sq3Lite(VAL2MNG(O))
20
21#define OT_retObj_CONSTR(mng) OT_retObj_SET(NS(Sq3LiteC_CTOR)(MK_RT_CALL (PyTypeObject*)class,mng))
22
23#define OT_SETUP_hdl OT_SETUP_hdl_tmpl(Sq3LiteC)
24#define OT_SETUP_hdl__null_allow OT_SETUP_hdl_tmpl__null_allow(Sq3LiteC)
25#define OT_SETUP_hdl_constr MK_RT_UNUSED AllRtSetup_NULL; \
26 SQ3_LITE hdl = (SQ3_LITE) OT_CLASS;
27#define OT_SETUP_hdl_destr OT_SETUP_hdl_tmpl__null_allow(Sq3LiteC)
28#define OT_SETUP_hdl_static MK_RT_UNUSED AllRtSetup_NULL; \
29 __attribute__((unused)) MK_TYP hdl = Sq3LiteC##_TT;
30
31#define OT_SETUP_hdl_static_constr OT_SETUP_hdl_static
32
33#if !defined(SetupRtFromObj_X)
34 #define SetupRtFromObj_X(hdl) AllRtSetup_X(hdl)
35 #define SetupRtFromObj_XN(hdl) AllRtSetup_XN(hdl)
36#endif
37
38// MO class
39#undef Sq3LiteCTT
40#define Sq3LiteCTT SQ3(Sq3LiteThreadState).Sq3LiteCTT
41/* Sq3LiteC_MK_NULL defined in LibSq3Lite_py.h */
42
43__attribute__((unused)) mk_inline
44OT_OBJ_T NS(Sq3LiteC_CTOR) (MK_RT_ARGS OT_CLS_T type, SQ3_LITE hdl) {
45 return MK(AtomCreate)(MK_RT_CALL type,Sq3LiteC_X2obj(hdl));
46}
47
48// helper: mk_dbg_color_ln(MK_COLOR_YELLOW,"hdl<%p>, self<%p>", obj, self);
49
50// META: ObjNew feature: selfCreate will be called from "ObjNew->MkSelfNew" if MkObj need a SELF pointer
51static MK_PTR NS(Sq3LiteC_selfCreate) (MK_RT_ARGS MK_OBJ const obj, MK_PTR const env) {
52 return MK(AtomCreate) (MK_RT_CALL OT_CLASS,obj);
53}
54// META: called if MkObj must be destroyed and if the SELF is still alive → goal: destroy the SELF
55static void NS(Sq3LiteC_selfDelete) (MK_RT_ARGS MK_PTR self, MK_PTR const env) {
56 MK(AtomDeleteHard) (MK_RT_CALL OT_SELF);
57}
58// META: called to destroy link from SELF to META
59static void NS(Sq3LiteC_selfUnlink) (MK_RT_ARGS MK_PTR self, MK_PTR const env) {
60 MkObjectC_Obj *selfO = (MkObjectC_Obj*) self;
61 selfO->hdl = NULL;
62}
63
64// initialize the PY and MO class specific object
65#define ClassInit \
66 /* if not already done, initialize NEW META type */ \
67 if (Sq3LiteCTT == NULL) Sq3LiteCTT = Sq3LiteSTT; \
68 \
69 /* protect against double call */ \
70 if (Sq3LiteCTT->selfCreate == NS(Sq3LiteC_selfCreate)) return MK_OK; \
71 \
72 /* add "selfCreate" and "selfDelete" feature to the META-Class */ \
73 Sq3LiteCTT->selfCreate = NS(Sq3LiteC_selfCreate); \
74 Sq3LiteCTT->selfDelete = NS(Sq3LiteC_selfDelete); \
75 Sq3LiteCTT->selfUnlink = NS(Sq3LiteC_selfUnlink); \
76 \
77 if (!PyType_HasFeature(OT_CLASS,Py_TPFLAGS_READY)) { \
78 NS(Sq3LiteCR).tp_base = Sq3LiteC_base; \
79 OtErrorCheckLng (PyType_Ready(OT_CLASS)); \
80 } \
81 OtErrorCheckLng(PyModule_AddObjectRef(m, "Sq3LiteC", (PyObject *)OT_CLASS)); \
82 \
83 /* define the "NULL" object */ \
84 Sq3LiteC_MK_NULL = Py_NewRef(MK(AtomCreate) (MK_RT_CALL OT_CLASS, NULL /*obj*/));
85
86/* LABEL-END */
87
88#define META_CONTEXT_S MK_ERROR_DEFAULT
89
90// MARK_D
96
97// BEGIN-DOC - created by 'py_MqS.tcl -i NHI1_HOME/theSq3Lite/c/gen/c_sq3lite.meta' - DO NOT change
98
99// doc-key: Sq3LiteC,Sq3Lite,sCo,func
100#define OpenV2_doc "Sq3LiteC Sq3LiteC.OpenV2(filename:string, ?flags:Sq3OpenEF=SQ3_OPEN_READWRITE|SQ3_OPEN_CREATE?, ?zVfs:string=\"None\"?)"
101#define new_doc "Sq3LiteC Sq3LiteC.new(filename:string, ?flags:Sq3OpenEF=SQ3_OPEN_READWRITE|SQ3_OPEN_CREATE?, ?zVfs:string=\"None\"?)"
102
103// doc-key: Sq3LiteC,Sq3Lite,sc_,func
104#define GetNull_doc "Sq3LiteC Sq3LiteC.GetNull()"
105#define HandleResolve_doc "Sq3LiteC Sq3LiteC.HandleResolve(netHdl:MK_HDL)"
106#define Instances_doc "Sq3LiteC Sq3LiteC.Instances()"
107
108// doc-key: Sq3LiteC,Sq3Lite,sm_,func
109#define ErrStr_doc "string Sq3LiteC.ErrStr(arg0:int32)"
110#define Sleep_doc "Sq3LiteC.Sleep(arg0:int32)"
111
112// doc-key: Sq3LiteC,Sq3Lite,oc_,func
113#define Next_doc "Sq3LiteC lite.Next()"
114#define Prev_doc "Sq3LiteC lite.Prev()"
115
116// doc-key: Sq3LiteC,Sq3Lite,oco,func
117#define DbStatusBFL_doc "MkBufferListC sq3lite.DbStatusBFL(op:Sq3DbStatusE, resetFlg:bool)"
118#define PrepareV2_doc "Sq3StmtC db.PrepareV2(zSql:string)"
119
120// doc-key: Sq3LiteC,Sq3Lite,om_,func
121#define BusyTimeout_doc "sq3lite.BusyTimeout(ms:int32)"
122#define Changes_doc "int32 sq3lite.Changes()"
123#define Changes64_doc "int64 sq3lite.Changes64()"
124#define CloseV2_doc "sq3lite.CloseV2()"
125#define DbCacheflush_doc "sq3lite.DbCacheflush()"
126#define DbFilename_doc "string db.DbFilename(zDbName:string)"
127#define DbName_doc "string db.DbName(N:int32)"
128#define DbReadonly_doc "db.DbReadonly(zDbName:string)"
129#define DbReleaseMemory_doc "sq3lite.DbReleaseMemory()"
130#define DeclareVtab_doc "sq3lite.DeclareVtab(zSQL:string)"
131#define Deserialize_doc "sq3lite.Deserialize(zSchema:string, pData:binary, mFlags:Sq3DeSerializeEF)"
132#define DropModules_doc "sq3lite.DropModules(azKeepBfl:MkBufferListC)"
133#define ErrCode_doc "Sq3ErrorE db.ErrCode()"
134#define ErrMsg_doc "string sq3lite.ErrMsg()"
135#define ErrorOffset_doc "db.ErrorOffset()"
136#define Exec_doc "sq3lite.Exec(sql:string, ?callback_data:callable=None?)"
137#define ExecV2_doc "sq3lite.ExecV2(sql:string, ?callback:callable=None?)"
138#define ExtendedResultCodes_doc "sq3lite.ExtendedResultCodes(onoff:int32)"
139#define ExtendetErrCode_doc "Sq3ExtendetResultCodesE db.ExtendetErrCode()"
140#define GetAutocommit_doc "int32 sq3lite.GetAutocommit()"
141// skip class-overload: HandleGet → MkObjectHandleGet
142#define Interrupt_doc "sq3lite.Interrupt()"
143#define IsInterrupted_doc "bool sq3lite.IsInterrupted()"
144#define LastInsertRowid_doc "int64 sq3lite.LastInsertRowid()"
145#define Limit_doc "sq3lite.Limit(id:Sq3LimitE, newVal:int32)"
146// skip class-overload: Log → MkObjectLog
147#define OverloadFunction_doc "sq3lite.OverloadFunction(zFuncName:string, nArg:int32)"
148#define Serialize_doc "binary sq3lite.Serialize(zSchema:string, mFlags:Sq3SerializeE)"
149#define SetLastInsertRowid_doc "sq3lite.SetLastInsertRowid(arg1:int64)"
150#define SystemErrno_doc "sq3lite.SystemErrno()"
151#define TotalChanges_doc "int32 sq3lite.TotalChanges()"
152#define TotalChanges64_doc "int64 sq3lite.TotalChanges64()"
153#define TxnState_doc "sq3lite.TxnState(zSchema:string)"
154#define VtabOnConflict_doc "sq3lite.VtabOnConflict()"
155#define WalAutocheckpoint_doc "db.WalAutocheckpoint(N:int32)"
156
157// doc-key: Sq3LiteC,Sq3Lite,omo,func
158#define DbStatus_doc "{pCur:int32 pHiwtr:int32} sq3lite.DbStatus(op:Sq3DbStatusE, resetFlg:bool)"
159#define TableColumnMetadata_doc "{pzDataType:string pzCollSeq:string pNotNull:int32 pPrimaryKey:int32 pAutoinc:int32} db.TableColumnMetadata(zDbName:string, zTableName:string, zColumnName:string)"
160#define WalCheckpointV2_doc "{pnLog:int32 pnCkpt:int32} db.WalCheckpointV2(zDb:string, eMode:int32)"
161
162// END-DOC - created by 'py_MqS.tcl -i NHI1_HOME/theSq3Lite/c/gen/c_sq3lite.meta' - DO NOT change
163
164// MARK_M
170
171// BEGIN-Sq3LiteC - created by 'py_MqC.tcl -i NHI1_HOME/theSq3Lite/c/gen/c_sq3lite.meta' - DO NOT change
172
176
177// doc-key: Sq3LiteC,Sq3LiteC-Class-Export,sc_
178
180static OT_ProcRet NS(Sq3LiteC_HandleResolve) (OtClass_ARGS) {
183 MK_HDL netHdl = 0;
186 SQ3_LITE retVal = Sq3LiteHandleResolve (netHdl);
187 OT_retObj_SET_LITE(retVal);
188 goto end;
189 error:
191 end:
193}
194
195// doc-key: Sq3LiteC,Sq3LiteC-Class-Export,om_
196
197// skip on class-overload: Sq3LiteHandleGet → MkObjectHandleGet
199static OT_ProcRet NS(Sq3LiteC_HandleGet) (Sq3LiteC_ARGS) {OT_ERROR_LNG_RETURN;}
200
202// Sq3LiteC_Class_PY_API
203
207
208// doc-key: Sq3LiteC,Sq3LiteC-Class-Introspection,oc_
209
211static OT_ProcRet NS(Sq3LiteC_Next) (Sq3LiteC_ARGS) {
215 SQ3_LITE retVal = Sq3LiteNext (hdl);
216 OT_retObj_SET_LITE(retVal);
217 goto end;
218 error:
220 end:
222}
223
225static OT_ProcRet NS(Sq3LiteC_Prev) (Sq3LiteC_ARGS) {
229 SQ3_LITE retVal = Sq3LitePrev (hdl);
230 OT_retObj_SET_LITE(retVal);
231 goto end;
232 error:
234 end:
236}
237
238// doc-key: Sq3LiteC,Sq3LiteC-Class-Introspection,sc_
239
241static OT_ProcRet NS(Sq3LiteC_Instances) (OtClass_ARGS) {
245 SQ3_LITE retVal = Sq3LiteInstances ();
246 OT_retObj_SET_LITE(retVal);
247 goto end;
248 error:
250 end:
252}
253
255// Sq3LiteC_Class_PY_API
256
260
261// doc-key: Sq3LiteC,Sq3LiteC-Class-Misc,sc_
262
264static OT_ProcRet NS(Sq3LiteC_GetNull) (OtClass_ARGS) {
268 SQ3_LITE retVal = Sq3LiteGetNull ();
269 OT_retObj_SET_LITE(retVal);
270 goto end;
271 error:
273 end:
275}
276
278// Sq3LiteC_Class_PY_API
279
283
284// doc-key: Sq3LiteC,Sq3LiteC-Config,om_
285
287static OT_ProcRet NS(Sq3LiteC_BusyTimeout) (Sq3LiteC_ARGS) {
290 MK_I32 ms = 0;
293 MkErrorC_Check(hdl,Sq3LiteBusyTimeout (hdl, ms));
295 goto end;
296 error:
298 end:
300}
301
303static OT_ProcRet NS(Sq3LiteC_DeclareVtab) (Sq3LiteC_ARGS) {
306 MK_STRN zSQL = 0;
309 MkErrorC_Check(hdl,Sq3LiteDeclareVtab (hdl, zSQL));
311 goto end;
312 error:
314 end:
316}
317
319static OT_ProcRet NS(Sq3LiteC_ExtendedResultCodes) (Sq3LiteC_ARGS) {
322 MK_I32 onoff = 0;
327 goto end;
328 error:
330 end:
332}
333
335static OT_ProcRet NS(Sq3LiteC_Limit) (Sq3LiteC_ARGS) {
338 enum Sq3LimitE id = 0;
340 MK_I32 newVal = 0;
343 MkErrorC_Check(hdl,Sq3LiteLimit (hdl, id, newVal));
345 goto end;
346 error:
348 end:
350}
351
353// Sq3LiteC_Config_PY_API
354
358
359// doc-key: Sq3LiteC,Sq3LiteC-Error,om_
360
362static OT_ProcRet NS(Sq3LiteC_ErrCode) (Sq3LiteC_ARGS) {
367 goto end;
368 error:
370 end:
372}
373
375static OT_ProcRet NS(Sq3LiteC_ErrMsg) (Sq3LiteC_ARGS) {
380 goto end;
381 error:
383 end:
385}
386
388static OT_ProcRet NS(Sq3LiteC_ErrorOffset) (Sq3LiteC_ARGS) {
394 goto end;
395 error:
397 end:
399}
400
402static OT_ProcRet NS(Sq3LiteC_ExtendetErrCode) (Sq3LiteC_ARGS) {
406 OT_retObj_SET(OT_NEW_Sq3_enum_OBJ(ExtendetResultCodesE,Sq3LiteExtendetErrCode (hdl)));
407 goto end;
408 error:
410 end:
412}
413
415static OT_ProcRet NS(Sq3LiteC_SystemErrno) (Sq3LiteC_ARGS) {
421 goto end;
422 error:
424 end:
426}
427
428// doc-key: Sq3LiteC,Sq3LiteC-Error,sm_
429
431static OT_ProcRet NS(Sq3LiteC_ErrStr) (OtClass_ARGS) {
434 MK_I32 arg0 = 0;
438 goto end;
439 error:
441 end:
443}
444
446// Sq3LiteC_Error_PY_API
447
451
452// doc-key: Sq3LiteC,Sq3LiteC-Execution,om_
453
455static OT_ProcRet NS(Sq3LiteC_Exec) (Sq3LiteC_ARGS) {
458 MK_STRN sql = 0;
460 OT_SETUP_CALLABLE_ONCE(callback_data)
463 Sq3Fupu_Sq3LiteExec_callback_call callback_call = (callback_data == NULL ? NULL : NS(LiteExecCall));
464 MkErrorC_Check(hdl,Sq3LiteExec (hdl, sql, callback_call, callback_data));
466 goto end;
467 error:
469 end:
470 OT_CLEANUP_CALLABLE_ONCE(callback_data)
472}
473
475static OT_ProcRet NS(Sq3LiteC_ExecV2) (Sq3LiteC_ARGS) {
478 MK_STRN sql = 0;
480 OT_SETUP_CALLABLE_ONCE(callback)
483 Sq3LiteExecV2CB callback_call = (callback == NULL ? NULL : NS(LiteExecV2Call));
484 MkErrorC_Check(hdl,Sq3LiteExecV2 (hdl, sql, callback_call, callback));
486 goto end;
487 error:
489 end:
492}
493
494// doc-key: Sq3LiteC,Sq3LiteC-Execution,sm_
495
497static OT_ProcRet NS(Sq3LiteC_Sleep) (OtClass_ARGS) {
500 MK_I32 arg0 = 0;
505 goto end;
506 error:
508 end:
510}
511
513// Sq3LiteC_Execution_PY_API
514
518
519// doc-key: Sq3LiteC,Sq3LiteC-Info,om_
520
522static OT_ProcRet NS(Sq3LiteC_GetAutocommit) (Sq3LiteC_ARGS) {
527 goto end;
528 error:
530 end:
532}
533
535static OT_ProcRet NS(Sq3LiteC_LastInsertRowid) (Sq3LiteC_ARGS) {
540 goto end;
541 error:
543 end:
545}
546
548static OT_ProcRet NS(Sq3LiteC_TxnState) (Sq3LiteC_ARGS) {
551 MK_STRN zSchema = 0;
554 MkErrorC_Check(hdl,Sq3LiteTxnState (hdl, zSchema));
556 goto end;
557 error:
559 end:
561}
562
564static OT_ProcRet NS(Sq3LiteC_VtabOnConflict) (Sq3LiteC_ARGS) {
570 goto end;
571 error:
573 end:
575}
576
578// Sq3LiteC_Info_PY_API
579
583
584// doc-key: Sq3LiteC,Sq3LiteC-Misc,oco
585
587static OT_ProcRet NS(Sq3LiteC_DbStatusBFL) (Sq3LiteC_ARGS) {
590 enum Sq3DbStatusE op = 0;
592 MK_BOOL resetFlg = 0;
595 MK_BFL val_out;
596 MkErrorC_Check(hdl,Sq3LiteDbStatusBFL (hdl, op, &val_out, resetFlg));
597 OT_retObj_SET_BFL(val_out);
598 goto end;
599 error:
601 end:
603}
604
605// doc-key: Sq3LiteC,Sq3LiteC-Misc,om_
606
608static OT_ProcRet NS(Sq3LiteC_DbCacheflush) (Sq3LiteC_ARGS) {
614 goto end;
615 error:
617 end:
619}
620
622static OT_ProcRet NS(Sq3LiteC_DbFilename) (Sq3LiteC_ARGS) {
625 MK_STRN zDbName = 0;
628 OT_retObj_SET_STR(Sq3LiteDbFilename (hdl, zDbName));
629 goto end;
630 error:
632 end:
634}
635
637static OT_ProcRet NS(Sq3LiteC_DbName) (Sq3LiteC_ARGS) {
640 MK_I32 N = 0;
644 goto end;
645 error:
647 end:
649}
650
652static OT_ProcRet NS(Sq3LiteC_DbReadonly) (Sq3LiteC_ARGS) {
655 MK_STRN zDbName = 0;
658 MkErrorC_Check(hdl,Sq3LiteDbReadonly (hdl, zDbName));
660 goto end;
661 error:
663 end:
665}
666
668static OT_ProcRet NS(Sq3LiteC_DbReleaseMemory) (Sq3LiteC_ARGS) {
674 goto end;
675 error:
677 end:
679}
680
682static OT_ProcRet NS(Sq3LiteC_Deserialize) (Sq3LiteC_ARGS) {
685 MK_STRN zSchema = 0;
687 MkBinaryR pData = {0};
689 enum Sq3DeSerializeEF mFlags = 0;
692 MkErrorC_Check(hdl,Sq3LiteDeserialize (hdl, zSchema, pData, mFlags));
694 goto end;
695 error:
697 end:
699}
700
702static OT_ProcRet NS(Sq3LiteC_DropModules) (Sq3LiteC_ARGS) {
705 MkBufferListCreateTLS_T(azKeepBfl,10);
708 MkErrorC_Check(hdl,Sq3LiteDropModules (hdl, azKeepBfl));
710 goto end;
711 error:
713 end:
715}
716
717// skip on class-overload: Sq3LiteLog → MkObjectLog
720
722static OT_ProcRet NS(Sq3LiteC_OverloadFunction) (Sq3LiteC_ARGS) {
725 MK_STRN zFuncName = 0;
727 MK_I32 nArg = 0;
730 MkErrorC_Check(hdl,Sq3LiteOverloadFunction (hdl, zFuncName, nArg));
732 goto end;
733 error:
735 end:
737}
738
740static OT_ProcRet NS(Sq3LiteC_Serialize) (Sq3LiteC_ARGS) {
743 MK_STRN zSchema = 0;
745 enum Sq3SerializeE mFlags = 0;
748 MkBinaryR retVal = Sq3LiteSerialize (hdl, zSchema, mFlags);
750 goto end;
751 error:
753 end:
755}
756
757// doc-key: Sq3LiteC,Sq3LiteC-Misc,omo
758
760static OT_ProcRet NS(Sq3LiteC_DbStatus) (Sq3LiteC_ARGS) {
763 enum Sq3DbStatusE op = 0;
765 MK_BOOL resetFlg = 0;
768 MK_I32 pCur;
769 MK_I32 pHiwtr;
770 MkErrorC_Check(hdl,Sq3LiteDbStatus (hdl, op, &pCur, &pHiwtr, resetFlg));
774 goto end;
775 error:
777 end:
779}
780
782static OT_ProcRet NS(Sq3LiteC_TableColumnMetadata) (Sq3LiteC_ARGS) {
785 MK_STRN zDbName = 0;
787 MK_STRN zTableName = 0;
788 OT_CHECK_REQUIRED(OT_CHECK_STRN (zTableName))
789 MK_STRN zColumnName = 0;
790 OT_CHECK_REQUIRED(OT_CHECK_STRN (zColumnName))
792 MK_STRN pzDataType;
793 MK_STRN pzCollSeq;
794 MK_I32 pNotNull;
795 MK_I32 pPrimaryKey;
796 MK_I32 pAutoinc;
797 MkErrorC_Check(hdl,Sq3LiteTableColumnMetadata (hdl, zDbName, zTableName, zColumnName, &pzDataType, &pzCollSeq, &pNotNull, &pPrimaryKey, &pAutoinc));
799 OT_retObj_APPEND(OT_TMP_STR_OBJ(pzDataType));
802 OT_retObj_APPEND(OT_TMP_I32_OBJ(pPrimaryKey));
804 goto end;
805 error:
807 end:
809}
810
812// Sq3LiteC_Misc_PY_API
813
817
818// doc-key: Sq3LiteC,Sq3LiteC-Modify-Wal,om_
819
821static OT_ProcRet NS(Sq3LiteC_WalAutocheckpoint) (Sq3LiteC_ARGS) {
824 MK_I32 N = 0;
829 goto end;
830 error:
832 end:
834}
835
836// doc-key: Sq3LiteC,Sq3LiteC-Modify-Wal,omo
837
839static OT_ProcRet NS(Sq3LiteC_WalCheckpointV2) (Sq3LiteC_ARGS) {
842 MK_STRN zDb = 0;
844 MK_I32 eMode = 0;
847 MK_I32 pnLog;
848 MK_I32 pnCkpt;
849 MkErrorC_Check(hdl,Sq3LiteWalCheckpointV2 (hdl, zDb, eMode, &pnLog, &pnCkpt));
853 goto end;
854 error:
856 end:
858}
859
861// Sq3LiteC_Modify_Wal_PY_API
862
866
867// doc-key: Sq3LiteC,Sq3LiteC-Query,om_
868
870static OT_ProcRet NS(Sq3LiteC_Interrupt) (Sq3LiteC_ARGS) {
874 Sq3LiteInterrupt (hdl);
876 goto end;
877 error:
879 end:
881}
882
884static OT_ProcRet NS(Sq3LiteC_IsInterrupted) (Sq3LiteC_ARGS) {
889 goto end;
890 error:
892 end:
894}
895
897// Sq3LiteC_Query_PY_API
898
902
903// doc-key: Sq3LiteC,Sq3LiteC-Row,om_
904
906static OT_ProcRet NS(Sq3LiteC_Changes) (Sq3LiteC_ARGS) {
911 goto end;
912 error:
914 end:
916}
917
919static OT_ProcRet NS(Sq3LiteC_Changes64) (Sq3LiteC_ARGS) {
924 goto end;
925 error:
927 end:
929}
930
932static OT_ProcRet NS(Sq3LiteC_SetLastInsertRowid) (Sq3LiteC_ARGS) {
935 MK_I64 arg1 = 0;
938 Sq3LiteSetLastInsertRowid (hdl, arg1);
940 goto end;
941 error:
943 end:
945}
946
948static OT_ProcRet NS(Sq3LiteC_TotalChanges) (Sq3LiteC_ARGS) {
953 goto end;
954 error:
956 end:
958}
959
961static OT_ProcRet NS(Sq3LiteC_TotalChanges64) (Sq3LiteC_ARGS) {
966 goto end;
967 error:
969 end:
971}
972
974// Sq3LiteC_Row_PY_API
975
979
980// doc-key: Sq3LiteC,Sq3LiteC-TOR,sCo
981
983static OT_ProcRet NS(Sq3LiteC_OpenV2) (OtClass_ARGS) {
986 MK_STRN filename = 0;
990 MK_STRN zVfs = NULL;
993 SQ3_LITE ppDb;
994 MkErrorC_Check(MK_ERROR_FORMAT,Sq3LiteOpenV2 (filename, &ppDb, flags, zVfs));
996 OT_retObj_SET_LITE(ppDb);
997 goto end;
998 error:
1000 end:
1002}
1003
1005static OT_ProcRet NS(Sq3LiteC_new) (CONSTR_ARGS) {
1008 MK_STRN filename = 0;
1012 MK_STRN zVfs = NULL;
1014 SQ3_LITE ppDb;
1015 MkErrorC_Check(MK_ERROR_FORMAT,Sq3LiteOpenV2 (filename, &ppDb, flags, zVfs));
1017 OT_retObj_CONSTR(ppDb);
1018 goto end;
1019 error:
1021 end:
1023}
1024
1025// doc-key: Sq3LiteC,Sq3LiteC-TOR,oco
1026
1028static OT_ProcRet NS(Sq3LiteC_PrepareV2) (Sq3LiteC_ARGS) {
1031 MkStringR zSql = {0};
1034 SQ3_STMT ppStmt;
1035 MkErrorC_Check(hdl,Sq3LitePrepareV2 (hdl, zSql, &ppStmt));
1036 OT_retObj_SET_STMT(ppStmt);
1037 goto end;
1038 error:
1040 end:
1042}
1043
1044// doc-key: Sq3LiteC,Sq3LiteC-TOR,om_
1045
1047static OT_ProcRet NS(Sq3LiteC_CloseV2) (Sq3LiteC_ARGS) {
1051 MkErrorC_Check(hdl,Sq3LiteCloseV2 (hdl));
1053 goto end;
1054 error:
1056 end:
1058}
1059
1061// Sq3LiteC_TOR_PY_API
1062
1063// END-Sq3LiteC - created by 'py_MqC.tcl -i NHI1_HOME/theSq3Lite/c/gen/c_sq3lite.meta' - DO NOT change
1064
1065// MARK_T
1071
1072static PyMethodDef Sq3LiteC_Methods[] = {
1073
1074 // BEGIN-CLASS - created by 'py_MqS.tcl -i NHI1_HOME/theSq3Lite/c/gen/c_sq3lite.meta' - DO NOT change
1075
1076 // doc-key: Sq3LiteC,Sq3Lite,sCo
1077 { "OpenV2" , (PyCFunction) NS(Sq3LiteC_OpenV2) , METH_VARARGS|METH_CLASS , OpenV2_doc },
1078
1079 // doc-key: Sq3LiteC,Sq3Lite,sc_
1080 { "GetNull" , (PyCFunction) NS(Sq3LiteC_GetNull) , METH_NOARGS|METH_CLASS , GetNull_doc },
1081 { "HandleResolve" , (PyCFunction) NS(Sq3LiteC_HandleResolve) , METH_O|METH_CLASS , HandleResolve_doc },
1082 { "Instances" , (PyCFunction) NS(Sq3LiteC_Instances) , METH_NOARGS|METH_CLASS , Instances_doc },
1083
1084 // doc-key: Sq3LiteC,Sq3Lite,sm_
1085 { "ErrStr" , (PyCFunction) NS(Sq3LiteC_ErrStr) , METH_O|METH_CLASS , ErrStr_doc },
1086 { "Sleep" , (PyCFunction) NS(Sq3LiteC_Sleep) , METH_O|METH_CLASS , Sleep_doc },
1087
1088 // END-CLASS - created by 'py_MqS.tcl -i NHI1_HOME/theSq3Lite/c/gen/c_sq3lite.meta' - DO NOT change
1089
1090 // BEGIN-OBJ - created by 'py_MqS.tcl -i NHI1_HOME/theSq3Lite/c/gen/c_sq3lite.meta' - DO NOT change
1091
1092 // doc-key: Sq3LiteC,Sq3Lite,oc_
1093 { "Next" , (PyCFunction) NS(Sq3LiteC_Next) , METH_NOARGS , Next_doc },
1094 { "Prev" , (PyCFunction) NS(Sq3LiteC_Prev) , METH_NOARGS , Prev_doc },
1095
1096 // doc-key: Sq3LiteC,Sq3Lite,oco
1097 { "DbStatusBFL" , (PyCFunction) NS(Sq3LiteC_DbStatusBFL) , METH_VARARGS , DbStatusBFL_doc },
1098 { "PrepareV2" , (PyCFunction) NS(Sq3LiteC_PrepareV2) , METH_O , PrepareV2_doc },
1099
1100 // doc-key: Sq3LiteC,Sq3Lite,om_
1101 { "BusyTimeout" , (PyCFunction) NS(Sq3LiteC_BusyTimeout) , METH_O , BusyTimeout_doc },
1102 { "Changes" , (PyCFunction) NS(Sq3LiteC_Changes) , METH_NOARGS , Changes_doc },
1103 { "Changes64" , (PyCFunction) NS(Sq3LiteC_Changes64) , METH_NOARGS , Changes64_doc },
1104 { "CloseV2" , (PyCFunction) NS(Sq3LiteC_CloseV2) , METH_NOARGS , CloseV2_doc },
1105 { "DbCacheflush" , (PyCFunction) NS(Sq3LiteC_DbCacheflush) , METH_NOARGS , DbCacheflush_doc },
1106 { "DbFilename" , (PyCFunction) NS(Sq3LiteC_DbFilename) , METH_O , DbFilename_doc },
1107 { "DbName" , (PyCFunction) NS(Sq3LiteC_DbName) , METH_O , DbName_doc },
1108 { "DbReadonly" , (PyCFunction) NS(Sq3LiteC_DbReadonly) , METH_O , DbReadonly_doc },
1109 { "DbReleaseMemory" , (PyCFunction) NS(Sq3LiteC_DbReleaseMemory) , METH_NOARGS , DbReleaseMemory_doc },
1110 { "DeclareVtab" , (PyCFunction) NS(Sq3LiteC_DeclareVtab) , METH_O , DeclareVtab_doc },
1111 { "Deserialize" , (PyCFunction) NS(Sq3LiteC_Deserialize) , METH_VARARGS , Deserialize_doc },
1112 { "DropModules" , (PyCFunction) NS(Sq3LiteC_DropModules) , METH_O , DropModules_doc },
1113 { "ErrCode" , (PyCFunction) NS(Sq3LiteC_ErrCode) , METH_NOARGS , ErrCode_doc },
1114 { "ErrMsg" , (PyCFunction) NS(Sq3LiteC_ErrMsg) , METH_NOARGS , ErrMsg_doc },
1115 { "ErrorOffset" , (PyCFunction) NS(Sq3LiteC_ErrorOffset) , METH_NOARGS , ErrorOffset_doc },
1116 { "Exec" , (PyCFunction) NS(Sq3LiteC_Exec) , METH_VARARGS , Exec_doc },
1117 { "ExecV2" , (PyCFunction) NS(Sq3LiteC_ExecV2) , METH_VARARGS , ExecV2_doc },
1118 { "ExtendedResultCodes" , (PyCFunction) NS(Sq3LiteC_ExtendedResultCodes) , METH_O , ExtendedResultCodes_doc },
1119 { "ExtendetErrCode" , (PyCFunction) NS(Sq3LiteC_ExtendetErrCode) , METH_NOARGS , ExtendetErrCode_doc },
1120 { "GetAutocommit" , (PyCFunction) NS(Sq3LiteC_GetAutocommit) , METH_NOARGS , GetAutocommit_doc },
1121 // skip class-overload: Sq3LiteHandleGet → HandleGet, NS(Sq3LiteC_HandleGet)
1122 { "Interrupt" , (PyCFunction) NS(Sq3LiteC_Interrupt) , METH_NOARGS , Interrupt_doc },
1123 { "IsInterrupted" , (PyCFunction) NS(Sq3LiteC_IsInterrupted) , METH_NOARGS , IsInterrupted_doc },
1124 { "LastInsertRowid" , (PyCFunction) NS(Sq3LiteC_LastInsertRowid) , METH_NOARGS , LastInsertRowid_doc },
1125 { "Limit" , (PyCFunction) NS(Sq3LiteC_Limit) , METH_VARARGS , Limit_doc },
1126 // skip class-overload: Sq3LiteLog → Log, NS(Sq3LiteC_Log)
1127 { "OverloadFunction" , (PyCFunction) NS(Sq3LiteC_OverloadFunction) , METH_VARARGS , OverloadFunction_doc },
1128 { "Serialize" , (PyCFunction) NS(Sq3LiteC_Serialize) , METH_VARARGS , Serialize_doc },
1129 { "SetLastInsertRowid" , (PyCFunction) NS(Sq3LiteC_SetLastInsertRowid) , METH_O , SetLastInsertRowid_doc },
1130 { "SystemErrno" , (PyCFunction) NS(Sq3LiteC_SystemErrno) , METH_NOARGS , SystemErrno_doc },
1131 { "TotalChanges" , (PyCFunction) NS(Sq3LiteC_TotalChanges) , METH_NOARGS , TotalChanges_doc },
1132 { "TotalChanges64" , (PyCFunction) NS(Sq3LiteC_TotalChanges64) , METH_NOARGS , TotalChanges64_doc },
1133 { "TxnState" , (PyCFunction) NS(Sq3LiteC_TxnState) , METH_O , TxnState_doc },
1134 { "VtabOnConflict" , (PyCFunction) NS(Sq3LiteC_VtabOnConflict) , METH_NOARGS , VtabOnConflict_doc },
1135 { "WalAutocheckpoint" , (PyCFunction) NS(Sq3LiteC_WalAutocheckpoint) , METH_O , WalAutocheckpoint_doc },
1136
1137 // doc-key: Sq3LiteC,Sq3Lite,omo
1138 { "DbStatus" , (PyCFunction) NS(Sq3LiteC_DbStatus) , METH_VARARGS , DbStatus_doc },
1139 { "TableColumnMetadata" , (PyCFunction) NS(Sq3LiteC_TableColumnMetadata) , METH_VARARGS , TableColumnMetadata_doc },
1140 { "WalCheckpointV2" , (PyCFunction) NS(Sq3LiteC_WalCheckpointV2) , METH_VARARGS , WalCheckpointV2_doc },
1141
1142 // END-OBJ - created by 'py_MqS.tcl -i NHI1_HOME/theSq3Lite/c/gen/c_sq3lite.meta' - DO NOT change
1143
1144 {NULL, NULL, 0, NULL} /* Sentinel */
1145};
1146
1152
1154 PyVarObject_HEAD_INIT(NULL, 0)
1155 .tp_name = "pymsgque.Sq3LiteC",
1156 .tp_doc = "PyMsgque Sq3LiteC Type",
1157 .tp_basicsize = sizeof(Sq3LiteC_Obj),
1158 .tp_itemsize = 0,
1159 .tp_new = (newfunc) NS(Sq3LiteC_new),
1160 .tp_flags = Py_TPFLAGS_DEFAULT,
1161 .tp_methods = Sq3LiteC_Methods,
1162 .tp_base = NULL
1163};
1164
1165int NS(pSq3LiteC_Init) ( MK_RT_ARGS PyObject* m)
1166{
1167 ClassInit
1168
1169 return 0;
1170error:
1171 return -1;
1172}
1173
1174// vim: nowrap
#define OT_CHECK_bool(val)
#define OT_SELF
#define MK(n)
#define OT_SETUP_VARARGS(min, max, d)
#define OT_retObj_SET_BOL(nat)
#define OT_SETUP_NOARG(d)
#define OT_SETUP_ONEARG(d)
#define OT_ERROR_LNG_RETURN
#define OT_CHECK_NI4(val)
#define OT_CHECK_NI8(val)
#define OT_retObj_SET_Error
#define OT_CONSTRUCTOR_POST(x)
#define OT_retObj_SET_I64(nat)
#define OT_retObj_SET_List
#define OT_CHECK_REQUIRED(val)
#define OT_retObj_SET_None
#define OT_retObj_SET_I32(nat)
PyTypeObject * OT_CLS_T
#define OT_retObj_SET_BFL(nat)
#define OT_TMP_I32_OBJ(val)
#define OT_GET__ME_REF_MkBinaryR(b)
#define OT_SETUP_CONSTRUCTOR_ARGS(...)
#define OT_retObj_RETURN
#define OT_retObj_APPEND(var)
PyObject * OT_OBJ_T
#define OT_CHECK__ME_REF_MkStringR(val)
#define OT_CHECK__ME_REF_MkBinaryR(val)
#define OT_retObj_SET_STR(nat)
#define OT_CLASS_TYPE_REF
#define OT_CHECK_OPTIONAL(val)
#define OT_TMP_STR_OBJ(val)
#define OT_retObj_SET(val)
#define OT_CHECK_NOARGS
#define MkErrorC_Check(mng, PROC)
#define OT_ProcRet
#define CONSTR_ARGS
#define OtClass_ARGS
#define OT_CHECK_STRN(val)
tag: nhi1-release-250425
struct Sq3LiteC_Obj Sq3LiteC_Obj
#define OT_NEW_Sq3_enum_OBJ(typ, val)
#define OT_retObj_SET_LITE(nat)
#define NS(n)
#define OT_retObj_SET_STMT(nat)
#define Sq3LiteC_ARGS
#define Instances_doc
#define TxnState_doc
#define BusyTimeout_doc
#define Deserialize_doc
#define DbStatusBFL_doc
#define OT_SETUP_hdl_static_constr
Definition Sq3LiteC_py.c:31
#define Interrupt_doc
#define ExtendedResultCodes_doc
#define DbReleaseMemory_doc
#define DropModules_doc
#define SystemErrno_doc
#define OT_SETUP_hdl
Definition Sq3LiteC_py.c:23
#define WalAutocheckpoint_doc
#define OT_retObj_CONSTR(mng)
Definition Sq3LiteC_py.c:21
#define CloseV2_doc
#define ExtendetErrCode_doc
#define Exec_doc
static PyMethodDef Sq3LiteC_Methods[]
#define OverloadFunction_doc
#define SetLastInsertRowid_doc
#define TotalChanges_doc
#define OT_SETUP_hdl_destr
Definition Sq3LiteC_py.c:27
#define ErrCode_doc
#define OpenV2_doc
#define ErrStr_doc
#define LastInsertRowid_doc
#define GetNull_doc
#define Next_doc
#define ErrMsg_doc
#define TotalChanges64_doc
#define HandleResolve_doc
#define Prev_doc
#define DbStatus_doc
#define DeclareVtab_doc
#define DbFilename_doc
#define Changes64_doc
#define DbName_doc
#define OT_CLASS
Definition Sq3LiteC_py.c:16
#define OT_SETUP_hdl_static
Definition Sq3LiteC_py.c:28
#define OT_SETUP_hdl_constr
Definition Sq3LiteC_py.c:25
#define PrepareV2_doc
#define Changes_doc
#define Sleep_doc
#define new_doc
#define Limit_doc
#define Serialize_doc
#define TableColumnMetadata_doc
#define WalCheckpointV2_doc
#define GetAutocommit_doc
#define ErrorOffset_doc
#define ExecV2_doc
#define DbCacheflush_doc
#define IsInterrupted_doc
#define ClassInit
Definition Sq3LiteC_py.c:65
#define DbReadonly_doc
#define VtabOnConflict_doc
#define MkBufferListCreateTLS_T(name, num)
#define MK_ERROR_FORMAT
#define mk_inline
#define MK_NULL_NO
#define MK_UNUSED
#define MK_DEPRECATED
MK_PTRB * MK_PTR
const MK_STRB * MK_STRN
signed long long MK_I64
bool MK_BOOL
int32_t MK_HDL
signed int MK_I32
#define MK_RT_CALL
#define MK_RT_ARGS
static SQ3_LITE Sq3LiteNext(SQ3_LITE const lite)
get next instance from linked-list of Sq3LiteS type
#define Sq3LiteInstances()
static SQ3_LITE Sq3LiteGetNull(void)
Null-Slot - return a Sq3LiteC typed NULL instance …
static SQ3_LITE Sq3LitePrev(SQ3_LITE const lite)
get previous instance from linked-list of Sq3LiteS type
#define Sq3LiteHandleResolve(...)
#define Sq3LiteC_X2obj(x)
static enum MkErrorE Sq3LiteBusyTimeout(SQ3_LITE sq3lite, MK_I32 ms)
Set A Busy Timeout …
static enum MkErrorE Sq3LiteLimit(SQ3_LITE sq3lite, enum Sq3LimitE id, MK_I32 newVal)
Run-time Limits …
static enum MkErrorE Sq3LiteDeclareVtab(SQ3_LITE sq3lite, MK_STRN zSQL)
Declare The Schema Of A Virtual Table …
static enum MkErrorE Sq3LiteExtendedResultCodes(SQ3_LITE sq3lite, MK_I32 onoff)
Enable Or Disable Extended Result Codes …
static enum MkErrorE Sq3LiteErrorOffset(SQ3_LITE db)
Error Codes And Messages …
static enum MkErrorE Sq3LiteSystemErrno(SQ3_LITE sq3lite)
Low-level system error code …
static enum Sq3ErrorE Sq3LiteErrCode(SQ3_LITE db)
Error Codes And Messages …
static MK_STRN Sq3LiteErrMsg(SQ3_LITE sq3lite)
Error Codes And Messages …
static MK_STRN Sq3LiteErrStr(MK_I32 arg0)
Error Codes And Messages …
static enum Sq3ExtendetResultCodesE Sq3LiteExtendetErrCode(SQ3_LITE db)
Error Codes And Messages …
static enum MkErrorE Sq3LiteSleep(MK_I32 arg0)
Suspend Execution For A Short Time …
static enum MkErrorE Sq3LiteExec(SQ3_LITE sq3lite, MK_STRN sql, Sq3Fupu_Sq3LiteExec_callback_call callback_call, MK_CBP callback_data)
One-Step Query Execution Interface …
#define Sq3LiteExecV2(...)
Sq3Fupu_Sq3LiteExec_callback_call_ret(* Sq3Fupu_Sq3LiteExec_callback_call)(Sq3Fupu_Sq3LiteExec_callback_call_args)
enum MkErrorE(* Sq3LiteExecV2CB)(MK_RT mkrt, MK_CBP callV2, MK_BFL vals, MK_BFL cols)
callback for Sq3LiteExecV2
static enum MkErrorE Sq3LiteTxnState(SQ3_LITE sq3lite, MK_STRN zSchema)
Determine the transaction state of a database …
static MK_I32 Sq3LiteGetAutocommit(SQ3_LITE sq3lite)
Test For Auto-Commit Mode …
static enum MkErrorE Sq3LiteVtabOnConflict(SQ3_LITE sq3lite)
Determine The Virtual Table Conflict Policy …
static MK_I64 Sq3LiteLastInsertRowid(SQ3_LITE sq3lite)
Last Insert Rowid …
static enum MkErrorE Sq3LiteDbCacheflush(SQ3_LITE sq3lite)
Flush caches to disk mid-transaction …
static enum MkErrorE Sq3LiteTableColumnMetadata(SQ3_LITE db, MK_STRN zDbName, MK_STRN zTableName, MK_STRN zColumnName, MK_STRN *pzDataType, MK_STRN *pzCollSeq, MK_I32 *pNotNull, MK_I32 *pPrimaryKey, MK_I32 *pAutoinc)
Extract Metadata About A Column Of A Table …
static enum MkErrorE Sq3LiteDbReleaseMemory(SQ3_LITE sq3lite)
Free Memory Used By A Database Connection …
static MK_STRN Sq3LiteDbName(SQ3_LITE db, MK_I32 N)
Return The Schema Name For A Database Connection …
#define Sq3LiteDbStatusBFL(...)
#define Sq3LiteDropModules(...)
static enum MkErrorE Sq3LiteDbStatus(SQ3_LITE sq3lite, enum Sq3DbStatusE op, MK_I32 *pCur, MK_I32 *pHiwtr, MK_BOOL resetFlg)
Database Connection Status …
static MkBinaryR Sq3LiteSerialize(SQ3_LITE sq3lite, MK_STRN zSchema, enum Sq3SerializeE mFlags)
Serialize a database …
static SQ3_FILENAME Sq3LiteDbFilename(SQ3_LITE db, MK_STRN zDbName)
Return The Filename For A Database Connection …
static enum MkErrorE Sq3LiteOverloadFunction(SQ3_LITE sq3lite, MK_STRN zFuncName, MK_I32 nArg)
Overload A Function For A Virtual Table …
#define Sq3LiteDeserialize(...)
static enum MkErrorE Sq3LiteDbReadonly(SQ3_LITE db, MK_STRN zDbName)
Determine if a database is read-only …
static enum MkErrorE Sq3LiteWalAutocheckpoint(SQ3_LITE db, MK_I32 N)
Configure an auto-checkpoint …
static enum MkErrorE Sq3LiteWalCheckpointV2(SQ3_LITE db, MK_STRN zDb, MK_I32 eMode, MK_I32 *pnLog, MK_I32 *pnCkpt)
Checkpoint a database …
static void Sq3LiteInterrupt(SQ3_LITE sq3lite)
Interrupt A Long-Running Query …
static MK_BOOL Sq3LiteIsInterrupted(SQ3_LITE sq3lite)
Interrupt A Long-Running Query …
static MK_I64 Sq3LiteChanges64(SQ3_LITE sq3lite)
Count The Number Of Rows Modified …
static MK_I64 Sq3LiteTotalChanges64(SQ3_LITE sq3lite)
Total Number Of Rows Modified …
static MK_I32 Sq3LiteChanges(SQ3_LITE sq3lite)
Count The Number Of Rows Modified …
static MK_I32 Sq3LiteTotalChanges(SQ3_LITE sq3lite)
Total Number Of Rows Modified …
static void Sq3LiteSetLastInsertRowid(SQ3_LITE sq3lite, MK_I64 arg1)
Set the Last Insert Rowid value …
static enum MkErrorE Sq3LiteCloseV2(SQ3_LITE sq3lite)
Closing A Database Connection …
static enum MkErrorE Sq3LiteOpenV2(MK_STRN filename, SQ3_LITE *ppDb, enum Sq3OpenEF flags, MK_STRN zVfs)
Opening A New Database Connection …
Sq3OpenEF
Flags For File Open Operations.
Sq3LimitE
Run-Time Limit Categories.
Sq3SerializeE
Flags for sqlite3_serialize.
Sq3DeSerializeEF
Flags for sqlite3_deserialize()
Sq3DbStatusE
Status Parameters for database connections.
Definition Sq3Enum_sq3.h:79
@ SQ3_OPEN_CREATE
@ SQ3_OPEN_READWRITE
static enum MkErrorE Sq3LitePrepareV2(SQ3_LITE db, MkStringR zSql, SQ3_STMT *ppStmt)
Compiling An SQL Statement …
#define OT_CHECK_NIH(val)
#define OT_CHECK_CALLABLE(val)
#define OT_CHECK_ENUM(ename, val)
#define OT_SETUP_CALLABLE_ONCE(val)
#define OT_CLEANUP_CALLABLE_ONCE(val)
#define OT_CHECK_BFL(val, nullB)
PyObject_HEAD MK_OBJ hdl
Struct to represent the data of the Sq3LiteC …
Struct to represent the data of the Sq3StmtC …