@@ -28,10 +28,10 @@ import (
28
28
// Trace... constants identify the possible events causing callback invocation.
29
29
// Values are same as the corresponding SQLite Trace Event Codes.
30
30
const (
31
- TraceStmt = C .SQLITE_TRACE_STMT
32
- TraceProfile = C .SQLITE_TRACE_PROFILE
33
- TraceRow = C .SQLITE_TRACE_ROW
34
- TraceClose = C .SQLITE_TRACE_CLOSE
31
+ TraceStmt = uint32 ( C .SQLITE_TRACE_STMT )
32
+ TraceProfile = uint32 ( C .SQLITE_TRACE_PROFILE )
33
+ TraceRow = uint32 ( C .SQLITE_TRACE_ROW )
34
+ TraceClose = uint32 ( C .SQLITE_TRACE_CLOSE )
35
35
)
36
36
37
37
type TraceInfo struct {
@@ -71,7 +71,7 @@ type TraceUserCallback func(TraceInfo) int
71
71
72
72
type TraceConfig struct {
73
73
Callback TraceUserCallback
74
- EventMask C. uint
74
+ EventMask uint32
75
75
WantExpandedSQL bool
76
76
}
77
77
@@ -105,6 +105,8 @@ func traceCallbackTrampoline(
105
105
// Parameter named 'X' in SQLite docs (eXtra event data?):
106
106
xValue unsafe.Pointer ) C.int {
107
107
108
+ eventCode := uint32 (traceEventCode )
109
+
108
110
if ctx == nil {
109
111
panic (fmt .Sprintf ("No context (ev 0x%x)" , traceEventCode ))
110
112
}
@@ -114,7 +116,7 @@ func traceCallbackTrampoline(
114
116
115
117
var traceConf TraceConfig
116
118
var found bool
117
- if traceEventCode == TraceClose {
119
+ if eventCode == TraceClose {
118
120
// clean up traceMap: 'pop' means get and delete
119
121
traceConf , found = popTraceMapping (connHandle )
120
122
} else {
@@ -123,16 +125,16 @@ func traceCallbackTrampoline(
123
125
124
126
if ! found {
125
127
panic (fmt .Sprintf ("Mapping not found for handle 0x%x (ev 0x%x)" ,
126
- connHandle , traceEventCode ))
128
+ connHandle , eventCode ))
127
129
}
128
130
129
131
var info TraceInfo
130
132
131
- info .EventCode = uint32 ( traceEventCode )
133
+ info .EventCode = eventCode
132
134
info .AutoCommit = (int (C .sqlite3_get_autocommit (contextDB )) != 0 )
133
135
info .ConnHandle = connHandle
134
136
135
- switch traceEventCode {
137
+ switch eventCode {
136
138
case TraceStmt :
137
139
info .StmtHandle = uintptr (p )
138
140
@@ -183,7 +185,7 @@ func traceCallbackTrampoline(
183
185
// registering this callback trampoline with SQLite --- for cleanup.
184
186
// In the future there may be more events forced to "selected" in SQLite
185
187
// for the driver's needs.
186
- if traceConf .EventMask & traceEventCode == 0 {
188
+ if traceConf .EventMask & eventCode == 0 {
187
189
return 0
188
190
}
189
191
0 commit comments