Moved filter of nodes of type blog to the node storage layer.

This is more efficient because the result set from the query will be smaller and it will be easier to implement the pagination
This commit is contained in:
Dario Bösch
2015-05-21 14:06:08 +02:00
parent 6a782e412d
commit 4dd980963a
5 changed files with 51 additions and 44 deletions

View File

@@ -33,7 +33,7 @@ feature -- Access
end
end
nodes_order_created_desc: LIST [CMS_NODE]
blogs: LIST [CMS_NODE]
-- List of nodes ordered by creation date (descending).
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
@@ -42,7 +42,7 @@ feature -- Access
write_information_log (generator + ".nodes")
from
sql_query (sql_select_nodes_order_created_desc, Void)
sql_query (sql_select_blogs_order_created_desc, Void)
sql_start
until
sql_after
@@ -254,8 +254,8 @@ feature {NONE} -- Queries
-- SQL Query to retrieve all nodes.
--| note: {CMS_NODE_API}.trashed = -1
sql_select_nodes_order_created_desc: STRING = "SELECT * FROM Nodes WHERE status != -1 ORDER BY created DESC;"
-- SQL Query to retrieve all nodes order by descending creation date.
sql_select_blogs_order_created_desc: STRING = "SELECT * FROM Nodes WHERE status != -1 AND type = %"blog%" ORDER BY created DESC;"
-- SQL Query to retrieve all nodes that are from the type "blog" ordered by descending creation date.
--| note: {CMS_NODE_API}.trashed = -1
sql_select_node_by_id: STRING = "SELECT nid, revision, type, title, summary, content, format, author, publish, created, changed, status FROM Nodes WHERE nid =:nid ORDER BY revision DESC, publish DESC LIMIT 1;"