added timestamp code, support columns for group by and order by and tested load has-many eager code

This commit is contained in:
2026-01-08 15:14:31 +01:00
parent 0bf945cd13
commit 930b9d1aa4
34 changed files with 853 additions and 846 deletions
+33 -43
View File
@@ -9,63 +9,58 @@ size_t detail::hash(const char *value) {
return std::hash<std::string_view>()(std::string_view(value, std::strlen(value)));
}
bool identifier_type_traits<const char*>::is_valid(const char *value) {
bool identifier_type_traits<const char *>::is_valid(const char *value) {
return value != nullptr && strlen(value) > 0;
}
std::string identifier_type_traits<const char*>::to_string(const char *value) {
std::string identifier_type_traits<const char *>::to_string(const char *value) {
return value;
}
identifier::base::base(const std::type_index &ti, const basic_type type)
: type_index_(ti)
, type_(type)
{}
: type_index_(ti)
, type_(type) {
}
identifier::null_pk::null_pk()
: base(std::type_index(typeid(null_type_t)), basic_type::Null)
{}
: base(std::type_index(typeid(null_type_t)), basic_type::Null) {
}
identifier::base* identifier::null_pk::copy() const
{
identifier::base *identifier::null_pk::copy() const {
return new null_pk;
}
bool identifier::null_pk::equal_to(const base &x) const
{
bool identifier::null_pk::equal_to(const base &x) const {
return type_index_ == x.type_index_;
}
bool identifier::null_pk::less(const base &x) const
{
bool identifier::null_pk::less(const base &x) const {
return type_index_ == x.type_index_;
}
bool identifier::null_pk::is_valid() const
{
bool identifier::null_pk::is_valid() const {
return identifier_type_traits<null_type_t>::is_valid();
}
std::string identifier::null_pk::str() const
{
std::string identifier::null_pk::str() const {
return identifier_type_traits<null_type_t>::to_string();
}
void identifier::null_pk::serialize(identifier_serializer &s)
{
void identifier::null_pk::serialize(identifier_serializer &s) {
s.serialize(null_, {});
}
size_t identifier::null_pk::hash() const
{
size_t identifier::null_pk::hash() const {
return std::hash<nullptr_t>()(nullptr);
}
identifier::identifier()
: id_(std::make_shared<null_pk>()) {}
: id_(std::make_shared<null_pk>()) {
}
identifier::identifier(const identifier &x)
: id_(x.id_->copy()) {}
: id_(x.id_->copy()) {
}
identifier &identifier::operator=(const identifier &x) {
if (this == &x) {
@@ -123,13 +118,11 @@ basic_type identifier::type() const {
return id_->type_;
}
identifier identifier::share() const
{
identifier identifier::share() const {
return identifier(id_);
}
size_t identifier::use_count() const
{
size_t identifier::use_count() const {
return id_.use_count();
}
@@ -157,22 +150,23 @@ bool identifier::is_time() const {
return id_->type_ == basic_type::Time;
}
bool identifier::is_timestamp() const {
return id_->type_ == basic_type::DateTime;
}
bool identifier::is_blob() const {
return id_->type_ == basic_type::Blob;
}
bool identifier::is_null() const
{
bool identifier::is_null() const {
return type_index() == null_identifier.type_index();
}
bool identifier::is_valid() const
{
bool identifier::is_valid() const {
return id_->is_valid();
}
void identifier::clear()
{
void identifier::clear() {
id_ = std::make_unique<null_pk>();
}
@@ -180,24 +174,20 @@ void identifier::serialize(identifier_serializer &s) const {
id_->serialize(s);
}
size_t identifier::hash() const
{
size_t identifier::hash() const {
return id_->hash();
}
identifier::identifier(const std::shared_ptr<base> &id)
: id_(id)
{}
: id_(id) {
}
std::ostream &operator<<(std::ostream &out, const identifier &id)
{
std::ostream &operator<<(std::ostream &out, const identifier &id) {
out << id.str();
return out;
}
size_t id_pk_hash::operator()(const identifier &id) const
{
size_t id_pk_hash::operator()(const identifier &id) const {
return id.hash();
}
}
}
+4
View File
@@ -84,6 +84,10 @@ bool value::is_time() const {
return type_ == basic_type::Time;
}
bool value::is_timestamp() const {
return type_ == basic_type::DateTime;
}
bool value::is_blob() const {
return type_ == basic_type::Blob;
}