@@ -194,10 +194,12 @@ func (c *Conn) handshake() error {
194
194
return nil
195
195
}
196
196
197
+ // Close directly closes the connection. Use Quit() to first send COM_QUIT to the server and then close the connection.
197
198
func (c * Conn ) Close () error {
198
199
return c .Conn .Close ()
199
200
}
200
201
202
+ // Quit sends COM_QUIT to the server and then closes the connection. Use Close() to directly close the connection.
201
203
func (c * Conn ) Quit () error {
202
204
if err := c .writeCommand (COM_QUIT ); err != nil {
203
205
return err
@@ -375,6 +377,7 @@ func (c *Conn) Rollback() error {
375
377
return errors .Trace (err )
376
378
}
377
379
380
+ // SetAttributes sets connection attributes
378
381
func (c * Conn ) SetAttributes (attributes map [string ]string ) {
379
382
for k , v := range attributes {
380
383
c .attributes [k ] = v
@@ -407,6 +410,7 @@ func (c *Conn) GetCollation() string {
407
410
return c .collation
408
411
}
409
412
413
+ // FieldList uses COM_FIELD_LIST to get a list of fields from a table
410
414
func (c * Conn ) FieldList (table string , wildcard string ) ([]* Field , error ) {
411
415
if err := c .writeCommandStrStr (COM_FIELD_LIST , table , wildcard ); err != nil {
412
416
return nil , errors .Trace (err )
@@ -446,10 +450,12 @@ func (c *Conn) SetAutoCommit() error {
446
450
return nil
447
451
}
448
452
453
+ // IsAutoCommit returns true if SERVER_STATUS_AUTOCOMMIT is set
449
454
func (c * Conn ) IsAutoCommit () bool {
450
455
return c .status & SERVER_STATUS_AUTOCOMMIT > 0
451
456
}
452
457
458
+ // IsInTransaction returns true if SERVER_STATUS_IN_TRANS is set
453
459
func (c * Conn ) IsInTransaction () bool {
454
460
return c .status & SERVER_STATUS_IN_TRANS > 0
455
461
}
@@ -485,6 +491,7 @@ func (c *Conn) exec(query string) (*Result, error) {
485
491
486
492
// CapabilityString is returning a string with the names of capability flags
487
493
// separated by "|". Examples of capability names are CLIENT_DEPRECATE_EOF and CLIENT_PROTOCOL_41.
494
+ // These are defined as constants in the mysql package.
488
495
func (c * Conn ) CapabilityString () string {
489
496
var caps []string
490
497
capability := c .capability
@@ -568,6 +575,8 @@ func (c *Conn) CapabilityString() string {
568
575
return strings .Join (caps , "|" )
569
576
}
570
577
578
+ // StatusString returns a "|" separated list of status fields. Example status values are SERVER_QUERY_WAS_SLOW and SERVER_STATUS_AUTOCOMMIT.
579
+ // These are defined as constants in the mysql package.
571
580
func (c * Conn ) StatusString () string {
572
581
var stats []string
573
582
status := c .status
0 commit comments