diff --git a/lib/mysql/protocol.rb b/lib/mysql/protocol.rb index 20eab62..85f0436 100644 --- a/lib/mysql/protocol.rb +++ b/lib/mysql/protocol.rb @@ -252,6 +252,7 @@ def get_result end if res_packet.field_count.nil? # LOAD DATA LOCAL INFILE send_local_file(res_packet.message) + res_packet = ResultPacket.parse read end @affected_rows, @insert_id, @server_status, @warning_count, @message = res_packet.affected_rows, res_packet.insert_id, res_packet.server_status, res_packet.warning_count, res_packet.message @@ -273,7 +274,6 @@ def send_local_file(filename) end ensure write nil # EOF mark - read end # Retrieve n fields diff --git a/test/test_mysql.rb b/test/test_mysql.rb index 54a36e9..aea4a36 100644 --- a/test/test_mysql.rb +++ b/test/test_mysql.rb @@ -176,6 +176,7 @@ class TestMysql < Test::Unit::TestCase @m.connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_PORT, MYSQL_SOCKET) @m.query('create temporary table t (i int, c char(10))') @m.query("load data local infile '#{tmpf.path}' into table t") + assert{ @m.info == 'Records: 1 Deleted: 0 Skipped: 0 Warnings: 0' } assert{ @m.query('select * from t').fetch_row == ['123','abc'] } end test 'load_data_local_dir: client can execute LOAD DATA LOCAL INFILE query with specified directory' do