MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / FieldList

Method FieldList

IceFireDB-SQLProxy/pkg/mysql/client/conn.go:236–268  ·  view source on GitHub ↗
(table string, wildcard string)

Source from the content-addressed store, hash-verified

234}
235
236func (c *Conn) FieldList(table string, wildcard string) ([]*Field, error) {
237 if err := c.writeCommandStrStr(COM_FIELD_LIST, table, wildcard); err != nil {
238 return nil, errors.Trace(err)
239 }
240
241 data, err := c.ReadPacket()
242 if err != nil {
243 return nil, errors.Trace(err)
244 }
245
246 fs := make([]*Field, 0, 4)
247 var f *Field
248 if data[0] == ERR_HEADER {
249 return nil, c.handleErrorPacket(data)
250 } else {
251 for {
252 if data, err = c.ReadPacket(); err != nil {
253 return nil, errors.Trace(err)
254 }
255
256 // EOF Packet
257 if c.isEOFPacket(data) {
258 return fs, nil
259 }
260
261 if f, err = FieldData(data).Parse(); err != nil {
262 return nil, errors.Trace(err)
263 }
264 fs = append(fs, f)
265 }
266 }
267 return nil, fmt.Errorf("field list error")
268}
269
270func (c *Conn) SetAutoCommit(n bool) error {
271 if n && !c.IsAutoCommit() {

Callers 1

HandleFieldListMethod · 0.45

Calls 6

writeCommandStrStrMethod · 0.95
ReadPacketMethod · 0.95
handleErrorPacketMethod · 0.95
isEOFPacketMethod · 0.95
FieldDataTypeAlias · 0.50
ParseMethod · 0.45

Tested by

no test coverage detected