2626 errPktTooLarge = errors .New ("Packet for query is too large. You can change this value on the server by adjusting the 'max_allowed_packet' variable." )
2727)
2828
29- // error type which represents a single MySQL error
29+ // MySQLError is an error type which represents a single MySQL error
3030type MySQLError struct {
3131 Number uint16
3232 Message string
@@ -36,22 +36,29 @@ func (me *MySQLError) Error() string {
3636 return fmt .Sprintf ("Error %d: %s" , me .Number , me .Message )
3737}
3838
39- // error type which represents a group of one or more MySQL warnings
40- type MySQLWarnings []mysqlWarning
39+ // MySQLWarnings is an error type which represents a group of one or more MySQL
40+ // warnings
41+ type MySQLWarnings []MysqlWarning
4142
4243func (mws MySQLWarnings ) Error () string {
4344 var msg string
4445 for i , warning := range mws {
4546 if i > 0 {
4647 msg += "\r \n "
4748 }
48- msg += fmt .Sprintf ("%s %s: %s" , warning .Level , warning .Code , warning .Message )
49+ msg += fmt .Sprintf (
50+ "%s %s: %s" ,
51+ warning .Level ,
52+ warning .Code ,
53+ warning .Message ,
54+ )
4955 }
5056 return msg
5157}
5258
53- // error type which represents a single MySQL warning
54- type mysqlWarning struct {
59+ // MysqlWarning is an error type which represents a single MySQL warning.
60+ // Warnings are returned in groups only. See MySQLWarnings
61+ type MysqlWarning struct {
5562 Level string
5663 Code string
5764 Message string
@@ -66,15 +73,15 @@ func (mc *mysqlConn) getWarnings() (err error) {
6673 var warnings = MySQLWarnings {}
6774 var values = make ([]driver.Value , 3 )
6875
69- var warning mysqlWarning
76+ var warning MysqlWarning
7077 var raw []byte
7178 var ok bool
7279
7380 for {
7481 err = rows .Next (values )
7582 switch err {
7683 case nil :
77- warning = mysqlWarning {}
84+ warning = MysqlWarning {}
7885
7986 if raw , ok = values [0 ].([]byte ); ok {
8087 warning .Level = string (raw )
0 commit comments