Skip to content

Commit

Permalink
Started to migrate postgresql connector into sqlpp11 repo.
Browse files Browse the repository at this point in the history
Removed timezone handling in the process (needs to be documented).
Note: on_conflict does not check for constraints (needs to be documented).
Note: some of the constraints tests seem to be aiming for a different static_assert.
  • Loading branch information
rbock committed Nov 14, 2021
1 parent 13698d0 commit 4c94260
Show file tree
Hide file tree
Showing 49 changed files with 6,545 additions and 22 deletions.
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,31 @@ option(SQLCIPHER_CONNECTOR "Build SQLite3 Connector with SQLCipher" OFF)
if(MYSQL_CONNECTOR)
find_package(MySQL REQUIRED)
else()
message(STATUS "Not building MYSQL_CONNECTOR")
message(STATUS "Not building tests for MYSQL_CONNECTOR")
endif()

if(MARIADB_CONNECTOR)
find_package(MariaDB REQUIRED)
else()
message(STATUS "Not building MARIAB_CONNECTOR")
message(STATUS "Not building tests for MARIAB_CONNECTOR")
endif()

if(POSTGRESQL_CONNECTOR)
find_package(PostgreSQL REQUIRED)
else()
message(STATUS "Not building tests for POSTGRESQL_CONNECTOR")
endif()

if(SQLITE3_CONNECTOR)
find_package(SQLite3 REQUIRED)
else()
message(STATUS "Not building SQLITE3_CONNECTOR")
message(STATUS "Not building tests for SQLITE3_CONNECTOR")
endif()

if(SQLCIPHER_CONNECTOR)
find_package(SQLCipher REQUIRED)
else()
message(STATUS "Not building SQLCIPHER_CONNECTOR")
message(STATUS "Not building tests for SQLCIPHER_CONNECTOR")
endif()

include(CTest)
Expand Down
58 changes: 58 additions & 0 deletions include/sqlpp11/detail/column_tuple_merge.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2021-2021, Roland Bock
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef SQLPP11_COLUMN_TUPLE_MERGE_H
#define SQLPP11_COLUMN_TUPLE_MERGE_H

#include <tuple>

#include <sqlpp11/auto_alias.h>

namespace sqlpp
{
namespace detail
{
template <typename T>
std::tuple<auto_alias_t<T>> as_column_tuple(T t)
{
return std::tuple<auto_alias_t<T>>(auto_alias_t<T>{t});
}

template <typename... Args>
std::tuple<auto_alias_t<Args>...> as_column_tuple(std::tuple<Args...> t)
{
return t;
}

template <typename... Columns>
auto column_tuple_merge(Columns... columns) -> decltype(std::tuple_cat(as_column_tuple(columns)...))
{
return std::tuple_cat(as_column_tuple(columns)...);
}
}
} // namespace sqlpp

#endif
Loading

0 comments on commit 4c94260

Please sign in to comment.