Added persistence support for Eiffel sqlite3 wrapper.

Updated existing persistency solution to be more generic to any db solution.
This commit is contained in:
2015-10-05 16:04:10 +02:00
parent 7fcacad5eb
commit eb5ae32e46
18 changed files with 859 additions and 160 deletions

View File

@@ -83,11 +83,11 @@ feature -- Persistence
if l_update then
if l_has_modif then
sql_change (sql_update_node_data, l_parameters)
sql_modify (sql_update_node_data, l_parameters)
end
else
if l_has_modif then
sql_change (sql_insert_node_data, l_parameters)
sql_insert (sql_insert_node_data, l_parameters)
else
-- no page data, means everything is empty.
-- FOR NOW: always record row
@@ -116,7 +116,7 @@ feature -- Persistence
if a_node.has_id then
create l_parameters.make (1)
l_parameters.put (a_node.id, "nid")
sql_change (sql_delete_node_data, l_parameters)
sql_modify (sql_delete_node_data, l_parameters)
end
end
@@ -136,18 +136,21 @@ feature {NONE} -- Implementation
l_parameters.put (a_node.revision, "revision")
sql_query (sql_select_node_data, l_parameters)
if not has_error then
n := sql_rows_count
if n = 1 then
if not sql_after then
-- nid, revision, tags
l_rev := sql_read_integer_64 (2)
l_tags := sql_read_string_32 (3)
if l_tags /= Void then
Result := [l_rev, l_tags]
end
else
check unique_data: n = 0 end
sql_forth
if not sql_after then
check unique_data: n = 0 end
Result := Void
end
end
end
sql_finalize
ensure
accepted_revision: Result /= Void implies Result.revision <= a_node.revision
end