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

@@ -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