indexing description: "Database access to blog workitem data." author: "Peter Wyss " date: "$Date$" revision: "$Revision$" class BLOG_ACCESS inherit DATABASE_ACCESS create make feature -- Status is_found: BOOLEAN -- Did the last retrieve query find a blog workitem? feature -- Access last_blog_workitem: WORKITEM_BLOG -- Last retrieved blog workitem by a retrieve query. feature -- Select queries retrieve_blog_workitem_by_id (a_id: INTEGER) is -- Retrieve a blog workitem by a_id. require a_id_ok: a_id > 0 local l_selection: DB_SELECTION l_list_filling: DB_ACTION [WORKITEM_BLOG] l_blog: WORKITEM_BLOG l_blogs: LIST [WORKITEM_BLOG] 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_blog.make create l_selection.make l_selection.set_map_name (a_id, "workitem_id") l_selection.query ("SELECT * FROM workitem_blog WHERE workitem_id=:workitem_id") handle_errors_and_warnings l_selection.object_convert (l_blog) create l_list_filling.make (l_selection, l_blog) 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_blogs := l_list_filling.list if l_blogs.count = 1 then is_found := True last_blog_workitem := l_blogs.first else is_found := False end ensure is_found_implies_blog: is_found implies last_blog_workitem /= Void end feature -- Insert queries insert_blog_workitem (a_blog: WORKITEM_BLOG) is -- Add a_blog as a new blog workitem. require a_blog_not_void: a_blog /= 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_blog")) l_store.put (a_blog) handle_errors_and_warnings db_handler.db_control.set_numeric_null_value (l_null) end end