diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-05-24 01:01:30 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-05-24 01:01:30 +0100 |
commit | 15c1e5566f7ad8448985ca6e52805ceb4ec389a8 (patch) | |
tree | 14908b221d01cca00975da84656adcea57898620 /lib/dbTypes.h | |
parent | Minor tidy up of replStream (diff) | |
download | mygrate-15c1e5566f7ad8448985ca6e52805ceb4ec389a8.tar.bz2 mygrate-15c1e5566f7ad8448985ca6e52805ceb4ec389a8.tar.xz mygrate-15c1e5566f7ad8448985ca6e52805ceb4ec389a8.zip |
Basic support for queries with bound parameters
Bit of a reshuffle to make the types not DB specific, add some basic tests over query
execution, no selects yet and no validation anything is actually right.
Diffstat (limited to 'lib/dbTypes.h')
-rw-r--r-- | lib/dbTypes.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/dbTypes.h b/lib/dbTypes.h new file mode 100644 index 0000000..ba0cd70 --- /dev/null +++ b/lib/dbTypes.h @@ -0,0 +1,31 @@ +#ifndef MYGRATE_DBTYPES_H +#define MYGRATE_DBTYPES_H + +#include "bitset.h" +#include <cstdint> +#include <span> +#include <string_view> +#include <variant> + +struct timespec; + +namespace MyGrate { + struct Date { + uint16_t year; + uint8_t month; + uint8_t day; + }; + struct Time { + uint8_t hour; + uint8_t minute; + uint8_t second; + }; + struct DateTime : public Date, public Time { + }; + using Blob = std::span<const std::byte>; + + using DbValue = std::variant<std::nullptr_t, double, float, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, + int64_t, uint64_t, timespec, Date, Time, DateTime, std::string_view, BitSet, Blob>; +} + +#endif |