Reads Packets until EOF-Packet or an Error appears.
()
| 934 | |
| 935 | // Reads Packets until EOF-Packet or an Error appears. |
| 936 | func (mc *mysqlConn) skipRows() error { |
| 937 | for { |
| 938 | data, err := mc.readPacket() |
| 939 | if err != nil { |
| 940 | return err |
| 941 | } |
| 942 | |
| 943 | switch data[0] { |
| 944 | case iERR: |
| 945 | return mc.handleErrorPacket(data) |
| 946 | case iEOF: |
| 947 | // text row packets may starts with LengthEncodedString. |
| 948 | // In such case, 0xFE can mean string larger than 0xffffff. |
| 949 | if len(data) <= 0xffffff { |
| 950 | if mc.capabilities&clientDeprecateEOF == 0 { |
| 951 | // EOF packet |
| 952 | mc.status = readStatus(data[3:]) |
| 953 | } else { |
| 954 | // OK packet with an 0xFE header |
| 955 | _, _, n := readLengthEncodedInteger(data[1:]) // affected_rows |
| 956 | _, _, m := readLengthEncodedInteger(data[1+n:]) // last_insert_id |
| 957 | mc.status = readStatus(data[1+n+m:]) |
| 958 | } |
| 959 | return nil |
| 960 | } |
| 961 | } |
| 962 | } |
| 963 | } |
| 964 | |
| 965 | /****************************************************************************** |
| 966 | * Prepared Statements * |
no test coverage detected