Commit da8d8603 authored by Nigel Kukard's avatar Nigel Kukard

BUGFIX: Fixed issue with AWIT::DB::DBLayer::error/Error

parent 3efb5991
...@@ -355,7 +355,7 @@ sub getUsage ...@@ -355,7 +355,7 @@ sub getUsage
# Fetch data # Fetch data
my $sth = DBSelect(@dbDoParams); my $sth = DBSelect(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Database query failed: %s",AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Database query failed: %s",AWITPT::DB::DBLayer::error());
return; return;
} }
...@@ -463,7 +463,7 @@ sub acct_log ...@@ -463,7 +463,7 @@ sub acct_log
# Fetch previous records of the same session # Fetch previous records of the same session
my $sth = DBSelect(@dbDoParams); my $sth = DBSelect(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Database query failed: %s",AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Database query failed: %s",AWITPT::DB::DBLayer::error());
return; return;
} }
...@@ -555,7 +555,7 @@ sub acct_log ...@@ -555,7 +555,7 @@ sub acct_log
$sth = DBDo(@dbDoParams); $sth = DBDo(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Failed to update accounting ALIVE record: ". $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Failed to update accounting ALIVE record: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
...@@ -584,7 +584,7 @@ sub acct_log ...@@ -584,7 +584,7 @@ sub acct_log
my $sth = DBDo(@dbDoParams); my $sth = DBDo(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Failed to insert accounting START record: ". $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Failed to insert accounting START record: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
# Update first login? # Update first login?
...@@ -611,7 +611,7 @@ sub acct_log ...@@ -611,7 +611,7 @@ sub acct_log
# Update database (status) # Update database (status)
my $sth = DBDo(@dbDoParams); my $sth = DBDo(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Failed to update accounting STOP record: %s",AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Failed to update accounting STOP record: %s",AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
} }
...@@ -633,7 +633,7 @@ sub fixDuplicates ...@@ -633,7 +633,7 @@ sub fixDuplicates
# Select duplicates # Select duplicates
my $sth = DBSelect(@dbDoParams); my $sth = DBSelect(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Database query failed: %s",AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Database query failed: %s",AWITPT::DB::DBLayer::error());
return; return;
} }
...@@ -656,7 +656,7 @@ sub fixDuplicates ...@@ -656,7 +656,7 @@ sub fixDuplicates
# Delete duplicates # Delete duplicates
$sth = DBDo(@dbDoParams); $sth = DBDo(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Database query failed: %s",AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Database query failed: %s",AWITPT::DB::DBLayer::error());
DBRollback(); DBRollback();
return; return;
} }
...@@ -704,7 +704,7 @@ sub cleanup ...@@ -704,7 +704,7 @@ sub cleanup
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Cleanup => Failed to delete accounting summary record: ". $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Cleanup => Failed to delete accounting summary record: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
DBRollback(); DBRollback();
return; return;
} }
...@@ -729,7 +729,7 @@ sub cleanup ...@@ -729,7 +729,7 @@ sub cleanup
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Cleanup => Failed to select accounting record: ". $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Cleanup => Failed to select accounting record: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
return; return;
} }
...@@ -836,7 +836,7 @@ sub cleanup ...@@ -836,7 +836,7 @@ sub cleanup
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Cleanup => Failed to create accounting summary record: ". $server->log(LOG_ERR,"[MOD_ACCOUNTING_SQL] Cleanup => Failed to create accounting summary record: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
DBRollback(); DBRollback();
return; return;
} }
......
...@@ -155,7 +155,7 @@ sub updateUserStats ...@@ -155,7 +155,7 @@ sub updateUserStats
# Perform query # Perform query
my $sth = DBDo(@dbDoParams); my $sth = DBDo(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_FEATURE_UPDATE_USER_STATS_SQL] Database query failed: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"[MOD_FEATURE_UPDATE_USER_STATS_SQL] Database query failed: ".AWITPT::DB::DBLayer::error());
return; return;
} }
......
...@@ -171,7 +171,7 @@ sub getConfig ...@@ -171,7 +171,7 @@ sub getConfig
$server->log(LOG_DEBUG,"Processing DEFAULT realm attributes"); $server->log(LOG_DEBUG,"Processing DEFAULT realm attributes");
my $sth = DBSelect($config->{'get_config_realm_id_query'},$realmName); my $sth = DBSelect($config->{'get_config_realm_id_query'},$realmName);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get default realm ID: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get default realm ID: ".AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
# Set realm ID # Set realm ID
...@@ -186,7 +186,7 @@ sub getConfig ...@@ -186,7 +186,7 @@ sub getConfig
if (defined($realmID)) { if (defined($realmID)) {
$sth = DBSelect($config->{'get_config_realm_attributes_query'},$realmID); $sth = DBSelect($config->{'get_config_realm_attributes_query'},$realmID);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get default realm config attributes: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get default realm config attributes: ".AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
# Add any default realm attributes to config attributes # Add any default realm attributes to config attributes
...@@ -204,7 +204,7 @@ sub getConfig ...@@ -204,7 +204,7 @@ sub getConfig
$sth = DBSelect($config->{'get_config_realm_id_query'},$realmName); $sth = DBSelect($config->{'get_config_realm_id_query'},$realmName);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get realm config attributes: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get realm config attributes: ".AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
# Fetch realm ID # Fetch realm ID
...@@ -216,7 +216,7 @@ sub getConfig ...@@ -216,7 +216,7 @@ sub getConfig
# User realm attributes # User realm attributes
$sth = DBSelect($config->{'get_config_realm_attributes_query'},$realmID); $sth = DBSelect($config->{'get_config_realm_attributes_query'},$realmID);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get realm config attributes: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get realm config attributes: ".AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
# Add any realm attributes to config attributes # Add any realm attributes to config attributes
...@@ -260,7 +260,7 @@ sub getConfig ...@@ -260,7 +260,7 @@ sub getConfig
$sth = DBSelect($config->{'get_config_accesslist_query'},$realmID); $sth = DBSelect($config->{'get_config_accesslist_query'},$realmID);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get config attributes: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get config attributes: ".AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
...@@ -301,7 +301,7 @@ sub getConfig ...@@ -301,7 +301,7 @@ sub getConfig
if (defined($clientID)) { if (defined($clientID)) {
my $sth = DBSelect($config->{'get_config_client_attributes_query'},$clientID); my $sth = DBSelect($config->{'get_config_client_attributes_query'},$clientID);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get default config attributes: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get default config attributes: ".AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
# Add to config attributes # Add to config attributes
......
...@@ -217,7 +217,7 @@ sub getTopups ...@@ -217,7 +217,7 @@ sub getTopups
# Query database # Query database
my $sth = DBSelect($config->{'get_topups_summary_query'},$periodKey,$username); my $sth = DBSelect($config->{'get_topups_summary_query'},$periodKey,$username);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get topup information: %s",AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get topup information: %s",AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
while (my $row = hashifyLCtoMC($sth->fetchrow_hashref(), qw(Balance Type ID))) { while (my $row = hashifyLCtoMC($sth->fetchrow_hashref(), qw(Balance Type ID))) {
...@@ -228,7 +228,7 @@ sub getTopups ...@@ -228,7 +228,7 @@ sub getTopups
# Query database # Query database
$sth = DBSelect($config->{'get_topups_query'},$thisMonth->ymd,$now->ymd,$username); $sth = DBSelect($config->{'get_topups_query'},$thisMonth->ymd,$now->ymd,$username);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get topup information: %s",AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get topup information: %s",AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
# Fetch all new topups # Fetch all new topups
...@@ -286,7 +286,7 @@ sub cleanup ...@@ -286,7 +286,7 @@ sub cleanup
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select users: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select users: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
return; return;
} }
...@@ -315,7 +315,7 @@ sub cleanup ...@@ -315,7 +315,7 @@ sub cleanup
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to delete topup summaries: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to delete topup summaries: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
DBRollback(); DBRollback();
return; return;
} }
...@@ -331,8 +331,7 @@ sub cleanup ...@@ -331,8 +331,7 @@ sub cleanup
SMAdminDepletedOn >= ?', $thisMonth->ymd() SMAdminDepletedOn >= ?', $thisMonth->ymd()
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to undeplete topups: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to undeplete topups: ".AWITPT::DB::DBLayer::error());
AWITPT::DB::DBLayer::Error());
DBRollback(); DBRollback();
return; return;
} }
...@@ -351,7 +350,7 @@ sub cleanup ...@@ -351,7 +350,7 @@ sub cleanup
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to retrieve accounting summaries: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to retrieve accounting summaries: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
DBRollback(); DBRollback();
return; return;
} }
...@@ -378,7 +377,7 @@ sub cleanup ...@@ -378,7 +377,7 @@ sub cleanup
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select accounting summary record: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select accounting summary record: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
goto FAIL_ROLLBACK; goto FAIL_ROLLBACK;
} }
...@@ -428,7 +427,7 @@ sub cleanup ...@@ -428,7 +427,7 @@ sub cleanup
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select group usage caps: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select group usage caps: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
goto FAIL_ROLLBACK; goto FAIL_ROLLBACK;
} }
...@@ -483,7 +482,7 @@ sub cleanup ...@@ -483,7 +482,7 @@ sub cleanup
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select user usage caps: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select user usage caps: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
goto FAIL_ROLLBACK; goto FAIL_ROLLBACK;
} }
...@@ -552,7 +551,7 @@ sub cleanup ...@@ -552,7 +551,7 @@ sub cleanup
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select topup summaries: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select topup summaries: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
goto FAIL_ROLLBACK; goto FAIL_ROLLBACK;
} }
...@@ -622,8 +621,7 @@ sub cleanup ...@@ -622,8 +621,7 @@ sub cleanup
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select topups: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to select topups: ".AWITPT::DB::DBLayer::error());
AWITPT::DB::DBLayer::Error());
goto FAIL_ROLLBACK; goto FAIL_ROLLBACK;
} }
...@@ -1015,7 +1013,7 @@ sub cleanup ...@@ -1015,7 +1013,7 @@ sub cleanup
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to create topup summary: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to create topup summary: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
goto FAIL_ROLLBACK; goto FAIL_ROLLBACK;
} }
...@@ -1042,7 +1040,7 @@ sub cleanup ...@@ -1042,7 +1040,7 @@ sub cleanup
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to deplete topup: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to deplete topup: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
goto FAIL_ROLLBACK; goto FAIL_ROLLBACK;
} }
...@@ -1068,7 +1066,7 @@ sub cleanup ...@@ -1068,7 +1066,7 @@ sub cleanup
); );
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to update topups_summary: ". $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to update topups_summary: ".
AWITPT::DB::DBLayer::Error()); AWITPT::DB::DBLayer::error());
goto FAIL_ROLLBACK; goto FAIL_ROLLBACK;
} }
...@@ -1124,7 +1122,7 @@ sub addTopup ...@@ -1124,7 +1122,7 @@ sub addTopup
# Insert into database # Insert into database
my $sth = DBDo(@dbDoParams); my $sth = DBDo(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Failed to insert topup record: %s",AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Failed to insert topup record: %s",AWITPT::DB::DBLayer::error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
......
...@@ -139,7 +139,7 @@ sub find ...@@ -139,7 +139,7 @@ sub find
my $sth = DBSelect(@dbDoParams); my $sth = DBSelect(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_USERDB_MACAUTH_SQL] Failed to find data for MAC address: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"[MOD_USERDB_MACAUTH_SQL] Failed to find data for MAC address: ".AWITPT::DB::DBLayer::error());
return MOD_RES_SKIP; return MOD_RES_SKIP;
} }
......
...@@ -273,7 +273,7 @@ sub find ...@@ -273,7 +273,7 @@ sub find
my $sth = DBSelect(@dbDoParams); my $sth = DBSelect(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"[MOD_USERDB_SQL] Failed to find user data: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"[MOD_USERDB_SQL] Failed to find user data: ".AWITPT::DB::DBLayer::error());
return MOD_RES_SKIP; return MOD_RES_SKIP;
} }
...@@ -338,7 +338,7 @@ sub get ...@@ -338,7 +338,7 @@ sub get
# Query database # Query database
my $sth = DBSelect(@dbDoParams); my $sth = DBSelect(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get group attributes: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get group attributes: ".AWITPT::DB::DBLayer::error());
return RES_ERROR; return RES_ERROR;
} }
...@@ -356,7 +356,7 @@ sub get ...@@ -356,7 +356,7 @@ sub get
# Query database # Query database
$sth = DBSelect(@dbDoParams); $sth = DBSelect(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get user attributes: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get user attributes: ".AWITPT::DB::DBLayer::error());
return RES_ERROR; return RES_ERROR;
} }
...@@ -409,7 +409,7 @@ sub data_set ...@@ -409,7 +409,7 @@ sub data_set
# Query database # Query database
my $sth = DBDo(@dbDoParams); my $sth = DBDo(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to update users data: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to update users data: ".AWITPT::DB::DBLayer::error());
return RES_ERROR; return RES_ERROR;
} }
...@@ -420,7 +420,7 @@ sub data_set ...@@ -420,7 +420,7 @@ sub data_set
# Insert # Insert
$sth = DBDo(@dbDoParams); $sth = DBDo(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to set users data: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to set users data: ".AWITPT::DB::DBLayer::error());
return RES_ERROR; return RES_ERROR;
} }
} }
...@@ -494,7 +494,7 @@ sub data_get ...@@ -494,7 +494,7 @@ sub data_get
# Query database # Query database
my $sth = DBSelect(@dbDoParams); my $sth = DBSelect(@dbDoParams);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get users data: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get users data: ".AWITPT::DB::DBLayer::error());
return RES_ERROR; return RES_ERROR;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment