indexing description: "Database access to comment workitem data." author: "Marco Zietzling " date: "$Date$" revision: "$Revision$" class COMMENT_ACCESS inherit DATABASE_ACCESS create make feature -- Status is_found: BOOLEAN -- Did the last retrieve query find a comment workitem? feature -- Access last_comment_workitem: WORKITEM_COMMENT -- Last retrieved comment workitem by a retrieve query. feature -- Select queries retrieve_comment_workitem_by_id (a_id: INTEGER) is -- Retrieve a comment workitem by a_id. require a_id_ok: a_id > 0 local l_selection: DB_SELECTION l_list_filling: DB_ACTION [WORKITEM_COMMENT] l_comment: WORKITEM_COMMENT l_comments: LIST [WORKITEM_COMMENT] 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_comment.make create l_selection.make l_selection.set_map_name (a_id, "workitem_id") l_selection.query ("SELECT * FROM workitem_comment WHERE workitem_id=:workitem_id") handle_errors_and_warnings l_selection.object_convert (l_comment) create l_list_filling.make (l_selection, l_comment) 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_comments := l_list_filling.list if l_comments.count = 1 then is_found := True last_comment_workitem := l_comments.first else is_found := False end ensure is_found_implies_comment: is_found implies last_comment_workitem /= Void end feature -- Insert queries insert_comment_workitem (a_comment: WORKITEM_COMMENT) is -- Add a_comment as a new comment workitem. require a_comment_not_void: a_comment /= 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_comment")) l_store.put (a_comment) handle_errors_and_warnings db_handler.db_control.set_numeric_null_value (l_null) end end