Adapted ROC CMS to concurrent EWF.
Revisited the shared logger to reduced number of useless calls.
This commit is contained in:
@@ -32,6 +32,15 @@ feature -- Status report
|
||||
Result := connection.is_connected
|
||||
end
|
||||
|
||||
feature -- Basic operation
|
||||
|
||||
close
|
||||
-- <Precursor>
|
||||
-- Disconnect from SQL database.
|
||||
do
|
||||
connection.disconnect
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
db_handler: DATABASE_HANDLER
|
||||
|
||||
@@ -29,15 +29,25 @@ feature -- Factory
|
||||
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_SQLITE
|
||||
local
|
||||
s: STRING
|
||||
conn: DATABASE_CONNECTION
|
||||
conn: detachable DATABASE_CONNECTION
|
||||
do
|
||||
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.environment.application_config_path) as l_database_config then
|
||||
if
|
||||
attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.environment.application_config_path) as l_database_config
|
||||
then
|
||||
s := "Driver=SQLite3 ODBC Driver;Database="
|
||||
if attached l_database_config.database_name as db_name then
|
||||
s.append (db_name)
|
||||
end
|
||||
s.append (";LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;")
|
||||
create {DATABASE_CONNECTION_ODBC} conn.login_with_connection_string (s)
|
||||
if attached reuseable_connection.item as d then
|
||||
if s.same_string (d.name) then
|
||||
conn := d.connection
|
||||
end
|
||||
end
|
||||
if conn = Void or else not conn.is_connected then
|
||||
create {DATABASE_CONNECTION_ODBC} conn.login_with_connection_string (s)
|
||||
reuseable_connection.replace ([s, conn])
|
||||
end
|
||||
if conn.is_connected then
|
||||
create Result.make (conn)
|
||||
set_map_zero_null_value (False) --| This way we map 0 to 0, instead of Null as default.
|
||||
@@ -50,4 +60,9 @@ feature -- Factory
|
||||
end
|
||||
end
|
||||
|
||||
reuseable_connection: CELL [detachable TUPLE [name: STRING; connection: DATABASE_CONNECTION]]
|
||||
once
|
||||
create Result.put (Void)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user