****************************************************************************** * Prepared Statements * ******************************************************************************/ Prepare Result Packets https://dev.mysql.com/doc/dev/mysql-se
()
| 969 | // Prepare Result Packets |
| 970 | // https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_stmt_prepare.html#sect_protocol_com_stmt_prepare_response |
| 971 | func (stmt *mysqlStmt) readPrepareResultPacket() (uint16, error) { |
| 972 | data, err := stmt.mc.readPacket() |
| 973 | if err == nil { |
| 974 | // packet indicator [1 byte] |
| 975 | if data[0] != iOK { |
| 976 | return 0, stmt.mc.handleErrorPacket(data) |
| 977 | } |
| 978 | |
| 979 | // statement id [4 bytes] |
| 980 | stmt.id = binary.LittleEndian.Uint32(data[1:5]) |
| 981 | |
| 982 | // Column count [16 bit uint] |
| 983 | columnCount := binary.LittleEndian.Uint16(data[5:7]) |
| 984 | |
| 985 | // Param count [16 bit uint] |
| 986 | stmt.paramCount = int(binary.LittleEndian.Uint16(data[7:9])) |
| 987 | |
| 988 | // Reserved [8 bit] |
| 989 | |
| 990 | // Warning count [16 bit uint] |
| 991 | |
| 992 | return columnCount, nil |
| 993 | } |
| 994 | return 0, err |
| 995 | } |
| 996 | |
| 997 | // https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_stmt_send_long_data.html |
| 998 | func (stmt *mysqlStmt) writeCommandLongData(paramID int, arg []byte) error { |
no test coverage detected