diff --git a/rate-o-mat.pl b/rate-o-mat.pl index 1baabb0..2e9cf08 100755 --- a/rate-o-mat.pl +++ b/rate-o-mat.pl @@ -285,8 +285,7 @@ sub connect_billdbh { FATAL "Error connecting to db: ".$DBI::errstr unless defined($billdbh); $billdbh->do('SET time_zone = ?',undef,$connection_timezone) or FATAL 'error setting connection timezone' if $connection_timezone; - $billdbh->do("SET SESSION binlog_format = 'STATEMENT'") or FATAL 'error setting session binlog_format'; - INFO "Successfully connected to billing db..."; + INFO "Successfully connected to duplication db..."; } @@ -300,7 +299,6 @@ sub connect_acctdbh { FATAL "Error connecting to db: ".$DBI::errstr unless defined($acctdbh); $acctdbh->do('SET time_zone = ?',undef,$connection_timezone) or FATAL 'error setting connection timezone' if $connection_timezone; - $acctdbh->do("SET SESSION binlog_format = 'STATEMENT'") or FATAL 'error setting session binlog_format'; INFO "Successfully connected to accounting db..."; } @@ -321,7 +319,6 @@ sub connect_provdbh { FATAL "Error connecting to db: ".$DBI::errstr unless defined($provdbh); $provdbh->do('SET time_zone = ?',undef,$connection_timezone) or FATAL 'error setting connection timezone' if $connection_timezone; - $provdbh->do("SET SESSION binlog_format = 'STATEMENT'") or FATAL 'error setting session binlog_format'; INFO "Successfully connected to provisioning db..."; } @@ -342,7 +339,6 @@ sub connect_dupdbh { FATAL "Error connecting to db: ".$DBI::errstr unless defined($dupdbh); $dupdbh->do('SET time_zone = ?',undef,$connection_timezone) or FATAL 'error setting connection timezone' if $connection_timezone; - $dupdbh->do("SET SESSION binlog_format = 'STATEMENT'") or FATAL 'error setting session binlog_format'; INFO "Successfully connected to duplication db..."; } @@ -713,13 +709,13 @@ EOS ) or FATAL "Error preparing get contract balance statement: ".$billdbh->errstr; $sth_new_cbalance = $billdbh->prepare( - "INSERT IGNORE INTO billing.contract_balances (". + "INSERT INTO billing.contract_balances (". " contract_id, cash_balance, initial_cash_balance, cash_balance_interval, free_time_balance, initial_free_time_balance, free_time_balance_interval, underrun_profiles, underrun_lock, start, end". ") VALUES (?, ?, ?, ?, ?, ?, ?, IF(? = 0, NULL, FROM_UNIXTIME(?)), IF(? = 0, NULL, FROM_UNIXTIME(?)), FROM_UNIXTIME(?), FROM_UNIXTIME(?))" ) or FATAL "Error preparing create contract balance statement: ".$billdbh->errstr; $sth_new_cbalance_infinite_future = $billdbh->prepare( - "INSERT IGNORE INTO billing.contract_balances (". + "INSERT INTO billing.contract_balances (". " contract_id, cash_balance, initial_cash_balance, cash_balance_interval, free_time_balance, initial_free_time_balance, free_time_balance_interval, underrun_profiles, underrun_lock, start, end". ") VALUES (?, ?, ?, ?, ?, ?, ?, IF(? = 0, NULL, FROM_UNIXTIME(?)), IF(? = 0, NULL, FROM_UNIXTIME(?)), FROM_UNIXTIME(?), '9999-12-31 23:59:59')" ) or FATAL "Error preparing create contract balance statement: ".$billdbh->errstr; @@ -798,7 +794,7 @@ EOS "SELECT id,value FROM provisioning.voip_usr_preferences WHERE attribute_id = ? AND subscriber_id = ?" ) or FATAL "Error preparing get usr preference value statement: ".$provdbh->errstr; $sth_create_usr_preference_value = $provdbh->prepare( - "INSERT IGNORE INTO provisioning.voip_usr_preferences (subscriber_id, attribute_id, value) VALUES (?, ?, ?)" + "INSERT INTO provisioning.voip_usr_preferences (subscriber_id, attribute_id, value) VALUES (?, ?, ?)" ) or FATAL "Error preparing create usr preference value statement: ".$provdbh->errstr; $sth_update_usr_preference_value = $provdbh->prepare( "UPDATE provisioning.voip_usr_preferences SET value = ? WHERE id = ?" @@ -3604,7 +3600,7 @@ sub main { begin_transaction($acctdbh); lock_cdr($cdr); # required to avoid contract_balances duplications during catchup: - begin_transaction($billdbh); #,'READ COMMITTED'); + begin_transaction($billdbh,'READ COMMITTED'); # row locks are released upon commit/rollback and have to cover # the whole transaction. thus locking contract rows for preventing # concurrent catchups will be our very first SQL statement in the