Initial Import: Database transaction handling.
Initial Import: Error handling using ewf error library. Added a CMS_ERROR_FILTER as part of registered filters of CMS_SERVICE
This commit is contained in:
@@ -21,6 +21,7 @@ feature {NONE} -- Initialization
|
||||
require
|
||||
is_connected: a_connection.is_connected
|
||||
do
|
||||
connection := a_connection
|
||||
log.write_information (generator+".make_with_database is database connected? "+ a_connection.is_connected.out )
|
||||
create node_provider.make (a_connection)
|
||||
create user_provider.make (a_connection)
|
||||
@@ -125,11 +126,14 @@ feature -- Change: user
|
||||
save_user (a_user: CMS_USER)
|
||||
-- Add a new user `a_user'.
|
||||
do
|
||||
|
||||
if
|
||||
attached a_user.password as l_password and then
|
||||
attached a_user.email as l_email
|
||||
then
|
||||
connection.begin_transaction
|
||||
user_provider.new_user (a_user.name, l_password, l_email)
|
||||
connection.commit
|
||||
else
|
||||
set_last_error ("User or Password not attached", generator + ".save_user")
|
||||
end
|
||||
@@ -282,4 +286,6 @@ feature {NONE} -- Post process
|
||||
user_provider: USER_DATA_PROVIDER
|
||||
-- User Data provider.
|
||||
|
||||
connection: DATABASE_CONNECTION
|
||||
-- Current database connection.
|
||||
end
|
||||
|
||||
@@ -34,17 +34,11 @@ feature -- Initialization
|
||||
if keep_connection then
|
||||
connect
|
||||
end
|
||||
set_successful
|
||||
else
|
||||
create db_control.make
|
||||
end
|
||||
rescue
|
||||
create db_control.make
|
||||
set_last_error_from_exception ("Connection execution")
|
||||
log.write_critical (generator + ".make_common:" + last_error_message)
|
||||
if is_connected then
|
||||
disconnect
|
||||
end
|
||||
exception_as_error ((create {EXCEPTION_MANAGER}).last_exception)
|
||||
l_retried := True
|
||||
retry
|
||||
end
|
||||
@@ -66,17 +60,11 @@ feature -- Initialization
|
||||
if keep_connection then
|
||||
connect
|
||||
end
|
||||
set_successful
|
||||
else
|
||||
create db_control.make
|
||||
end
|
||||
rescue
|
||||
create db_control.make
|
||||
set_last_error_from_exception ("Connection execution")
|
||||
log.write_critical (generator + ".make_common:" + last_error_message)
|
||||
if is_connected then
|
||||
disconnect
|
||||
end
|
||||
exception_as_error ((create {EXCEPTION_MANAGER}).last_exception)
|
||||
l_retried := True
|
||||
retry
|
||||
end
|
||||
|
||||
@@ -34,7 +34,6 @@ feature -- Status Report
|
||||
is_successful: BOOLEAN
|
||||
-- Is the last execution sucessful?
|
||||
do
|
||||
Result := db_handler.successful
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
@@ -481,13 +480,6 @@ feature {NONE} -- Implementation
|
||||
post_execution
|
||||
-- Post database execution.
|
||||
do
|
||||
if db_handler.successful then
|
||||
set_successful
|
||||
else
|
||||
if attached db_handler.last_error then
|
||||
set_last_error_from_handler (db_handler.last_error)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ feature -- Status Report
|
||||
is_successful: BOOLEAN
|
||||
-- Is the last execution sucessful?
|
||||
do
|
||||
Result := db_handler.successful
|
||||
-- Result := db_handler.successful
|
||||
end
|
||||
|
||||
has_roles: BOOLEAN
|
||||
@@ -210,13 +210,7 @@ feature {NONE} -- Implementation
|
||||
post_execution
|
||||
-- Post database execution.
|
||||
do
|
||||
if db_handler.successful then
|
||||
set_successful
|
||||
else
|
||||
if attached db_handler.last_error then
|
||||
set_last_error_from_handler (db_handler.last_error)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -34,7 +34,6 @@ feature -- Status Report
|
||||
is_successful: BOOLEAN
|
||||
-- Is the last execution sucessful?
|
||||
do
|
||||
Result := db_handler.successful
|
||||
end
|
||||
|
||||
has_user: BOOLEAN
|
||||
@@ -311,13 +310,6 @@ feature {NONE} -- Implementation
|
||||
post_execution
|
||||
-- Post database execution.
|
||||
do
|
||||
if db_handler.successful then
|
||||
set_successful
|
||||
else
|
||||
if attached db_handler.last_error then
|
||||
set_last_error_from_handler (db_handler.last_error)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -24,6 +24,7 @@ feature
|
||||
do
|
||||
create l_parameters.make (0)
|
||||
|
||||
a_connection.begin_transaction
|
||||
|
||||
-- Clean Profiles
|
||||
db_handler(a_connection).set_query (create {DATABASE_QUERY}.data_reader (Sql_delete_user_profiles, l_parameters))
|
||||
@@ -72,6 +73,7 @@ feature
|
||||
db_handler(a_connection).set_query (create {DATABASE_QUERY}.data_reader (Rest_profiles_autoincrement, l_parameters))
|
||||
db_handler(a_connection).execute_change
|
||||
|
||||
a_connection.commit
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user