Permalink
Browse files

script for dropping triggers

  • Loading branch information...
AlexKVal committed Jan 7, 2012
1 parent 6e12d36 commit 26b323342e4280e3f4d88952df90208848d9d3f4
Showing with 114 additions and 101 deletions.
  1. +1 −1 lib/client/client.rb
  2. +1 −0 lib/client/prepared_data_queue.rb
  3. +18 −10 lib/setup/pvsw_setup.rb
  4. +90 −90 logs/tests_log.txt
  5. +2 −0 scripts/drop_triggers.bat
  6. +2 −0 spec/spec_helper.rb
View
@@ -13,7 +13,7 @@ class Client
def setup_remote_object(server_uri)
LOG.debug "Client.setup_remote_object server_uri=#{server_uri}"
- DRb.start_service
+ DRb.start_service(CALLBACK_URI)
LOG.debug "DRb.start_service on uri: #{DRb.uri}"
@remote_object = DRbObject.new_with_uri server_uri
@@ -29,6 +29,7 @@ def remove_sent(sent_ids)
LOG.debug "PreparedDataQueue.remove_sent sent_ids=#{sent_ids}"
sent_ids.each do |id|
+ puts "PreparedDataRow.get(#{id}).destroy"
PreparedDataRow.get(id).destroy
end
View
@@ -1,14 +1,21 @@
require_relative "../shared/pvsw"
require_relative "../../config"
-Pvsw.odbc_alias = FILIAL_ALIAS
+#Pvsw.odbc_alias = FILIAL_ALIAS
class PvswSetup < Pvsw
def initialize(dbc)
super
end
+ def drop_triggers
+ return unless table_exist? 'X$Trigger'
+ @tables_to_watch.each do |tbl|
+ drop_triggers_for tbl
+ end
+ end
+
def run_setup_clientdb
drop_triggers
@@ -82,13 +89,6 @@ def setup_test_tables
)"
end
- def drop_triggers
- return unless table_exist? 'X$Trigger'
- @tables_to_watch.each do |tbl|
- drop_triggers_for tbl
- end
- end
-
def setup_triggers
@tables_to_watch.each do |tbl|
print "\n* "
@@ -181,11 +181,11 @@ def create_trigger(table, suffix)
def print_help_message
puts "Usage:"
- puts "#{$0} server or client or test :)"
+ puts "#{$0} server or client or test or drop :)"
end
def setup_client_side_db
- ODBC::connect(Pvsw.odbc_alias) do |dbc|
+ ODBC::connect(FILIAL_ALIAS) do |dbc|
PvswSetup.new(dbc).run_setup_clientdb
end
end
@@ -196,13 +196,21 @@ def setup_testdb
end
end
+def setup_drop_triggers
+ ODBC::connect(FILIAL_ALIAS) do |dbc|
+ PvswSetup.new(dbc).drop_triggers
+ end
+end
+
case ARGV[0]
when 'test'
setup_testdb
when 'server'
setup_server_side_db
when 'client'
setup_client_side_db
+when 'drop'
+ setup_drop_triggers
else
print_help_message
end
View
@@ -1,90 +1,90 @@
-# Logfile created on 2012-01-03 18:57:45 +0200 by logger.rb/31641
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:51 +0200: Applier.run
-2012-01-03 18:57:51 +0200: sql=INSERT INTO tableTwo (ID, string_prm, integer_prm, date_prm) VALUES (23, 'value', 123, '12/12/2011')
-2012-01-03 18:57:51 +0200: ReceivedDataQueue.clear!
-2012-01-03 18:57:52 +0200: Applier.run
-2012-01-03 18:57:52 +0200: sql=UPDATE tableTwo SET string_prm = 'me me', integer_prm = 321, date_prm = '1/1/2011' WHERE ID = 23
-2012-01-03 18:57:52 +0200: ReceivedDataQueue.clear!
-2012-01-03 18:57:52 +0200: Applier.run
-2012-01-03 18:57:53 +0200: sql=DELETE FROM tableTwo WHERE ID = 23
-2012-01-03 18:57:53 +0200: ReceivedDataQueue.clear!
-2012-01-03 18:57:53 +0200: Applier.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:53 +0200: Applier.run
-2012-01-03 18:57:53 +0200: sql=INSERT INTO tableTwo (ID, string_prm, integer_prm, date_prm) VALUES (23, 'value', 123, '2011-12-12')
-2012-01-03 18:57:53 +0200: ReceivedDataQueue.clear!
-2012-01-03 18:57:53 +0200: Incoming data: 2 for filial: filial
-2012-01-03 18:57:53 +0200: Dispatcher.receive_filial_data incoming_data=[[1, "one", 23, "I", "json_data"], [2, "one", 23, "U", "json_data2"]]
-2012-01-03 18:57:53 +0200: yield received_ids=[1, 2]. Next has to be answer !
-2012-01-03 18:57:53 +0200: got answer=ok
-2012-01-03 18:57:53 +0200: Processing data for filial: filial
-2012-01-03 18:57:53 +0200: == The end of processing received data for filial: filial
-2012-01-03 18:57:53 +0200: ReceivedDataQueue.save
-2012-01-03 18:57:53 +0200: saving received data: twoTable 44 I
-2012-01-03 18:57:53 +0200: ReceivedDataQueue.save
-2012-01-03 18:57:53 +0200: saving received data: oneTable 23 I
-2012-01-03 18:57:54 +0200: saving received data: twoTable 44 I
-2012-01-03 18:57:54 +0200: saving received data: oneTable 23 U
-2012-01-03 18:57:54 +0200: saving received data: twoTable 44 U
-2012-01-03 18:57:54 +0200: saving received data: twoTable 44 U
-2012-01-03 18:57:54 +0200: ReceivedDataQueue.save
-2012-01-03 18:57:54 +0200: saving received data: oneTable 23 I
-2012-01-03 18:57:54 +0200: saving received data: twoTable 44 I
-2012-01-03 18:57:54 +0200: saving received data: oneTable 23 U
-2012-01-03 18:57:54 +0200: ReceivedDataQueue.clear!
-2012-01-03 18:57:54 +0200: ReceivedDataQueue.save
-2012-01-03 18:57:54 +0200: saving received data: twoTable 44 I
-2012-01-03 18:57:54 +0200: Client.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:54 +0200: Client.get_trackings!
-2012-01-03 18:57:54 +0200: Client.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:54 +0200: Client.get_trackings!
-2012-01-03 18:57:54 +0200: Client.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:54 +0200: Client.get_trackings!
-2012-01-03 18:57:54 +0200: Client.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:54 +0200: Client.prepare_tracked_data
-2012-01-03 18:57:54 +0200: Client.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:54 +0200: Client.send_tracked_data
-2012-01-03 18:57:54 +0200: Client begin: remote_object.receive_filial_data
-2012-01-03 18:57:54 +0200: break
-2012-01-03 18:57:54 +0200: == The end of sending data.
-2012-01-03 18:57:54 +0200: Client.new pvsw_alias=TestDB.NET
-2012-01-03 18:57:54 +0200: Client.send_tracked_data
-2012-01-03 18:57:54 +0200: Client begin: remote_object.receive_filial_data
-2012-01-03 18:57:54 +0200: Waiting till server is online. Sleep for 0 seconds
-2012-01-03 18:57:54 +0200: == The end of sending data.
-2012-01-03 18:57:54 +0200: PreparedDataQueue.data_to_send=[[1, "oneTable", 23, "I", "json_data"], [23, "twoTable", 44, "I", "json_data"]]
-2012-01-03 18:57:54 +0200: PreparedDataQueue.remove_sent sent_ids=[1, 23, 45, 246]
-2012-01-03 18:57:54 +0200: PreparedDataQueue.remove_sent sent_ids=[1, 23, 45]
-2012-01-03 18:57:54 +0200: TrackingsQueue.save_trackings
-2012-01-03 18:57:54 +0200: PreparedDataQueue.queue_next_by
-2012-01-03 18:57:55 +0200: saving data as prepared for: tableOne 1 I
-2012-01-03 18:57:55 +0200: TrackingsQueue.clear!
-2012-01-03 18:57:57 +0200: saving data as prepared for: tableOne 1 I
-2012-01-03 18:57:57 +0200: TableTracking.poll res=0
-2012-01-03 18:57:58 +0200: TableTracking.poll res=1
-2012-01-03 18:57:58 +0200: TableTracking.read_trackings
-2012-01-03 18:57:59 +0200: TableTracking.read_trackings
-2012-01-03 18:58:00 +0200: TableTracking.read_trackings
-2012-01-03 18:58:00 +0200: TableTracking.delete_read_trackings
-2012-01-03 18:58:00 +0200: TableTracking.delete_read_trackings read_ids=1, 2
-2012-01-03 18:58:00 +0200: TableTracking.read_trackings
-2012-01-03 18:58:01 +0200: TrackingsQueue.save_trackings
-2012-01-03 18:58:01 +0200: TrackingsQueue.save_trackings
-2012-01-03 18:58:01 +0200: TrackingsQueue.purge!
-2012-01-03 18:58:01 +0200: TrackingsQueue.save_trackings
-2012-01-03 18:58:01 +0200: TrackingsQueue.clear!
-2012-01-03 18:58:01 +0200: TrackingsQueue.save_trackings
-2012-01-03 18:58:01 +0200: TrackingsQueue.clear!
+# Logfile created on 2012-01-07 17:16:20 +0200 by logger.rb/31641
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:26 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:37 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:37 +0200: Applier.run
+2012-01-07 17:16:37 +0200: sql=INSERT INTO tableTwo (ID, string_prm, integer_prm, date_prm) VALUES (23, 'value', 123, '12/12/2011')
+2012-01-07 17:16:38 +0200: ReceivedDataQueue.clear!
+2012-01-07 17:16:38 +0200: Applier.run
+2012-01-07 17:16:38 +0200: sql=UPDATE tableTwo SET string_prm = 'me me', integer_prm = 321, date_prm = '1/1/2011' WHERE ID = 23
+2012-01-07 17:16:38 +0200: ReceivedDataQueue.clear!
+2012-01-07 17:16:39 +0200: Applier.run
+2012-01-07 17:16:39 +0200: sql=DELETE FROM tableTwo WHERE ID = 23
+2012-01-07 17:16:39 +0200: ReceivedDataQueue.clear!
+2012-01-07 17:16:39 +0200: Applier.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:39 +0200: Applier.run
+2012-01-07 17:16:39 +0200: sql=INSERT INTO tableTwo (ID, string_prm, integer_prm, date_prm) VALUES (23, 'value', 123, '2011-12-12')
+2012-01-07 17:16:39 +0200: ReceivedDataQueue.clear!
+2012-01-07 17:16:40 +0200: Incoming data: 2 for filial: filial
+2012-01-07 17:16:40 +0200: Dispatcher.receive_filial_data incoming_data=[[1, "one", 23, "I", "json_data"], [2, "one", 23, "U", "json_data2"]]
+2012-01-07 17:16:40 +0200: yield received_ids=[1, 2]. Next has to be answer !
+2012-01-07 17:16:40 +0200: got answer=ok
+2012-01-07 17:16:40 +0200: Processing data for filial: filial
+2012-01-07 17:16:40 +0200: == The end of processing received data for filial: filial
+2012-01-07 17:16:40 +0200: ReceivedDataQueue.save
+2012-01-07 17:16:40 +0200: saving received data: twoTable 44 I
+2012-01-07 17:16:40 +0200: ReceivedDataQueue.save
+2012-01-07 17:16:40 +0200: saving received data: oneTable 23 I
+2012-01-07 17:16:40 +0200: saving received data: twoTable 44 I
+2012-01-07 17:16:40 +0200: saving received data: oneTable 23 U
+2012-01-07 17:16:40 +0200: saving received data: twoTable 44 U
+2012-01-07 17:16:40 +0200: saving received data: twoTable 44 U
+2012-01-07 17:16:40 +0200: ReceivedDataQueue.save
+2012-01-07 17:16:40 +0200: saving received data: oneTable 23 I
+2012-01-07 17:16:40 +0200: saving received data: twoTable 44 I
+2012-01-07 17:16:40 +0200: saving received data: oneTable 23 U
+2012-01-07 17:16:40 +0200: ReceivedDataQueue.clear!
+2012-01-07 17:16:40 +0200: ReceivedDataQueue.save
+2012-01-07 17:16:40 +0200: saving received data: twoTable 44 I
+2012-01-07 17:16:40 +0200: Client.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:40 +0200: Client.get_trackings!
+2012-01-07 17:16:40 +0200: Client.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:40 +0200: Client.get_trackings!
+2012-01-07 17:16:40 +0200: Client.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:40 +0200: Client.get_trackings!
+2012-01-07 17:16:40 +0200: Client.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:40 +0200: Client.prepare_tracked_data
+2012-01-07 17:16:40 +0200: Client.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:40 +0200: Client.send_tracked_data
+2012-01-07 17:16:40 +0200: Client begin: remote_object.receive_filial_data
+2012-01-07 17:16:40 +0200: break
+2012-01-07 17:16:40 +0200: == The end of sending data.
+2012-01-07 17:16:40 +0200: Client.new pvsw_alias=TestDB.NET
+2012-01-07 17:16:40 +0200: Client.send_tracked_data
+2012-01-07 17:16:40 +0200: Client begin: remote_object.receive_filial_data
+2012-01-07 17:16:40 +0200: !==> rescue: no connection. Sleep 0
+2012-01-07 17:16:40 +0200: == The end of sending data.
+2012-01-07 17:16:40 +0200: PreparedDataQueue.data_to_send=[[1, "oneTable", 23, "I", "json_data"], [23, "twoTable", 44, "I", "json_data"]]
+2012-01-07 17:16:40 +0200: PreparedDataQueue.remove_sent sent_ids=[1, 23, 45, 246]
+2012-01-07 17:16:40 +0200: PreparedDataQueue.remove_sent sent_ids=[1, 23, 45]
+2012-01-07 17:16:40 +0200: TrackingsQueue.save_trackings
+2012-01-07 17:16:41 +0200: PreparedDataQueue.queue_next_by
+2012-01-07 17:16:41 +0200: saving data as prepared for: tableOne 1 I
+2012-01-07 17:16:41 +0200: TrackingsQueue.clear!
+2012-01-07 17:16:43 +0200: saving data as prepared for: tableOne 1 I
+2012-01-07 17:16:43 +0200: TableTracking.poll res=0
+2012-01-07 17:16:44 +0200: TableTracking.poll res=1
+2012-01-07 17:16:44 +0200: TableTracking.read_trackings
+2012-01-07 17:16:45 +0200: TableTracking.read_trackings
+2012-01-07 17:16:45 +0200: TableTracking.read_trackings
+2012-01-07 17:16:46 +0200: TableTracking.delete_read_trackings
+2012-01-07 17:16:46 +0200: sql: DELETE FROM urDataCh WHERE ID IN(1, 2)
+2012-01-07 17:16:46 +0200: TableTracking.read_trackings
+2012-01-07 17:16:46 +0200: TrackingsQueue.save_trackings
+2012-01-07 17:16:46 +0200: TrackingsQueue.save_trackings
+2012-01-07 17:16:47 +0200: TrackingsQueue.purge!
+2012-01-07 17:16:47 +0200: TrackingsQueue.save_trackings
+2012-01-07 17:16:47 +0200: TrackingsQueue.clear!
+2012-01-07 17:16:47 +0200: TrackingsQueue.save_trackings
+2012-01-07 17:16:47 +0200: TrackingsQueue.clear!
@@ -0,0 +1,2 @@
+C:\Ruby193\bin\ruby.exe ../lib/setup/pvsw_setup.rb drop
+PAUSE
View
@@ -18,6 +18,8 @@ def self.each_run
Spork.prefork do
ENV['TEST'] = 'True'
+ CENTRAL_PREFIX = "test"
+
require "client/client"
require "central/applier"

0 comments on commit 26b3233

Please sign in to comment.