In SQL statement use the same case for table names, i.e all lowercase.

Otherwise on Linux+MySQL queries may fail.
This commit is contained in:
2015-07-10 12:58:05 +02:00
parent 5477bab83c
commit 779064a505
4 changed files with 20 additions and 21 deletions

View File

@@ -119,21 +119,21 @@ feature -- Access
feature {NONE} -- Queries feature {NONE} -- Queries
sql_select_blog_count: STRING = "SELECT count(*) FROM Nodes WHERE status != -1 AND type = %"blog%";" sql_select_blog_count: STRING = "SELECT count(*) FROM nodes WHERE status != -1 AND type = %"blog%";"
-- Nodes count (Published and not Published) -- Nodes count (Published and not Published)
--| note: {CMS_NODE_API}.trashed = -1 --| note: {CMS_NODE_API}.trashed = -1
sql_select_blog_count_from_user: STRING = "SELECT count(*) FROM Nodes WHERE status != -1 AND type = %"blog%" AND author = :user ;" sql_select_blog_count_from_user: STRING = "SELECT count(*) FROM nodes WHERE status != -1 AND type = %"blog%" AND author = :user ;"
-- Nodes count (Published and not Published) -- Nodes count (Published and not Published)
--| note: {CMS_NODE_API}.trashed = -1 --| note: {CMS_NODE_API}.trashed = -1
sql_select_blogs_order_created_desc: STRING = "SELECT * FROM Nodes WHERE status != -1 AND type = %"blog%" ORDER BY created DESC;" 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. -- SQL Query to retrieve all nodes that are from the type "blog" ordered by descending creation date.
sql_blogs_limited: STRING = "SELECT * FROM Nodes WHERE status != -1 AND type = %"blog%" ORDER BY created DESC LIMIT :limit OFFSET :offset ;" sql_blogs_limited: STRING = "SELECT * FROM nodes WHERE status != -1 AND type = %"blog%" ORDER BY created DESC LIMIT :limit OFFSET :offset ;"
--- SQL Query to retrieve all node of type "blog" limited by limit and starting at offset --- SQL Query to retrieve all node of type "blog" limited by limit and starting at offset
sql_blogs_from_user_limited: STRING = "SELECT * FROM Nodes WHERE status != -1 AND type = %"blog%" AND author = :user ORDER BY created DESC LIMIT :limit OFFSET :offset ;" sql_blogs_from_user_limited: STRING = "SELECT * FROM nodes WHERE status != -1 AND type = %"blog%" AND author = :user ORDER BY created DESC LIMIT :limit OFFSET :offset ;"
--- SQL Query to retrieve all node of type "blog" from author with id limited by limit + offset --- SQL Query to retrieve all node of type "blog" from author with id limited by limit + offset

View File

@@ -291,25 +291,25 @@ feature -- Helpers
feature {NONE} -- Queries feature {NONE} -- Queries
sql_select_nodes_count: STRING = "SELECT count(*) FROM Nodes WHERE status != -1 ;" sql_select_nodes_count: STRING = "SELECT count(*) FROM nodes WHERE status != -1 ;"
-- Nodes count (Published and not Published) -- Nodes count (Published and not Published)
--| note: {CMS_NODE_API}.trashed = -1 --| note: {CMS_NODE_API}.trashed = -1
sql_select_nodes: STRING = "SELECT * FROM Nodes WHERE status != -1 ;" sql_select_nodes: STRING = "SELECT * FROM nodes WHERE status != -1 ;"
-- SQL Query to retrieve all nodes. -- SQL Query to retrieve all nodes.
--| note: {CMS_NODE_API}.trashed = -1 --| note: {CMS_NODE_API}.trashed = -1
sql_select_trash_nodes: STRING = "SELECT * FROM Nodes WHERE status = -1 ;" sql_select_trash_nodes: STRING = "SELECT * FROM nodes WHERE status = -1 ;"
-- SQL Query to retrieve all trahsed nodes. -- SQL Query to retrieve all trahsed nodes.
--| note: {CMS_NODE_API}.trashed = -1 --| note: {CMS_NODE_API}.trashed = -1
sql_select_trash_nodes_by_author: STRING = "SELECT * FROM Nodes WHERE status = -1 and author = :author ;" sql_select_trash_nodes_by_author: STRING = "SELECT * FROM nodes WHERE status = -1 and author = :author ;"
-- SQL Query to retrieve all nodes by a given author. -- SQL Query to retrieve all nodes by a given author.
--| note: {CMS_NODE_API}.trashed = -1 --| 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;" 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;"
sql_select_recent_nodes: STRING = "SELECT nid, revision, type, title, summary, content, format, author, publish, created, changed, status FROM Nodes ORDER BY nid DESC, publish DESC LIMIT :rows OFFSET :offset ;" sql_select_recent_nodes: STRING = "SELECT nid, revision, type, title, summary, content, format, author, publish, created, changed, status FROM nodes ORDER BY nid DESC, publish DESC LIMIT :rows OFFSET :offset ;"
sql_insert_node: STRING = "INSERT INTO nodes (revision, type, title, summary, content, format, publish, created, changed, status, author) VALUES (1, :type, :title, :summary, :content, :format, :publish, :created, :changed, :status, :author);" sql_insert_node: STRING = "INSERT INTO nodes (revision, type, title, summary, content, format, publish, created, changed, status, author) VALUES (1, :type, :title, :summary, :content, :format, :publish, :created, :changed, :status, :author);"
-- SQL Insert to add a new node. -- SQL Insert to add a new node.
@@ -343,7 +343,7 @@ feature {NONE} -- Queries
feature {NONE} -- Sql Queries: USER_ROLES collaborators, author feature {NONE} -- Sql Queries: USER_ROLES collaborators, author
Select_user_author: STRING = "SELECT uid, name, password, salt, email, users.status, users.created, signed FROM Nodes INNER JOIN users ON nodes.author=users.uid AND nodes.nid = :nid;" Select_user_author: STRING = "SELECT uid, name, password, salt, email, users.status, users.created, signed FROM nodes INNER JOIN users ON nodes.author=users.uid AND nodes.nid = :nid;"
Select_node_author: STRING = "SELECT nid, revision, type, title, summary, content, format, author, publish, created, changed FROM users INNER JOIN nodes ON nodes.author=users.uid AND nodes.nid =:nid;" Select_node_author: STRING = "SELECT nid, revision, type, title, summary, content, format, author, publish, created, changed FROM users INNER JOIN nodes ON nodes.author=users.uid AND nodes.nid =:nid;"

View File

@@ -18,8 +18,7 @@ feature -- Initialization
initialize (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_SQL) initialize (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_SQL)
local local
u: CMS_USER u: CMS_USER
l_anonymous_role, l_authenticated_role, r: CMS_USER_ROLE l_anonymous_role, l_authenticated_role: CMS_USER_ROLE
l_roles: LIST [CMS_USER_ROLE]
do do
--| Schema --| Schema
a_storage.sql_execute_file_script (a_setup.environment.site_path.extended ("scripts").extended ("core.sql"), Void) a_storage.sql_execute_file_script (a_setup.environment.site_path.extended ("scripts").extended ("core.sql"), Void)

View File

@@ -671,24 +671,24 @@ feature {NONE} -- Implementation: User role
feature {NONE} -- Sql Queries: USER feature {NONE} -- Sql Queries: USER
Select_users_count: STRING = "SELECT count(*) FROM Users;" Select_users_count: STRING = "SELECT count(*) FROM users;"
-- Number of users. -- Number of users.
Sql_last_insert_user_id: STRING = "SELECT MAX(uid) FROM Users;" Sql_last_insert_user_id: STRING = "SELECT MAX(uid) FROM users;"
Select_users: STRING = "SELECT * FROM Users;" Select_users: STRING = "SELECT * FROM users;"
-- List of users. -- List of users.
Select_user_by_id: STRING = "SELECT * FROM Users WHERE uid =:uid;" Select_user_by_id: STRING = "SELECT * FROM users WHERE uid =:uid;"
-- Retrieve user by id if exists. -- Retrieve user by id if exists.
Select_user_by_name: STRING = "SELECT * FROM Users WHERE name =:name;" Select_user_by_name: STRING = "SELECT * FROM users WHERE name =:name;"
-- Retrieve user by name if exists. -- Retrieve user by name if exists.
Select_user_by_email: STRING = "SELECT * FROM Users WHERE email =:email;" Select_user_by_email: STRING = "SELECT * FROM users WHERE email =:email;"
-- Retrieve user by email if exists. -- Retrieve user by email if exists.
Select_salt_by_username: STRING = "SELECT salt FROM Users WHERE name =:name;" Select_salt_by_username: STRING = "SELECT salt FROM users WHERE name =:name;"
-- Retrieve salt by username if exists. -- Retrieve salt by username if exists.
sql_insert_user: STRING = "INSERT INTO users (name, password, salt, email, created, status) VALUES (:name, :password, :salt, :email, :created, :status);" sql_insert_user: STRING = "INSERT INTO users (name, password, salt, email, created, status) VALUES (:name, :password, :salt, :email, :created, :status);"