Updated design related to logger, to prepare move to SCOOP concurrency.
This commit is contained in:
@@ -20,7 +20,7 @@ feature {NONE} -- Initialization
|
||||
is_connected: a_connection.is_connected
|
||||
do
|
||||
connection := a_connection
|
||||
log.write_information (generator + ".make - is database connected? "+ a_connection.is_connected.out )
|
||||
write_information_log (generator + ".make - is database connected? "+ a_connection.is_connected.out )
|
||||
|
||||
create {DATABASE_HANDLER_IMPL} db_handler.make (a_connection)
|
||||
|
||||
@@ -50,7 +50,7 @@ feature -- Query
|
||||
do
|
||||
error_handler.append (db_handler.database_error_handler)
|
||||
if error_handler.has_error then
|
||||
log.write_critical (generator + ".post_execution " + error_handler.as_string_representation)
|
||||
write_critical_log (generator + ".post_execution " + error_handler.as_string_representation)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ feature -- Initialization
|
||||
rescue
|
||||
create db_control.make
|
||||
-- set_last_error_from_exception ("Connection execution")
|
||||
-- log.write_critical (generator + ".make_common:" + last_error_message)
|
||||
-- write_critical_log (generator + ".make_common:" + last_error_message)
|
||||
if is_connected then
|
||||
disconnect
|
||||
end
|
||||
@@ -73,7 +73,7 @@ feature -- Initialization
|
||||
rescue
|
||||
create db_control.make
|
||||
-- set_last_error_from_exception ("Connection execution")
|
||||
-- log.write_critical (generator + ".make_common:" + last_error_message)
|
||||
-- write_critical_log (generator + ".make_common:" + last_error_message)
|
||||
if is_connected then
|
||||
disconnect
|
||||
end
|
||||
@@ -103,20 +103,20 @@ feature -- Initialization
|
||||
login_with_connection_string (a_string: STRING)
|
||||
-- Login with `a_connection_string'and immediately connect to database.
|
||||
do
|
||||
log.write_debug (generator +".login_with_connection_string")
|
||||
write_debug_log (generator +".login_with_connection_string")
|
||||
create db_application.login_with_connection_string (a_string)
|
||||
create database_error_handler.make
|
||||
db_application.set_base
|
||||
create db_control.make
|
||||
log.write_debug (generator +".login_with_connection_string, is_keep_connection? "+ is_keep_connection.out )
|
||||
write_debug_log (generator +".login_with_connection_string, is_keep_connection? "+ is_keep_connection.out )
|
||||
keep_connection := is_keep_connection
|
||||
if keep_connection then
|
||||
connect
|
||||
if not db_control.is_ok then
|
||||
log.write_critical (generator +".login_with_connection_string:"+ db_control.error_code.out )
|
||||
log.write_critical (generator +".login_with_connection_string:"+ db_control.error_message_32 )
|
||||
write_critical_log (generator +".login_with_connection_string:"+ db_control.error_code.out )
|
||||
write_critical_log (generator +".login_with_connection_string:"+ db_control.error_message_32 )
|
||||
end
|
||||
log.write_debug (generator +".login_with_connection_string, After connect, is_connected? "+ is_connected.out)
|
||||
write_debug_log (generator +".login_with_connection_string, After connect, is_connected? "+ is_connected.out)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ feature -- Error handling
|
||||
do
|
||||
if attached db_change as l_change and then not l_change.is_ok then
|
||||
database_error_handler.add_database_error (l_change.error_message_32, l_change.error_code)
|
||||
log.write_error (generator + ".check_database_change_error: " + l_change.error_message_32)
|
||||
write_error_log (generator + ".check_database_change_error: " + l_change.error_message_32)
|
||||
l_change.reset
|
||||
end
|
||||
end
|
||||
@@ -187,7 +187,7 @@ feature -- Error handling
|
||||
do
|
||||
if attached db_selection as l_selection and then not l_selection.is_ok then
|
||||
database_error_handler.add_database_error (l_selection.error_message_32, l_selection.error_code)
|
||||
log.write_error (generator + ".check_database_selection_error: " + l_selection.error_message_32)
|
||||
write_error_log (generator + ".check_database_selection_error: " + l_selection.error_message_32)
|
||||
l_selection.reset
|
||||
end
|
||||
end
|
||||
|
||||
@@ -44,7 +44,7 @@ feature -- Functionality
|
||||
items := l_store.execute_reader (l_db_selection)
|
||||
check_database_selection_error
|
||||
end
|
||||
log.write_debug ( generator+".execute_reader Successful")
|
||||
write_debug_log ( generator+".execute_reader Successful")
|
||||
end
|
||||
rescue
|
||||
l_retried := True
|
||||
@@ -69,7 +69,7 @@ feature -- Functionality
|
||||
l_store.execute_writer (l_db_change)
|
||||
check_database_change_error
|
||||
end
|
||||
log.write_debug ( generator+".execute_writer Successful")
|
||||
write_debug_log ( generator+".execute_writer Successful")
|
||||
end
|
||||
rescue
|
||||
l_retried := True
|
||||
|
||||
@@ -19,8 +19,8 @@ feature {NONE} -- Intialization
|
||||
data_reader (a_query: STRING; a_parameters: like parameters)
|
||||
-- SQL data reader for the query `a_query' with arguments `a_parameters'
|
||||
do
|
||||
log.write_information (generator + ".data_reader" + " execute query: " + a_query)
|
||||
log.write_debug (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
|
||||
write_information_log (generator + ".data_reader" + " execute query: " + a_query)
|
||||
write_debug_log (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
|
||||
query := a_query
|
||||
parameters := a_parameters
|
||||
ensure
|
||||
@@ -43,7 +43,7 @@ feature -- Execution
|
||||
a_base_selection.load_result
|
||||
Result := a_base_selection.container
|
||||
else
|
||||
log.write_error (generator + "." + a_base_selection.error_message_32)
|
||||
write_error_log (generator + "." + a_base_selection.error_message_32)
|
||||
end
|
||||
unset_map_name (a_base_selection)
|
||||
a_base_selection.terminate
|
||||
|
||||
@@ -20,8 +20,8 @@ feature -- Intialization
|
||||
local
|
||||
l_retried: BOOLEAN
|
||||
do
|
||||
log.write_information (generator + ".data_reader" + " execute store procedure: " + a_sp)
|
||||
log.write_debug (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
|
||||
write_information_log (generator + ".data_reader" + " execute store procedure: " + a_sp)
|
||||
write_debug_log (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
|
||||
if not l_retried then
|
||||
stored_procedure := a_sp
|
||||
parameters := a_parameters
|
||||
@@ -33,14 +33,14 @@ feature -- Intialization
|
||||
if proc.exists then
|
||||
if proc.text_32 /= Void then
|
||||
debug
|
||||
log.write_debug ( generator + ".data_reader: " + proc.text_32)
|
||||
write_debug_log ( generator + ".data_reader: " + proc.text_32)
|
||||
end
|
||||
end
|
||||
else
|
||||
has_error := True
|
||||
error_message := proc.error_message_32
|
||||
error_code := proc.error_code
|
||||
log.write_error (generator + ".data_witer message:" + proc.error_message_32 + " code:" + proc.error_code.out)
|
||||
write_error_log (generator + ".data_witer message:" + proc.error_message_32 + " code:" + proc.error_code.out)
|
||||
end
|
||||
else
|
||||
stored_procedure := a_sp
|
||||
@@ -49,7 +49,7 @@ feature -- Intialization
|
||||
end
|
||||
rescue
|
||||
set_last_error_from_exception ("SQL execution")
|
||||
log.write_critical (generator+ ".data_reader " + last_error_message)
|
||||
write_critical_log (generator+ ".data_reader " + last_error_message)
|
||||
l_retried := True
|
||||
retry
|
||||
end
|
||||
@@ -59,8 +59,8 @@ feature -- Intialization
|
||||
local
|
||||
l_retried: BOOLEAN
|
||||
do
|
||||
log.write_information (generator + ".data_reader" + " execute store procedure: " + a_sp)
|
||||
log.write_debug (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
|
||||
write_information_log (generator + ".data_reader" + " execute store procedure: " + a_sp)
|
||||
write_debug_log (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
|
||||
if not l_retried then
|
||||
stored_procedure := a_sp
|
||||
parameters := a_parameters
|
||||
@@ -70,14 +70,14 @@ feature -- Intialization
|
||||
if proc.exists then
|
||||
if proc.text_32 /= Void then
|
||||
debug
|
||||
log.write_debug ( generator + ".data_writer: " + proc.text_32)
|
||||
write_debug_log ( generator + ".data_writer: " + proc.text_32)
|
||||
end
|
||||
end
|
||||
else
|
||||
has_error := True
|
||||
error_message := proc.error_message_32
|
||||
error_code := proc.error_code
|
||||
log.write_error (generator + ".data_witer message:" + proc.error_message_32 + " code:" + proc.error_code.out)
|
||||
write_error_log (generator + ".data_witer message:" + proc.error_message_32 + " code:" + proc.error_code.out)
|
||||
end
|
||||
else
|
||||
stored_procedure := a_sp
|
||||
@@ -86,12 +86,11 @@ feature -- Intialization
|
||||
end
|
||||
rescue
|
||||
set_last_error_from_exception ("SQL execution")
|
||||
log.write_critical (generator+ ".data_reader " + last_error_message)
|
||||
write_critical_log (generator+ ".data_reader " + last_error_message)
|
||||
l_retried := True
|
||||
retry
|
||||
end
|
||||
|
||||
|
||||
execute_reader (a_base_selection: DB_SELECTION): detachable LIST [DB_RESULT]
|
||||
-- Execute the Current store procedure.
|
||||
do
|
||||
|
||||
Reference in New Issue
Block a user