LeechCraft 0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
sqliteimpl.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include "oraltypes.h"
12
14{
16 {
17 using IsImpl_t = void;
18
19 struct TypeLits
20 {
21 constexpr static CtString IntAutoincrement { "INTEGER PRIMARY KEY AUTOINCREMENT" };
22 constexpr static CtString Binary { "BLOB" };
23 };
24
25 constexpr static CtString LimitNone { "-1" };
26
27 constexpr static auto GetInsertPrefix (InsertAction::IgnoreTag)
28 {
29 return "INSERT OR IGNORE"_ct;
30 }
31
32 constexpr static auto GetInsertPrefix (InsertAction::DefaultTag)
33 {
34 return "INSERT"_ct;
35 }
36
37 template<auto... Ptrs>
39 {
40 return "INSERT"_ct;
41 }
42
43 constexpr static auto GetInsertPrefix (InsertAction::Replace::WholeType)
44 {
45 return "INSERT"_ct;
46 }
47
48 constexpr static auto GetInsertSuffix (InsertAction::DefaultTag)
49 {
50 return ""_ct;
51 }
52
53 constexpr static auto GetInsertSuffix (InsertAction::IgnoreTag)
54 {
55 return ""_ct;
56 }
57
58 constexpr static auto GetInsertSuffix (InsertAction::Replace, auto fields)
59 {
60 return "ON CONFLICT DO UPDATE SET " + JoinTup (ZipWith (fields, " = EXCLUDED.", fields), ", ");
61 }
62
63 constexpr static auto GetInsertSuffix (InsertAction::DefaultTag, auto pkName)
64 {
65 return "RETURNING "_ct + pkName;
66 }
67
68 constexpr static auto GetInsertSuffix (InsertAction::IgnoreTag, auto pkName)
69 {
70 return "RETURNING "_ct + pkName;
71 }
72
73 constexpr static auto GetInsertSuffix (InsertAction::Replace, auto fields, auto pkName)
74 {
75 return "ON CONFLICT DO UPDATE SET " + JoinTup (ZipWith (fields, " = EXCLUDED.", fields), ", ") +
76 " RETURNING " + pkName;
77 }
78 };
79}
80
81namespace LC::Util::oral
82{
84}
detail::SQLite::ImplFactory SQLiteImplFactory
Definition sqliteimpl.h:83
constexpr auto JoinTup(auto &&stringsTuple, auto &&sep) noexcept
constexpr auto ZipWith(Tup1 &&tup1, auto &&sep, Tup2 &&tup2) noexcept
static constexpr auto GetInsertSuffix(InsertAction::IgnoreTag)
Definition sqliteimpl.h:53
static constexpr CtString LimitNone
Definition sqliteimpl.h:25
static constexpr auto GetInsertPrefix(InsertAction::DefaultTag)
Definition sqliteimpl.h:32
static constexpr auto GetInsertSuffix(InsertAction::Replace, auto fields)
Definition sqliteimpl.h:58
static constexpr auto GetInsertSuffix(InsertAction::DefaultTag, auto pkName)
Definition sqliteimpl.h:63
static constexpr auto GetInsertPrefix(InsertAction::IgnoreTag)
Definition sqliteimpl.h:27
static constexpr auto GetInsertSuffix(InsertAction::DefaultTag)
Definition sqliteimpl.h:48
static constexpr auto GetInsertSuffix(InsertAction::IgnoreTag, auto pkName)
Definition sqliteimpl.h:68
static constexpr auto GetInsertPrefix(InsertAction::Replace::FieldsType< Ptrs... >)
Definition sqliteimpl.h:38
static constexpr auto GetInsertPrefix(InsertAction::Replace::WholeType)
Definition sqliteimpl.h:43
static constexpr auto GetInsertSuffix(InsertAction::Replace, auto fields, auto pkName)
Definition sqliteimpl.h:73