theSq3Lite 10.0
Loading...
Searching...
No Matches
Sq3Call.cs
Go to the documentation of this file.
1
9/* LABEL-NO */
10
11/*****************************************************************************/
12/* */
13/* misc */
14/* */
15/*****************************************************************************/
16
17using System;
18using System.Runtime.InteropServices;
19using csmkkernel;
20
21namespace cssq3lite {
22
23 public interface Sq3LiteExecIF {
24 void Sq3LiteExec( string[] vals, string[] cols );
25 }
26
27 public interface Sq3LiteExecV2IF {
29 }
30
31 public partial class Sq3LiteC
32 {
33
35 public delegate void Sq3LiteExecCCB ( string[] vals, string[] cols );
36 public delegate void Sq3LiteExecV2CCB ( MkBufferListC vals, MkBufferListC cols );
37
38 internal struct Sq3Call {
39 public IntPtr mkrt ;
40 public Sq3LiteExecCCB call1 ;
41 public Sq3LiteExecV2CCB call2 ;
42 public Sq3LiteExecIF if1 ;
43 public Sq3LiteExecV2IF if2 ;
44
45 public Sq3Call(IntPtr rt, Sq3LiteExecCCB val) {
46 mkrt = rt;
47 call1 = val;
48 call2 = null;
49 if1 = null;
50 if2 = null;
51 }
52
53 public Sq3Call(IntPtr rt, Sq3LiteExecV2CCB val) {
54 mkrt = rt;
55 call2 = val;
56 call1 = null;
57 if1 = null;
58 if2 = null;
59 }
60
61 public Sq3Call(IntPtr rt, Sq3LiteExecIF val) {
62 mkrt = rt;
63 if1 = val;
64 call1 = null;
65 call2 = null;
66 if2 = null;
67 }
68
69 public Sq3Call(IntPtr rt, Sq3LiteExecV2IF val) {
70 mkrt = rt;
71 if2 = val;
72 call1 = null;
73 call2 = null;
74 if1 = null;
75 }
76 }
77
78 private static Int32 Sq3LiteExecCall (IntPtr callV1, Int32 num, IntPtr vals, IntPtr cols)
79 {
80 Sq3Call data = (Sq3Call)GCHandle.FromIntPtr(callV1).Target;
81
82//printBool(MqS.MqObjCheck(hdl),"check:hdl");
83
84 var valsO = new String[num];
85 var colsO = new String[num];
86
87 IntPtr[] valsP = new IntPtr[num];
88 Marshal.Copy(vals,valsP,0,num);
89 IntPtr[] colsP = new IntPtr[num];
90 Marshal.Copy(cols,colsP,0,num);
91
92 for (int i=0; i<num; i++) {
93 valsO[i] = Marshal.PtrToStringAnsi(valsP[i]);
94 colsO[i] = Marshal.PtrToStringAnsi(colsP[i]);
95 }
96
97 // call the function
98 try {
99 if (data.call1 != null) {
100 data.call1(valsO,colsO);
101 } else if (data.if1 != null) {
102 data.if1.Sq3LiteExec(valsO,colsO);
103 } else {
104 return 0;
105 }
106 } catch (Exception ex) {
107 IntPtr cstr = Marshal.StringToHGlobalAnsi("Sq3LiteExecCall");
108 MkExceptionC.Catch(data.mkrt,IntPtr.Zero,ex,cstr);
109 Marshal.FreeHGlobal(cstr);
110 return 1;
111 }
112
113 // everything is OK
114 return 0;
115 }
116
117 private static MkErrorE Sq3LiteExecV2Call(IntPtr mkrt, IntPtr callV2, IntPtr vals, IntPtr cols)
118 {
119 Sq3Call data = (Sq3Call)GCHandle.FromIntPtr(callV2).Target;
120
121 var valsO = MkBufferListC.MkBufferListC_ObjNew(vals);
122 var colsO = MkBufferListC.MkBufferListC_ObjNew(cols);
123
124 // call the function
125 try {
126 if (data.call2 != null) {
127 data.call2(valsO,colsO);
128 } else if (data.if2 != null) {
129 data.if2.Sq3LiteExecV2(valsO,colsO);
130 } else {
131 return MkErrorE.OK;
132 }
133 } catch (Exception ex) {
134 IntPtr cstr = Marshal.StringToHGlobalAnsi("Sq3LiteExecV2Call");
135 MkExceptionC.Catch(data.mkrt,IntPtr.Zero,ex,cstr);
136 Marshal.FreeHGlobal(cstr);
137 return MkErrorE.ERROR;
138 }
139
140 // everything is OK
142 }
143
144 } // END - class "Sq3LiteC"
145} // END - namespace "cssq3lite"
146
static MkBufferListC MkBufferListC_ObjNew(IntPtr hdl)
static IntPtr Catch(IntPtr mkrt, IntPtr expobj, Exception exception, IntPtr callfunc)
static unsafe MkErrorE CsRuntimeErrorGetCode(IntPtr mkrt)
Sq3LiteC - the class known as sq3lite or Lite defined by Sq3LiteS …
delegate void Sq3LiteExecV2CCB(MkBufferListC vals, MkBufferListC cols)
delegate void Sq3LiteExecCCB(string[] vals, string[] cols)
implements the cssq3lite API object: public version from LcConfigIncludeF as method
MkErrorE
void Sq3LiteExec(string[] vals, string[] cols)
void Sq3LiteExecV2(MkBufferListC vals, MkBufferListC cols)