Added weight into to the CMS_LINK and provide a `sort' feature for CMS_MENU and related.
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
This commit is contained in:
@@ -1,112 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_STORAGE_MYSQL}."
|
||||
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
|
||||
revision: "$Revision: 96542 $"
|
||||
|
||||
class
|
||||
CMS_STORAGE_MYSQL
|
||||
|
||||
inherit
|
||||
CMS_STORAGE
|
||||
|
||||
CMS_STORAGE_STORE_SQL
|
||||
|
||||
CMS_USER_STORAGE_MYSQL
|
||||
|
||||
CMS_NODE_STORAGE_MYSQL
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
--feature {NONE} -- Initialization
|
||||
|
||||
-- make (a_connection: DATABASE_CONNECTION)
|
||||
-- --
|
||||
-- require
|
||||
-- is_connected: a_connection.is_connected
|
||||
-- do
|
||||
-- connection := a_connection
|
||||
-- log.write_information (generator + ".make - is database connected? "+ a_connection.is_connected.out )
|
||||
|
||||
-- create {DATABASE_HANDLER_IMPL} db_handler.make (a_connection)
|
||||
|
||||
-- create error_handler.make
|
||||
---- error_handler.add_synchronization (db_handler.database_error_handler)
|
||||
-- end
|
||||
|
||||
-- db_handler: DATABASE_HANDLER
|
||||
|
||||
-- connection: DATABASE_CONNECTION
|
||||
-- -- Current database connection.
|
||||
|
||||
--feature -- Query
|
||||
|
||||
-- sql_post_execution
|
||||
-- -- Post database execution.
|
||||
-- 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)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- sql_begin_transaction
|
||||
-- do
|
||||
-- connection.begin_transaction
|
||||
-- end
|
||||
|
||||
-- sql_commit_transaction
|
||||
-- do
|
||||
-- connection.commit
|
||||
-- end
|
||||
|
||||
-- sql_query (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
|
||||
-- do
|
||||
-- check_sql_query_validity (a_sql_statement, a_params)
|
||||
-- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
|
||||
-- db_handler.execute_query
|
||||
-- end
|
||||
|
||||
-- sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
|
||||
-- do
|
||||
-- check_sql_query_validity (a_sql_statement, a_params)
|
||||
-- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
|
||||
-- db_handler.execute_change
|
||||
-- end
|
||||
|
||||
-- sql_rows_count: INTEGER
|
||||
-- -- Number of rows for last sql execution.
|
||||
-- do
|
||||
-- Result := db_handler.count
|
||||
-- end
|
||||
|
||||
-- sql_start
|
||||
-- -- Set the cursor on first element.
|
||||
-- do
|
||||
-- db_handler.start
|
||||
-- end
|
||||
|
||||
-- sql_after: BOOLEAN
|
||||
-- -- Are there no more items to iterate over?
|
||||
-- do
|
||||
-- Result := db_handler.after
|
||||
-- end
|
||||
|
||||
-- sql_forth
|
||||
-- -- Fetch next row from last sql execution, if any.
|
||||
-- do
|
||||
-- db_handler.forth
|
||||
-- end
|
||||
|
||||
-- sql_item (a_index: INTEGER): detachable ANY
|
||||
-- do
|
||||
-- if attached {DB_TUPLE} db_handler.item as l_item and then l_item.count >= a_index then
|
||||
-- Result := l_item.item (a_index)
|
||||
-- else
|
||||
-- check has_item_at_index: False end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
end
|
||||
@@ -1,112 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_STORAGE_MYSQL}."
|
||||
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
|
||||
revision: "$Revision: 96542 $"
|
||||
|
||||
class
|
||||
CMS_STORAGE_SQLITE
|
||||
|
||||
inherit
|
||||
CMS_STORAGE
|
||||
|
||||
CMS_STORAGE_STORE_SQL
|
||||
|
||||
CMS_USER_STORAGE_SQLITE
|
||||
|
||||
CMS_NODE_STORAGE_SQLITE
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
--feature {NONE} -- Initialization
|
||||
|
||||
-- make (a_connection: DATABASE_CONNECTION)
|
||||
-- --
|
||||
-- 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 {DATABASE_HANDLER_IMPL} db_handler.make (a_connection)
|
||||
|
||||
-- create error_handler.make
|
||||
---- error_handler.add_synchronization (db_handler.database_error_handler)
|
||||
-- end
|
||||
|
||||
-- db_handler: DATABASE_HANDLER
|
||||
|
||||
-- connection: DATABASE_CONNECTION
|
||||
-- -- Current database connection.
|
||||
|
||||
--feature -- Access: user
|
||||
|
||||
-- sql_post_execution
|
||||
-- -- Post database execution.
|
||||
-- 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)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- sql_begin_transaction
|
||||
-- do
|
||||
-- connection.begin_transaction
|
||||
-- end
|
||||
|
||||
-- sql_commit_transaction
|
||||
-- do
|
||||
-- connection.commit
|
||||
-- end
|
||||
|
||||
-- sql_query (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
|
||||
-- do
|
||||
-- check_sql_query_validity (a_sql_statement, a_params)
|
||||
-- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
|
||||
-- db_handler.execute_query
|
||||
-- end
|
||||
|
||||
-- sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
|
||||
-- do
|
||||
-- check_sql_query_validity (a_sql_statement, a_params)
|
||||
-- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
|
||||
-- db_handler.execute_change
|
||||
-- end
|
||||
|
||||
-- sql_rows_count: INTEGER
|
||||
-- -- Number of rows for last sql execution.
|
||||
-- do
|
||||
-- Result := db_handler.count
|
||||
-- end
|
||||
|
||||
-- sql_start
|
||||
-- -- Set the cursor on first element.
|
||||
-- do
|
||||
-- db_handler.start
|
||||
-- end
|
||||
|
||||
-- sql_after: BOOLEAN
|
||||
-- -- Are there no more items to iterate over?
|
||||
-- do
|
||||
-- Result := db_handler.after
|
||||
-- end
|
||||
|
||||
-- sql_forth
|
||||
-- -- Fetch next row from last sql execution, if any.
|
||||
-- do
|
||||
-- db_handler.forth
|
||||
-- end
|
||||
|
||||
-- sql_item (a_index: INTEGER): detachable ANY
|
||||
-- do
|
||||
-- if attached {DB_TUPLE} db_handler.item as l_item and then l_item.count >= a_index then
|
||||
-- Result := l_item.item (a_index)
|
||||
-- else
|
||||
-- check has_item_at_index: False end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
end
|
||||
@@ -1,43 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Objects that ...
|
||||
]"
|
||||
author: "$Author: jfiat $"
|
||||
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
|
||||
revision: "$Revision: 96542 $"
|
||||
|
||||
class
|
||||
CMS_STORAGE_SQLITE_BUILDER
|
||||
|
||||
inherit
|
||||
CMS_STORAGE_BUILDER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Factory
|
||||
|
||||
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_SQLITE
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.layout.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 Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (s))
|
||||
--create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (l_database_config.connection_string))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,8 +1,8 @@
|
||||
note
|
||||
description: "Summary description for {CMS_STORAGE_STORE_SQL}."
|
||||
author: ""
|
||||
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
|
||||
revision: "$Revision: 96542 $"
|
||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
deferred class
|
||||
CMS_STORAGE_STORE_SQL
|
||||
@@ -28,6 +28,14 @@ feature {NONE} -- Initialization
|
||||
-- error_handler.add_synchronization (db_handler.database_error_handler)
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_available: BOOLEAN
|
||||
-- Is storage available?
|
||||
do
|
||||
Result := connection.is_connected
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
db_handler: DATABASE_HANDLER
|
||||
@@ -66,6 +74,7 @@ feature -- Query
|
||||
check_sql_query_validity (a_sql_statement, a_params)
|
||||
db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
|
||||
db_handler.execute_query
|
||||
sql_post_execution
|
||||
end
|
||||
|
||||
sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
|
||||
@@ -73,6 +82,7 @@ feature -- Query
|
||||
check_sql_query_validity (a_sql_statement, a_params)
|
||||
db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
|
||||
db_handler.execute_change
|
||||
sql_post_execution
|
||||
end
|
||||
|
||||
sql_rows_count: INTEGER
|
||||
@@ -7,19 +7,19 @@
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="cms" location="..\..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\..\..\layout\layout-safe.ecf"/>
|
||||
<library name="layout" location="..\..\layout\layout-safe.ecf"/>
|
||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
||||
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
|
||||
<library name="model" location="..\..\model\cms_model-safe.ecf"/>
|
||||
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>
|
||||
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/>
|
||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<cluster name="common" location="..\common\" recursive="true">
|
||||
<cluster name="common" location="..\implementation\store\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/database/database_connection_odbc.e</exclude>
|
||||
</file_rule>
|
||||
@@ -7,19 +7,19 @@
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="cms" location="..\..\..\..\cms.ecf" readonly="false"/>
|
||||
<library name="cms" location="..\..\..\cms.ecf" readonly="false"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\..\..\layout\layout.ecf"/>
|
||||
<library name="layout" location="..\..\layout\layout.ecf"/>
|
||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
|
||||
<library name="model" location="..\..\..\model\cms_model.ecf"/>
|
||||
<library name="model" location="..\..\model\cms_model.ecf"/>
|
||||
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql.ecf"/>
|
||||
<library name="store" location="$ISE_LIBRARY\library\store\store.ecf" readonly="false"/>
|
||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<cluster name="common" location="..\common\" recursive="true">
|
||||
<cluster name="common" location="..\implementation\store\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/database/database_connection_odbc.e</exclude>
|
||||
</file_rule>
|
||||
31
library/persistence/mysql/src/cms_storage_mysql.e
Normal file
31
library/persistence/mysql/src/cms_storage_mysql.e
Normal file
@@ -0,0 +1,31 @@
|
||||
note
|
||||
description: "Summary description for {CMS_STORAGE_MYSQL}."
|
||||
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
|
||||
revision: "$Revision: 96596 $"
|
||||
|
||||
class
|
||||
CMS_STORAGE_MYSQL
|
||||
|
||||
inherit
|
||||
CMS_STORAGE
|
||||
|
||||
CMS_STORAGE_STORE_SQL
|
||||
|
||||
CMS_USER_STORAGE_MYSQL
|
||||
|
||||
CMS_NODE_STORAGE_MYSQL
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_initialized: BOOLEAN
|
||||
-- Is storage initialized?
|
||||
do
|
||||
Result := has_user
|
||||
end
|
||||
|
||||
end
|
||||
100
library/persistence/mysql/tests/roles/role_test_set.e-
Normal file
100
library/persistence/mysql/tests/roles/role_test_set.e-
Normal file
@@ -0,0 +1,100 @@
|
||||
note
|
||||
description: "Summary description for {ROLE_TEST_SET}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
ROLE_TEST_SET
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
redefine
|
||||
on_prepare,
|
||||
on_clean
|
||||
select
|
||||
default_create
|
||||
end
|
||||
ABSTRACT_DB_TEST
|
||||
rename
|
||||
default_create as default_db_test
|
||||
end
|
||||
|
||||
|
||||
feature {NONE} -- Events
|
||||
|
||||
on_prepare
|
||||
-- <Precursor>
|
||||
do
|
||||
(create {CLEAN_DB}).clean_db(connection)
|
||||
end
|
||||
|
||||
on_clean
|
||||
-- <Precursor>
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Test routines
|
||||
|
||||
test_roles_empty
|
||||
do
|
||||
assert ("Not elements",role_provider.roles.after)
|
||||
assert ("Count = 0", role_provider.count = 0)
|
||||
end
|
||||
|
||||
test_roles_by_id_not_exist
|
||||
do
|
||||
assert ("Void", role_provider.role (1) = Void)
|
||||
end
|
||||
|
||||
test_roles_by_name_not_exist
|
||||
do
|
||||
assert ("Void", role_provider.role_by_name ("admin") = Void)
|
||||
end
|
||||
|
||||
test_new_role
|
||||
do
|
||||
assert ("Count = 0", role_provider.count = 0)
|
||||
role_provider.new_role ("admin")
|
||||
assert ("Count = 1", role_provider.count = 1)
|
||||
assert ("Expected role", attached role_provider.role (1) as l_role and then l_role.name ~ "admin")
|
||||
assert ("Expected role", attached role_provider.role_by_name ("admin") as l_role and then l_role.id = 1)
|
||||
end
|
||||
|
||||
test_permissions_empty_not_exist_role
|
||||
do
|
||||
assert ("Not elements",role_provider.permission_by_role (1).after)
|
||||
end
|
||||
|
||||
test_permissions_empty_exist_role
|
||||
do
|
||||
assert ("Count = 0", role_provider.count = 0)
|
||||
role_provider.new_role ("admin")
|
||||
assert ("Count = 1", role_provider.count = 1)
|
||||
assert ("Exist role",not role_provider.roles.after)
|
||||
assert ("Not permission by role 1 elements",role_provider.permission_by_role (1).after)
|
||||
end
|
||||
|
||||
test_new_role_with_permissions
|
||||
do
|
||||
assert ("Count = 0", role_provider.count = 0)
|
||||
role_provider.new_role ("admin")
|
||||
role_provider.save_role_permission (1, "Create Page")
|
||||
role_provider.save_role_permission (1, "Edit Page")
|
||||
role_provider.save_role_permission (1, "Delete Page")
|
||||
assert ("Count = 1", role_provider.count = 1)
|
||||
assert ("Exist role",not role_provider.roles.after)
|
||||
assert ("Exist role permissions",not role_provider.permission_by_role (1).after)
|
||||
assert ("Not Exist role permissions, for id 2",role_provider.permission_by_role (2).after)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
role_provider: ROLE_DATA_PROVIDER
|
||||
-- role provider.
|
||||
once
|
||||
create Result.make (connection)
|
||||
end
|
||||
end
|
||||
@@ -7,9 +7,9 @@
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\..\..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="cms" location="..\..\..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||
<library name="model" location="..\..\..\..\model\cms_model-safe.ecf"/>
|
||||
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
|
||||
<library name="persitence_mysql" location="..\persistence_mysql-safe.ecf" readonly="false"/>
|
||||
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||
@@ -7,19 +7,19 @@
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\..\..\cms-safe.ecf"/>
|
||||
<library name="cms" location="..\..\..\cms-safe.ecf"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\..\..\layout\layout-safe.ecf"/>
|
||||
<library name="layout" location="..\..\layout\layout-safe.ecf"/>
|
||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
||||
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
|
||||
<library name="model" location="..\..\model\cms_model-safe.ecf"/>
|
||||
<library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc-safe.ecf"/>
|
||||
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/>
|
||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<cluster name="common" location="..\common\" recursive="true"/>
|
||||
<cluster name="common" location="..\implementation\store\" recursive="true"/>
|
||||
<cluster name="persistence_sqlite" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
@@ -7,19 +7,19 @@
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="cms" location="..\..\..\..\cms.ecf"/>
|
||||
<library name="cms" location="..\..\..\cms.ecf"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\..\..\layout\layout.ecf"/>
|
||||
<library name="layout" location="..\..\layout\layout.ecf"/>
|
||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
|
||||
<library name="model" location="..\..\..\model\cms_model.ecf"/>
|
||||
<library name="model" location="..\..\model\cms_model.ecf"/>
|
||||
<library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc.ecf"/>
|
||||
<library name="store" location="$ISE_LIBRARY\library\store\store.ecf" readonly="false"/>
|
||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<cluster name="common" location="..\common\" recursive="true"/>
|
||||
<cluster name="common" location="..\implementation\store\" recursive="true"/>
|
||||
<cluster name="persistence_sqlite" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
@@ -1,8 +1,8 @@
|
||||
note
|
||||
description: "Summary description for {CMS_NODE_STORAGE_SQLITE}."
|
||||
author: ""
|
||||
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
|
||||
revision: "$Revision: 96542 $"
|
||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
deferred class
|
||||
CMS_NODE_STORAGE_SQLITE
|
||||
@@ -50,7 +50,6 @@ feature -- Access: iterator
|
||||
log.write_information (generator + ".nodes_iterator")
|
||||
create l_parameters.make (0)
|
||||
sql_query (select_nodes, l_parameters)
|
||||
sql_post_execution
|
||||
create Result.make (db_handler, agent fetch_node)
|
||||
end
|
||||
|
||||
@@ -69,7 +68,6 @@ feature -- Access: iterator
|
||||
create l_query.make_from_string (select_recent_nodes)
|
||||
sql_query (l_query, l_parameters)
|
||||
create Result.make (db_handler, agent fetch_node)
|
||||
sql_post_execution
|
||||
end
|
||||
|
||||
end
|
||||
31
library/persistence/sqlite/src/cms_storage_sqlite.e
Normal file
31
library/persistence/sqlite/src/cms_storage_sqlite.e
Normal file
@@ -0,0 +1,31 @@
|
||||
note
|
||||
description: "Summary description for {CMS_STORAGE_MYSQL}."
|
||||
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
|
||||
revision: "$Revision: 96596 $"
|
||||
|
||||
class
|
||||
CMS_STORAGE_SQLITE
|
||||
|
||||
inherit
|
||||
CMS_STORAGE
|
||||
|
||||
CMS_STORAGE_STORE_SQL
|
||||
|
||||
CMS_USER_STORAGE_SQLITE
|
||||
|
||||
CMS_NODE_STORAGE_SQLITE
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_initialized: BOOLEAN
|
||||
-- Is storage initialized?
|
||||
do
|
||||
Result := has_user
|
||||
end
|
||||
|
||||
end
|
||||
91
library/persistence/sqlite/src/cms_storage_sqlite_builder.e
Normal file
91
library/persistence/sqlite/src/cms_storage_sqlite_builder.e
Normal file
@@ -0,0 +1,91 @@
|
||||
note
|
||||
description: "[
|
||||
Objects that ...
|
||||
]"
|
||||
author: "$Author: jfiat $"
|
||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
class
|
||||
CMS_STORAGE_SQLITE_BUILDER
|
||||
|
||||
inherit
|
||||
CMS_STORAGE_BUILDER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Factory
|
||||
|
||||
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_SQLITE
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.layout.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 Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (s))
|
||||
--create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (l_database_config.connection_string))
|
||||
if Result.is_available then
|
||||
if not Result.is_initialized then
|
||||
initialize (a_setup, Result)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
initialize (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_STORE_SQL)
|
||||
do
|
||||
initialize_schema (a_setup, a_storage)
|
||||
initialize_data (a_setup, a_storage)
|
||||
end
|
||||
|
||||
initialize_schema (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_STORE_SQL)
|
||||
local
|
||||
p: PATH
|
||||
f: PLAIN_TEXT_FILE
|
||||
sql: STRING
|
||||
do
|
||||
p := a_setup.layout.path.extended ("scripts").extended ("sqlite.sql")
|
||||
create f.make_with_path (p)
|
||||
if f.exists and then f.is_access_readable then
|
||||
create sql.make (f.count)
|
||||
f.open_read
|
||||
from
|
||||
f.start
|
||||
until
|
||||
f.exhausted or f.end_of_file
|
||||
loop
|
||||
f.read_stream_thread_aware (1_024)
|
||||
sql.append (f.last_string)
|
||||
end
|
||||
f.close
|
||||
a_storage.error_handler.reset
|
||||
-- a_storage.sql_begin_transaction
|
||||
a_storage.sql_change (sql, Void)
|
||||
-- a_storage.sql_commit_transaction
|
||||
end
|
||||
end
|
||||
|
||||
initialize_data (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_STORE_SQL)
|
||||
local
|
||||
u: CMS_USER
|
||||
do
|
||||
create u.make ("admin")
|
||||
u.set_password ("#admin#")
|
||||
u.set_email (a_setup.site_email)
|
||||
a_storage.new_user (u)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
Binary file not shown.
@@ -7,9 +7,9 @@
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\..\..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="cms" location="..\..\..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||
<library name="model" location="..\..\..\..\model\cms_model-safe.ecf"/>
|
||||
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
|
||||
<library name="persitence_sqlite" location="..\persistence_sqlite-safe.ecf" readonly="false"/>
|
||||
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||
Reference in New Issue
Block a user