@@ -107,9 +107,28 @@ func (c *Conn) handleStmtExecute(data []byte) (*Result, error) {
107
107
108
108
flag := data [pos ]
109
109
pos ++
110
- //now we only support CURSOR_TYPE_NO_CURSOR flag
111
- if flag != 0 {
112
- return nil , NewError (ER_UNKNOWN_ERROR , fmt .Sprintf ("unsupported flag %d" , flag ))
110
+
111
+ // Supported types:
112
+ // - CURSOR_TYPE_NO_CURSOR
113
+ // - PARAMETER_COUNT_AVAILABLE
114
+
115
+ // Make sure the first 4 bits are 0.
116
+ if flag >> 4 != 0 {
117
+ return nil , NewError (ER_UNKNOWN_ERROR , fmt .Sprintf ("unsupported flags 0x%x" , flag ))
118
+ }
119
+
120
+ // Test for unsupported flags in the remaining 4 bits.
121
+ if flag & CURSOR_TYPE_READ_ONLY > 0 {
122
+ return nil , NewError (ER_UNKNOWN_ERROR ,
123
+ fmt .Sprintf ("unsupported flag %s" , "CURSOR_TYPE_READ_ONLY" ))
124
+ }
125
+ if flag & CURSOR_TYPE_FOR_UPDATE > 0 {
126
+ return nil , NewError (ER_UNKNOWN_ERROR ,
127
+ fmt .Sprintf ("unsupported flag %s" , "CURSOR_TYPE_FOR_UPDATE" ))
128
+ }
129
+ if flag & CURSOR_TYPE_READ_ONLY > 0 {
130
+ return nil , NewError (ER_UNKNOWN_ERROR ,
131
+ fmt .Sprintf ("unsupported flag %s" , "CURSOR_TYPE_SCROLLABLE" ))
113
132
}
114
133
115
134
//skip iteration-count, always 1
0 commit comments