myreplicator 1.1.26 → 1.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -94,8 +94,15 @@ module Myreplicator
94
94
  if self.export_to == 'vertica'
95
95
  begin
96
96
  result = Myreplicator::DB.exec_sql('vertica',sql)
97
- if !result.blank?
98
- return result.rows.first[:max]
97
+ if result.rows.first[:max].blank?
98
+ return "0"
99
+ else
100
+ case result.rows.first[:max].class.to_s
101
+ when "DateTime"
102
+ return result.rows.first[:max].strftime('%Y-%m-%d %H:%M:%S')
103
+ else
104
+ return result.rows.first[:max].to_s
105
+ end
99
106
  end
100
107
  rescue Exception => e
101
108
  puts "Vertica Table Not Existed"
@@ -132,7 +132,7 @@ module Myreplicator
132
132
  options[:incremental_col] = @export_obj.incremental_column
133
133
  options[:incremental_col_type] = @export_obj.incremental_column_type
134
134
  #options[:incremental_val] = @export_obj.max_incremental_value
135
- options[:incremental_val] = [@export_obj.destination_max_incremental_value.strftime('%Y-%m-%d %H:%M:%S'), @export_obj.max_incremental_value].min
135
+ options[:incremental_val] = [@export_obj.destination_max_incremental_value, @export_obj.max_incremental_value].min
136
136
  end
137
137
 
138
138
  #Kernel.p "===== incremental_export_into_outfile OPTIONS ====="
@@ -96,7 +96,7 @@ module Myreplicator
96
96
  :file => options[:filepath],
97
97
  :delimiter => "\\0",
98
98
  :null_value => "NULL",
99
- :enclosed => "")
99
+ :enclosed => '')
100
100
  # working now but should fix this
101
101
  if !vertica_options["vsql"].blank?
102
102
  options.reverse_merge!(:vsql => vertica_options["vsql"])
@@ -188,7 +188,7 @@ module Myreplicator
188
188
  file_handler = ""
189
189
  file_handler = "GZIP" if file_extension == "gz"
190
190
  tmp_dir = Myreplicator.tmp_path
191
- sql = "COPY #{prepared_options[:schema]}.#{prepared_options[:table]} FROM LOCAL \'#{prepared_options[:file]}\' #{file_handler} DELIMITER E\'#{prepared_options[:delimiter]}\' NULL as \'#{prepared_options[:null_value]}\' ENCLOSED BY \'#{prepared_options[:enclosed]}\' EXCEPTIONS '#{tmp_dir}/load_logs/#{prepared_options[:schema]}_#{prepared_options[:table_name]}.log';"
191
+ sql = "COPY #{prepared_options[:schema]}.#{prepared_options[:table]} FROM LOCAL \'#{prepared_options[:file]}\' #{file_handler} DELIMITER E\'#{prepared_options[:delimiter]}\' NULL as \'#{prepared_options[:null_value]}\' ENCLOSED BY E\'#{prepared_options[:enclosed]}\' EXCEPTIONS '#{tmp_dir}/load_logs/#{prepared_options[:schema]}_#{prepared_options[:table_name]}.log';"
192
192
  cmd = "#{prepared_options[:vsql]} -h #{prepared_options[:host]} -U #{prepared_options[:user]} -w #{prepared_options[:pass]} -d #{prepared_options[:db]} -c \"#{sql}\""
193
193
  return cmd
194
194
  end
@@ -1,3 +1,3 @@
1
1
  module Myreplicator
2
- VERSION = "1.1.26"
2
+ VERSION = "1.1.27"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myreplicator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.26
4
+ version: 1.1.27
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-08 00:00:00.000000000 Z
12
+ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -359,7 +359,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
359
359
  version: '0'
360
360
  segments:
361
361
  - 0
362
- hash: 2980542232773579979
362
+ hash: 4065111326222149414
363
363
  required_rubygems_version: !ruby/object:Gem::Requirement
364
364
  none: false
365
365
  requirements:
@@ -368,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
368
368
  version: '0'
369
369
  segments:
370
370
  - 0
371
- hash: 2980542232773579979
371
+ hash: 4065111326222149414
372
372
  requirements: []
373
373
  rubyforge_project:
374
374
  rubygems_version: 1.8.24