Added SQLite ODBC example under test/APPLICATION.e class.

Fixed compilation issues with SQLite implemenation. (need to be updated)
This commit is contained in:
jvelilla
2014-10-01 14:11:17 -03:00
parent 27a11f2eea
commit 52cc566e15
5 changed files with 65 additions and 9 deletions

View File

@@ -17,6 +17,7 @@
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/> <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="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/> <library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
<cluster name="common" location="..\common\" recursive="true"/> <cluster name="common" location="..\common\" recursive="true"/>
<cluster name="interface" location="..\..\interface\" recursive="true"/> <cluster name="interface" location="..\..\interface\" recursive="true"/>
<cluster name="persistence_sqlite" location=".\src\" recursive="true"> <cluster name="persistence_sqlite" location=".\src\" recursive="true">

View File

@@ -100,6 +100,46 @@ feature -- Change: user
end end
end end
feature -- User Nodes
user_collaborator_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE]
-- Possible list of nodes where the user identified by `a_id', is a collaborator.
do
create {ARRAYED_LIST[CMS_NODE]} Result.make (0)
to_implement ("Not implemented")
end
user_author_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE]
-- Possible list of nodes where the user identified by `a_id', is the author.
do
create {ARRAYED_LIST[CMS_NODE]} Result.make (0)
to_implement ("Not implemented")
end
feature -- Users roles and permissions
user_role_by_id (a_id: like {CMS_USER_ROLE}.id): detachable CMS_USER_ROLE
-- User role by id `a_id', if any.
do
to_implement ("Not implemented")
end
user_roles: LIST [CMS_USER_ROLE]
-- Possible list of user roles.
do
create {ARRAYED_LIST[CMS_USER_ROLE]} Result.make (0)
to_implement ("Not implemented")
end
feature -- Change: roles and permissions
save_user_role (a_user_role: CMS_USER_ROLE)
-- Save user role `a_user_role'
do
to_implement ("Not implemented")
end
feature -- Access: node feature -- Access: node
nodes: LIST[CMS_NODE] nodes: LIST[CMS_NODE]
@@ -145,31 +185,45 @@ feature -- Node
post_node_provider_execution post_node_provider_execution
end end
update_node (a_node: CMS_NODE) update_node (a_id: like {CMS_USER}.id; a_node: CMS_NODE)
do do
node_provider.update_node (a_node) node_provider.update_node (a_node)
post_node_provider_execution post_node_provider_execution
end end
update_node_title (a_id: INTEGER_64; a_title: READABLE_STRING_32) update_node_title (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32)
do do
node_provider.update_node_title (a_id, a_title) node_provider.update_node_title (a_id, a_title)
post_node_provider_execution post_node_provider_execution
end end
update_node_summary (a_id: INTEGER_64; a_summary: READABLE_STRING_32) update_node_summary (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32)
do do
node_provider.update_node_summary (a_id, a_summary) node_provider.update_node_summary (a_id, a_summary)
post_node_provider_execution post_node_provider_execution
end end
update_node_content (a_id: INTEGER_64; a_content: READABLE_STRING_32) update_node_content (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32)
do do
node_provider.update_node_content (a_id, a_content) node_provider.update_node_content (a_id, a_content)
post_node_provider_execution post_node_provider_execution
end end
node_author (a_id: like {CMS_NODE}.id): detachable CMS_USER
-- Node's author. if any.
do
to_implement ("Not implemented")
end
node_collaborators (a_id: like {CMS_NODE}.id): LIST [CMS_USER]
-- Possible list of node's collaborator.
do
create {ARRAYED_LIST[CMS_USER]} Result.make (0)
to_implement ("Not implemented")
end
feature -- User feature -- User
new_user (a_user: CMS_USER) new_user (a_user: CMS_USER)

View File

@@ -21,7 +21,8 @@ feature {NONE} -- Initialization
node: NODE_DATA_PROVIDER node: NODE_DATA_PROVIDER
l_security: SECURITY_PROVIDER l_security: SECURITY_PROVIDER
do do
create connection.make_basic ("cms_dev") -- Change the path.
create connection.login_with_connection_string ("Driver=SQLite3 ODBC Driver;Database=./cms_lite.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;")
create user.make (connection) create user.make (connection)
user.new_user ("test", "test", "test") user.new_user ("test", "test", "test")
end end

Binary file not shown.

View File

@@ -231,7 +231,7 @@ feature -- Test routines
l_node.set_summary ("New Summary") l_node.set_summary ("New Summary")
l_node.set_title("New Title") l_node.set_title("New Title")
storage.update_node (l_node) -- storage.update_node (l_node)
assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then not (u_node.title ~ ll_node.title) and then not (u_node.content ~ ll_node.content) and then not (u_node.summary ~ ll_node.summary)) assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then not (u_node.title ~ ll_node.title) and then not (u_node.content ~ ll_node.content) and then not (u_node.summary ~ ll_node.summary))
end end
end end
@@ -243,7 +243,7 @@ feature -- Test routines
do do
storage.save_node (custom_node ("Content", "Summary", "Title")) storage.save_node (custom_node ("Content", "Summary", "Title"))
if attached {CMS_NODE} storage.node (1) as ll_node then if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_title (ll_node.id, "New Title") -- storage.update_node_title (ll_node.id, "New Title")
assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary) assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary)
end end
end end
@@ -255,7 +255,7 @@ feature -- Test routines
do do
storage.save_node (custom_node ("Content", "Summary", "Title")) storage.save_node (custom_node ("Content", "Summary", "Title"))
if attached {CMS_NODE} storage.node (1) as ll_node then if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_summary (ll_node.id, "New Summary") -- storage.update_node_summary (ll_node.id, "New Summary")
assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then u_node.title ~ ll_node.title and then u_node.content ~ ll_node.content and then not (u_node.summary ~ ll_node.summary)) assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then u_node.title ~ ll_node.title and then u_node.content ~ ll_node.content and then not (u_node.summary ~ ll_node.summary))
end end
end end
@@ -267,7 +267,7 @@ feature -- Test routines
do do
storage.save_node (custom_node ("Content", "Summary", "Title")) storage.save_node (custom_node ("Content", "Summary", "Title"))
if attached {CMS_NODE} storage.node (1) as ll_node then if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_content (ll_node.id, "New Content") -- storage.update_node_content (ll_node.id, "New Content")
assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then u_node.title ~ ll_node.title and then not (u_node.content ~ ll_node.content) and then u_node.summary ~ ll_node.summary) assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then u_node.title ~ ll_node.title and then not (u_node.content ~ ll_node.content) and then u_node.summary ~ ll_node.summary)
end end
end end