Skip to content

Commit

Permalink
Merge pull request #36 from BrainlessLabs/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
BrainlessLabs authored Jul 17, 2018
2 parents 94857cd + 3471e94 commit d41af5e
Show file tree
Hide file tree
Showing 9 changed files with 61,783 additions and 7 deletions.
8 changes: 8 additions & 0 deletions include/blib/bun/DbBackend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,13 @@ namespace blib {
return std::move(ret);
}
}

using DbGenericType = __private::DbGenericType;

using DbTypeSqlite = __private::DbGenericType;

using DbTypePostgres = __private::DbGenericType;

using DbTypeMySql = __private::DbGenericType;
}
}
3 changes: 2 additions & 1 deletion include/blib/bun/bun.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ namespace blib {
const std::string sql = fmt::format(SqlString<T>::select_rows_sql() + " WHERE oid = {}",
class_name, to_valid_query_string(oid.to_string(), "'"));
QUERY_LOG(sql);
const std::unique_ptr <T> obj = std::make_unique<T>();
std::unique_ptr <T> obj = std::make_unique<T>();
SimpleObjHolder<T> obj_holder(obj.get(), oid);
try {
blib::bun::__private::DbBackend<>::i().session() << sql, soci::into(obj_holder);
Expand Down Expand Up @@ -979,6 +979,7 @@ namespace blib {

/// @fn connect
/// @brief Connect with the proper connection strings
template<typename DbType = blib::bun::__private::DbGenericType>
inline bool connect(std::string const& connection_string) {
const auto ret = blib::bun::__private::DbBackend<blib::bun::__private::DbGenericType>::i().connect(connection_string);
return ret;
Expand Down
12 changes: 12 additions & 0 deletions include/blib/bun/endian.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once
#include<cstdint>
#include<boost/endian/conversion.hpp>

namespace bun {
inline bool is_big_endian() {
static const std::uint16_t val = 1;
static const std::uint8_t* c = (std::uint8_t*)(&val);
static const bool ret = *c ? false : true;
return ret;
}
}
Loading

0 comments on commit d41af5e

Please sign in to comment.