From 63e27b8f233f741b139a191a7d35d20b3d74deef Mon Sep 17 00:00:00 2001 From: Acyuta Date: Thu, 1 Aug 2013 15:44:58 -0400 Subject: [PATCH] Fix for issue 134 where using mysqlstream: true, with the --limit option in the cmd line raises Mysql exception with duplicate LIMIT statement in query. --- lib/etl/control/source/mysql_streamer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/etl/control/source/mysql_streamer.rb b/lib/etl/control/source/mysql_streamer.rb index 5d12160..1150199 100644 --- a/lib/etl/control/source/mysql_streamer.rb +++ b/lib/etl/control/source/mysql_streamer.rb @@ -21,7 +21,7 @@ def initialize(query, target, connection) # in the SQL - its bound to cause trouble @query = query.split.join(' ') @name = target - @first_row = connection.select_all("#{query} LIMIT 1") + @first_row = connection.select_all("#{query.sub(/ LIMIT \d+/, '')} LIMIT 1") end # We implement some bits of a hash so that database_source