diff --git a/ci/mysql57.sh b/ci/mysql57.sh index 9cd681ff..354acd22 100644 --- a/ci/mysql57.sh +++ b/ci/mysql57.sh @@ -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 diff --git a/ci/mysql80.sh b/ci/mysql80.sh index 814412c6..7be8da5a 100644 --- a/ci/mysql80.sh +++ b/ci/mysql80.sh @@ -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 diff --git a/ci/mysql84.sh b/ci/mysql84.sh index 5c78da55..73ef2623 100644 --- a/ci/mysql84.sh +++ b/ci/mysql84.sh @@ -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 diff --git a/spec/mysql2/client_spec.rb b/spec/mysql2/client_spec.rb index ad7d2532..b04e9cb3 100644 --- a/spec/mysql2/client_spec.rb +++ b/spec/mysql2/client_spec.rb @@ -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 diff --git a/spec/mysql2/statement_spec.rb b/spec/mysql2/statement_spec.rb index 8c4d97e6..5cad4807 100644 --- a/spec/mysql2/statement_spec.rb +++ b/spec/mysql2/statement_spec.rb @@ -184,7 +184,7 @@ 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) @@ -192,6 +192,14 @@ def stmt_count 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