class MySql::ReadPacket

Defined in:

mysql/read_packet.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(io : IO, connection : Connection) #

[View source]

Instance Method Detail

def discard #

[View source]
def read(slice : Bytes) #
Description copied from class IO

Reads at most slice.size bytes from this IO into slice. Returns the number of bytes read, which is 0 if and only if there is no more data to read (so checking for 0 is the way to detect end of file).

io = IO::Memory.new "hello"
slice = Bytes.new(4)
io.read(slice) # => 4
slice          # => Bytes[104, 101, 108, 108]
io.read(slice) # => 1
slice          # => Bytes[111, 101, 108, 108]
io.read(slice) # => 0

[View source]
def read_blob #

[View source]
def read_byte! #

[View source]
def read_byte_array(length) #

[View source]
def read_fixed_int(n) #

TODO should return different types of int depending on n value (note: update Connection#read_column_definitions to remote to_i16/to_i8)


[View source]
def read_int #

[View source]
def read_int64_string(length) #

[View source]
def read_int_string(length) #

[View source]
def read_lenenc_int(h = read_byte!) #

[View source]
def read_lenenc_string #

[View source]
def read_string(length) #

[View source]
def read_string #

[View source]
def to_s(io) #

[View source]
def write(slice) : Nil #

[View source]