forked from qt-creator/qt-creator
		
	Sqlite: Add unoptional value fetcher
There is now value, valueWithTransaction, optionalValue and optionalValueWithTransaction. Sometimes you want to return the default constructed value as default. So this is now possible. This simplifies some code but can be even more optimal. Change-Id: Ibbb6b5ca47803344ed646bfa257602b6db52e0fe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
		
				
					committed by
					
						
						Thomas Hartmann
					
				
			
			
				
	
			
			
			
						parent
						
							c78d1c171f
						
					
				
				
					commit
					ef4f2a4dcf
				
			@@ -161,7 +161,7 @@ public:
 | 
			
		||||
                (int projectPartId));
 | 
			
		||||
 | 
			
		||||
    template<typename ResultType, typename... QueryTypes>
 | 
			
		||||
    auto value(const QueryTypes &...queryValues)
 | 
			
		||||
    auto optionalValue(const QueryTypes &...queryValues)
 | 
			
		||||
    {
 | 
			
		||||
        if constexpr (std::is_same_v<ResultType, Sqlite::ByteArrayBlob>)
 | 
			
		||||
            return valueReturnBlob(queryValues...);
 | 
			
		||||
@@ -196,6 +196,19 @@ public:
 | 
			
		||||
                          "SqliteReadStatementMock::value does not handle result type!");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<typename ResultType, typename... QueryTypes>
 | 
			
		||||
    auto value(const QueryTypes &...queryValues)
 | 
			
		||||
    {
 | 
			
		||||
        static_assert(!std::is_same_v<ResultType, ResultType>,
 | 
			
		||||
                      "SqliteReadStatementMock::value does not handle result type!");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<typename ResultType, typename... QueryTypes>
 | 
			
		||||
    auto optionalValueWithTransaction(const QueryTypes &...queryValues)
 | 
			
		||||
    {
 | 
			
		||||
        return optionalValue<ResultType>(queryValues...);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<typename ResultType, typename... QueryType>
 | 
			
		||||
    auto values(std::size_t reserveSize, const QueryType &...queryValues)
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user