Protected cms service from registering many time the same module type.
Moved library/persistence/implementation/* under library/persistence/.
Moved site/www/themes to site/themes
For SQLite storage driver, auto create sqlite db file using associated sql script (to be completed).
Added code in demo module to reuse storage for module purpose.
Always call sql_post_execution in sql_query and sql_change, and not anymore by the callers.
Removed is_web and is_html from {CMS_SETUP}, it was not used.
Reused SHARED_*_ENCODER in CMS_ENCODERS
Added CMS_API.logger rather than using directly the SHARED_LOGGER.log ...
Centralize the implementation of current_user in CMS_REQUEST_UTIL
Removed the inheritance on WSF_FILTER for node handlers, since it is useless and unused.
Added CMS_NODE_API and CMS_USER_API
Prefix html id for block generated html items with "block-", to avoid css name conflict on "main", "content" or similar.
Code cleaning
129 lines
3.5 KiB
Plaintext
129 lines
3.5 KiB
Plaintext
note
|
|
description: "Object that handle a database connection for ODBC"
|
|
date: "$Date: 2014-11-13 12:23:47 -0300 (ju., 13 nov. 2014) $"
|
|
revision: "$Revision: 96085 $"
|
|
|
|
class
|
|
DATABASE_CONNECTION_ODBC
|
|
|
|
inherit
|
|
|
|
DATABASE_CONNECTION
|
|
redefine
|
|
db_application
|
|
end
|
|
|
|
SHARED_LOGGER
|
|
|
|
create
|
|
make, make_common, make_basic, login_with_connection_string
|
|
|
|
feature -- Initialization
|
|
|
|
make_common
|
|
-- Create a database handler for ODBC with common settings.
|
|
local
|
|
l_retried: BOOLEAN
|
|
do
|
|
create db_application.login (username, password)
|
|
create database_error_handler.make
|
|
if not l_retried then
|
|
db_application.set_hostname (hostname)
|
|
db_application.set_data_source (database_name)
|
|
db_application.set_base
|
|
create db_control.make
|
|
keep_connection := is_keep_connection
|
|
if keep_connection then
|
|
connect
|
|
end
|
|
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
|
|
l_retried := True
|
|
retry
|
|
end
|
|
|
|
make_basic (a_database_name: STRING)
|
|
-- Create a database handler and
|
|
-- set database_name to `a_database_name'.
|
|
local
|
|
l_retried: BOOLEAN
|
|
do
|
|
create db_application.login (username, password)
|
|
create database_error_handler.make
|
|
if not l_retried then
|
|
db_application.set_hostname (hostname)
|
|
db_application.set_data_source (a_database_name)
|
|
db_application.set_base
|
|
create db_control.make
|
|
keep_connection := is_keep_connection
|
|
if keep_connection then
|
|
connect
|
|
end
|
|
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
|
|
l_retried := True
|
|
retry
|
|
end
|
|
|
|
make (a_username: STRING; a_password: STRING; a_hostname: STRING; a_database_name: STRING; connection: BOOLEAN)
|
|
|
|
-- Create a database handler for ODBC and set `username' to `a_username',
|
|
-- `password' to `a_password'
|
|
-- `database_name' to `a_database_name'
|
|
-- `connection' to `a_connection'
|
|
do
|
|
create database_error_handler.make
|
|
create db_application.login (a_username, a_password)
|
|
db_application.set_hostname (a_hostname)
|
|
db_application.set_data_source (a_database_name)
|
|
db_application.set_base
|
|
create db_control.make
|
|
keep_connection := connection
|
|
if keep_connection then
|
|
connect
|
|
end
|
|
end
|
|
|
|
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")
|
|
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 )
|
|
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 )
|
|
end
|
|
log.write_debug (generator +".login_with_connection_string, After connect, is_connected? "+ is_connected.out)
|
|
end
|
|
end
|
|
|
|
feature -- Databse Connection
|
|
|
|
db_application: DATABASE_APPL [ODBC]
|
|
-- Database application.
|
|
|
|
end
|