Skip to content
Open
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
4 changes: 2 additions & 2 deletions ci/mysql57.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ apt-key add support/B7B3B788A8D3785C.asc # 8.1 and higher
# Verify the repository as add-apt-repository does not.
wget -q --spider http://repo.mysql.com/apt/ubuntu/dists/$(lsb_release -cs)/mysql-5.7
add-apt-repository 'http://repo.mysql.com/apt/ubuntu mysql-5.7'
apt-get update -qq
apt-get install -qq mysql-server libmysqlclient-dev
apt-get update --allow-unauthenticated -qq
apt-get install --allow-unauthenticated -qq mysql-server libmysqlclient-dev
4 changes: 2 additions & 2 deletions ci/mysql80.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ apt-key add support/B7B3B788A8D3785C.asc # 8.1 and higher
# Verify the repository as add-apt-repository does not.
wget -q --spider http://repo.mysql.com/apt/ubuntu/dists/$(lsb_release -cs)/mysql-8.0
add-apt-repository 'http://repo.mysql.com/apt/ubuntu mysql-8.0'
apt-get update -qq
apt-get install -qq mysql-server libmysqlclient-dev
apt-get update --allow-unauthenticated -qq
apt-get install --allow-unauthenticated -qq mysql-server libmysqlclient-dev
4 changes: 2 additions & 2 deletions ci/mysql84.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ apt-key add support/B7B3B788A8D3785C.asc # 8.1 and higher
# Verify the repository as add-apt-repository does not.
wget -q --spider http://repo.mysql.com/apt/ubuntu/dists/$(lsb_release -cs)/mysql-8.4-lts
add-apt-repository 'http://repo.mysql.com/apt/ubuntu mysql-8.4-lts'
apt-get update -qq
apt-get install -qq mysql-server libmysqlclient-dev
apt-get update --allow-unauthenticated -qq
apt-get install --allow-unauthenticated -qq mysql-server libmysqlclient-dev
18 changes: 10 additions & 8 deletions spec/mysql2/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1071,14 +1071,16 @@ def run_gc
end

it "#affected_rows with multi statements returns the last result's affected_rows" do
@client.set_server_option(Mysql2::Client::OPTION_MULTI_STATEMENTS_ON)

@client.query("INSERT INTO lastIdTest (blah) VALUES (1234), (5678); UPDATE lastIdTest SET blah=4321 WHERE id=1")
expect(@client.affected_rows).to eq(2)
expect(@client.next_result).to eq(true)
expect(@client.affected_rows).to eq(1)
ensure
@client.set_server_option(Mysql2::Client::OPTION_MULTI_STATEMENTS_OFF)
begin
@client.set_server_option(Mysql2::Client::OPTION_MULTI_STATEMENTS_ON)

@client.query("INSERT INTO lastIdTest (blah) VALUES (1234), (5678); UPDATE lastIdTest SET blah=4321 WHERE id=1")
expect(@client.affected_rows).to eq(2)
expect(@client.next_result).to eq(true)
expect(@client.affected_rows).to eq(1)
ensure
@client.set_server_option(Mysql2::Client::OPTION_MULTI_STATEMENTS_OFF)
end
end

it "#affected_rows isn't cleared by Statement#close" do
Expand Down
10 changes: 9 additions & 1 deletion spec/mysql2/statement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,22 @@ def stmt_count
end

it "should tell us about the fields" do
statement = @client.prepare 'SELECT 1 as foo, 2'
statement = @client.prepare 'SELECT 1 AS foo, 2'
statement.execute
list = statement.fields
expect(list.length).to eq(2)
expect(list.first).to eq('foo')
expect(list[1]).to eq('2')
end

it "should give us fields when no rows" do
statement = @client.prepare 'SELECT 1 AS foo FROM mysql2_test WHERE 1=0'
result = statement.execute
list = result.fields
expect(list.length).to eq(1)
expect(list.first).to eq('foo')
end

it "should handle as a decimal binding a BigDecimal" do
stmt = @client.prepare('SELECT ? AS decimal_test')
test_result = stmt.execute(BigDecimal("123.45")).first
Expand Down
Loading