Example #1
0
// SendCommand sends a raw command to the MySQL server.
func (conn *Connection) SendCommand(command uint32, data []byte) error {
	var ret C.my_bool
	if data == nil {
		ret = C.vt_simple_command(&conn.c, command, nil, 0, 1)
	} else {
		ret = C.vt_simple_command(&conn.c, command, (*C.uchar)(unsafe.Pointer(&data[0])), C.ulong(len(data)), 1)
	}
	if ret != 0 {
		return conn.lastError(fmt.Sprintf("SendCommand(%#v, %#v)", command, data))
	}
	return nil
}
Example #2
0
// SendCommand sends a raw command to the MySQL server.
func (conn *Connection) SendCommand(command uint32, data []byte) error {
	var ret C.my_bool
	if data == nil {
		ret = C.vt_simple_command(&conn.c, command, nil, 0, 1)
	} else {
		ret = C.vt_simple_command(&conn.c, command, (*C.uchar)(unsafe.Pointer(&data[0])), C.ulong(len(data)), 1)
	}
	if ret != 0 {
		return fmt.Errorf("error sending raw MySQL command: %v", conn.lastError(""))
	}
	return nil
}