埃菲尔ODBC如何从数据库获取答案

时间:2018-10-12 13:22:16

标签: database odbc eiffel

我正在尝试通过简单的操作从ODBC postgresql数据库获得答案

DELETE * from some_table

使用以下代码,我无法获得DELETE 1经典答案? affected_row_count是我的猜测,但似乎不是is_affected_row_count_supported。我在插入时遇到了同样的问题...

delete_entity (a_primary_key: INTEGER_64)
        -- Delete from given primary_key object
    require
        valid_db_connection: attached db_connection.base_update
                    and attached db_connection.session_control
    local
        l_void: like item
    do
        if attached db_connection.base_update as l_base_update
                and then attached db_connection.session_control as l_session_control then
            l_base_update.modify (delete_from_primary_key_query(a_primary_key))
            if l_base_update.is_ok then
                last_success_message := "Entity with ID " + a_primary_key.out + " deleted from DB successfully"
                if l_base_update.is_affected_row_count_supported then
                    check
                        only_one_affected_row: l_base_update.affected_row_count = 1
                    end
                    if attached last_success_message as l then
                        l.append (" affected rows:" + l_base_update.affected_row_count.out )
                    end
                end
                if attached last_success_message as l then logger.write_information (l) end
            else
                create {INSERT_ERROR} last_error.make ("last delete did not work: " + l_base_update.error_message_32)
            end
        end
    end

1 个答案:

答案 0 :(得分:0)

目前,通过ODBC的EiffelStore不支持affected_row_count