Added missing sql_finalize which is used to cleanup as early as possible the last statement when it is not needed anymore.

This commit is contained in:
2015-10-19 23:33:17 +02:00
parent f51ddc9796
commit 782e9397a3
10 changed files with 50 additions and 10 deletions

View File

@@ -94,6 +94,7 @@ feature -- Persistence
-- sql_change (sql_insert_node_data, l_parameters)
end
end
sql_finalize
end
end
@@ -117,6 +118,7 @@ feature -- Persistence
create l_parameters.make (1)
l_parameters.put (a_node.id, "nid")
sql_modify (sql_delete_node_data, l_parameters)
sql_finalize
end
end

View File

@@ -64,6 +64,7 @@ feature -- Access
end
sql_forth
end
sql_finalize
end
blogs_limited (a_limit: NATURAL_32; a_offset: NATURAL_32): LIST [CMS_NODE]
@@ -90,6 +91,7 @@ feature -- Access
end
sql_forth
end
sql_finalize
end
blogs_from_user_limited (a_user: CMS_USER; a_limit: NATURAL_32; a_offset: NATURAL_32): LIST [CMS_NODE]
@@ -117,6 +119,7 @@ feature -- Access
end
sql_forth
end
sql_finalize
end
feature {NONE} -- Queries

View File

@@ -34,7 +34,6 @@ feature -- Access
sql_finalize
end
nodes: LIST [CMS_NODE]
-- List of nodes.
do
@@ -54,6 +53,7 @@ feature -- Access
end
sql_forth
end
sql_finalize
end
node_revisions (a_node: CMS_NODE): LIST [CMS_NODE]
@@ -81,6 +81,7 @@ feature -- Access
end
sql_forth
end
sql_finalize
end
trashed_nodes (a_user: detachable CMS_USER): LIST [CMS_NODE]
@@ -110,6 +111,7 @@ feature -- Access
end
sql_forth
end
sql_finalize
end
recent_nodes (a_lower: INTEGER; a_count: INTEGER): LIST [CMS_NODE]
@@ -136,6 +138,7 @@ feature -- Access
end
sql_forth
end
sql_finalize
end
recent_node_changes_before (a_lower: INTEGER; a_count: INTEGER; a_date: DATE_TIME): LIST [CMS_NODE]
@@ -164,6 +167,7 @@ feature -- Access
end
sql_forth
end
sql_finalize
end
node_by_id (a_id: INTEGER_64): detachable CMS_NODE
@@ -252,7 +256,7 @@ feature -- Access
end
-- if Result = 0 and not has_error then --| include the case a_node = Void
-- sql_query (Sql_last_insert_node_revision, Void)
-- if sql_rows_count = 1 then
-- if not has_error and not sql_after then
-- if sql_item (1) /= Void then
-- Result := sql_read_integer_64 (1)
-- end
@@ -285,6 +289,7 @@ feature -- Access: outline
end
sql_forth
end
sql_finalize
end
available_parents_for_node (a_node: CMS_NODE): LIST [CMS_NODE]
@@ -310,6 +315,7 @@ feature -- Access: outline
end
sql_forth
end
sql_finalize
end
feature -- Change: Node
@@ -339,6 +345,7 @@ feature -- Change: Node
l_parameters.put ({CMS_NODE_API}.trashed, "status")
l_parameters.put (a_id, "nid")
sql_modify (sql_trash_node, l_parameters)
sql_finalize
end
delete_node_base (a_node: CMS_NODE)
@@ -354,10 +361,12 @@ feature -- Change: Node
create l_parameters.make (1)
l_parameters.put (a_node.id, "nid")
sql_modify (sql_delete_node, l_parameters)
sql_finalize
-- we remove node_revisions and pages.
-- Check: maybe we need a transaction.
sql_modify (sql_delete_node_revisions, l_parameters)
sql_finalize
if not error_handler.has_error then
extended_delete (a_node)
@@ -379,6 +388,7 @@ feature -- Change: Node
l_parameters.put ({CMS_NODE_API}.not_published, "status")
l_parameters.put (a_id, "nid")
sql_modify (sql_restore_node, l_parameters)
sql_finalize
end
@@ -423,6 +433,8 @@ feature {NONE} -- Implementation
l_copy_parameters.force (a_node.id, "nid")
-- l_copy_parameters.force (l_rev - 1, "revision")
sql_insert (sql_copy_node_to_revision, l_copy_parameters)
sql_finalize
if not has_error then
a_node.set_revision (l_rev)
@@ -431,6 +443,7 @@ feature {NONE} -- Implementation
l_parameters.put (a_node.id, "nid")
l_parameters.put (a_node.revision, "revision")
sql_modify (sql_update_node, l_parameters)
sql_finalize
if not error_handler.has_error then
a_node.set_modification_date (now)
@@ -442,6 +455,8 @@ feature {NONE} -- Implementation
l_parameters.put (l_rev, "revision")
sql_insert (sql_insert_node, l_parameters)
sql_finalize
if not error_handler.has_error then
a_node.set_modification_date (now)
a_node.set_id (last_inserted_node_id)

View File

@@ -84,6 +84,7 @@ feature -- Persistence
sql_insert (sql_insert_node_data, l_parameters)
end
end
sql_finalize
end
end
@@ -122,6 +123,7 @@ feature -- Persistence
create l_parameters.make (1)
l_parameters.put (a_node.id, "nid")
sql_modify (sql_delete_node_data, l_parameters)
sql_finalize
end
end
@@ -151,6 +153,7 @@ feature {NONE} -- Implementation
check unique_data: n = 0 end
end
end
sql_finalize
ensure
accepted_revision: Result /= Void implies Result.revision <= a_node.revision
end

View File

@@ -121,6 +121,7 @@ feature {CMS_API} -- Module management
end
l_sql_storage.sql_forth
end
l_sql_storage.sql_finalize
across l_consumers as ic loop
if not l_sql_storage.sql_table_exists (ic.item) then
if attached l_sql_storage.sql_script_content (api.module_resource_location (Current, (create {PATH}.make_from_string ("scripts")).extended ("oauth2_table.sql.tpl"))) as sql then
@@ -131,6 +132,7 @@ feature {CMS_API} -- Module management
end
end
end
l_sql_storage.sql_finalize
Precursor {CMS_MODULE}(api)
end
end

View File

@@ -134,6 +134,7 @@ feature --Access: Consumers
sql_forth
end
end
sql_finalize
end
oauth_consumer_by_name (a_name: READABLE_STRING_8): detachable CMS_OAUTH_20_CONSUMER
@@ -203,6 +204,7 @@ feature -- Change: User OAuth
l_string.replace_substring_all ("$table_name", oauth2_sql_table_name (a_consumer))
sql_insert (l_string, l_parameters)
sql_commit_transaction
sql_finalize
end
update_user_oauth2 (a_token: READABLE_STRING_GENERAL; a_user_profile: READABLE_STRING_32; a_user: CMS_USER; a_consumer: READABLE_STRING_GENERAL )
@@ -224,6 +226,7 @@ feature -- Change: User OAuth
l_string.replace_substring_all ("$table_name", oauth2_sql_table_name (a_consumer))
sql_modify (l_string, l_parameters)
sql_commit_transaction
sql_finalize
end
remove_user_oauth2 (a_user: CMS_USER; a_consumer: READABLE_STRING_GENERAL)
@@ -243,6 +246,7 @@ feature -- Change: User OAuth
l_string.replace_substring_all ("$table_name", oauth2_sql_table_name (a_consumer))
sql_modify (l_string, l_parameters)
sql_commit_transaction
sql_finalize
end
feature {NONE} -- Implementation OAuth Consumer

View File

@@ -64,9 +64,9 @@ feature -- Access User Outh
else
check no_more_than_one: False end
end
sql_finalize
end
feature --Access: Consumers
openid_consumers: LIST [STRING]
@@ -88,6 +88,7 @@ feature --Access: Consumers
sql_forth
end
end
sql_finalize
end
openid_consumer_by_name (a_name: READABLE_STRING_8): detachable CMS_OPENID_CONSUMER
@@ -128,6 +129,7 @@ feature -- Change: User OAuth
l_parameters.put (create {DATE_TIME}.make_now_utc, "utc_date")
sql_insert (Sql_insert_openid, l_parameters)
sql_commit_transaction
sql_finalize
end
feature {NONE} -- Implementation OAuth Consumer