indexing description: "Database access to wiki workitem data." author: "Peter Wyss " date: "$Date$" revision: "$Revision$" class WIKI_ACCESS inherit DATABASE_ACCESS create make feature -- Status is_found: BOOLEAN -- Did the last retrieve query find a wiki workitem? feature -- Access last_wiki_workitem: WORKITEM_WIKI -- Last retrieved wiki workitem by a retrieve query. feature -- Select queries retrieve_wiki_workitem_by_id (a_id: INTEGER) is -- Retrieve a wiki workitem by a_id. require a_id_ok: a_id > 0 local l_selection: DB_SELECTION l_list_filling: DB_ACTION [WORKITEM_WIKI] l_wiki: WORKITEM_WIKI l_wikis: LIST [WORKITEM_WIKI] l_null: DOUBLE do l_null := db_handler.db_control.numeric_null_value db_handler.db_control.set_numeric_null_value ({INTEGER_32}.min_value) create l_wiki.make create l_selection.make l_selection.set_map_name (a_id, "workitem_id") l_selection.query ("SELECT * FROM workitem_wiki WHERE workitem_id=:workitem_id") handle_errors_and_warnings l_selection.object_convert (l_wiki) create l_list_filling.make (l_selection, l_wiki) l_selection.set_action (l_list_filling) l_selection.load_result l_selection.terminate db_handler.db_control.set_numeric_null_value (l_null) l_wikis := l_list_filling.list if l_wikis.count = 1 then is_found := True last_wiki_workitem := l_wikis.first else is_found := False end ensure is_found_implies_wiki: is_found implies last_wiki_workitem /= Void end feature -- Insert queries insert_wiki_workitem (a_wiki: WORKITEM_WIKI) is -- Add a_wiki as a new wiki workitem. require a_wiki_not_void: a_wiki /= Void local l_store: DB_STORE l_null: DOUBLE do l_null := db_handler.db_control.numeric_null_value db_handler.db_control.set_numeric_null_value ({INTEGER_32}.min_value) create l_store.make l_store.set_repository (db_handler.db_repositories.item ("workitem_wiki")) l_store.put (a_wiki) handle_errors_and_warnings db_handler.db_control.set_numeric_null_value (l_null) end end