Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade support to Crystal 0.35 #90

Merged
merged 2 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/mysql/read_packet.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ class MySql::ReadPacket < IO
raise DB::ConnectionLost.new(@connection)
end

def write(slice) : Nil
raise "not implemented"
end
{% if compare_versions(Crystal::VERSION, "0.35.0-0") >= 0 %}
def write(slice) : Int64
raise "not implemented"
end
{% else %}
def write(slice) : Nil
raise "not implemented"
end
{% end %}

def read_byte!
read_byte || raise "Unexpected EOF"
Expand Down
18 changes: 13 additions & 5 deletions src/mysql/write_packet.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ class MySql::WritePacket < IO
raise "not implemented"
end

def write(slice) : Nil
@io.write(slice)
rescue IO::EOFError
raise DB::ConnectionLost.new(@connection)
end
{% if compare_versions(Crystal::VERSION, "0.35.0-0") >= 0 %}
def write(slice) : Int64
@io.write(slice)
rescue IO::EOFError
raise DB::ConnectionLost.new(@connection)
end
{% else %}
def write(slice) : Nil
@io.write(slice)
rescue IO::EOFError
raise DB::ConnectionLost.new(@connection)
end
{% end %}

def write_lenenc_string(s : String)
write_lenenc_int(s.bytesize)
Expand Down