Function operator<<

Summary

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

(1) template <typename T>
    std::enable_if< !std::is_same< typename std::remove_cv< typename std::remove_reference< T >::type >::type, trantor::Date >::value, self & >::type operator<<(T &&parameter)

(2) self & operator<<(const char str[])

(3) self & operator<<(char str[])

(4) self & operator<<(const std::string &str)

(5) self & operator<<(std::string &str)

(6) self & operator<<(std::string &&str)

(7) self & operator<<(trantor::Date &&date)

(8) self & operator<<(const trantor::Date &date)

(9) self & operator<<(const std::vector< char > &v)

(10) self & operator<<(std::vector< char > &&v)

(11) self & operator<<(float f)

(12) self & operator<<(double f)

(13) self & operator<<(std::nullptr_t nullp)

(14) self & operator<<(DefaultValue dv)

(15) self & operator<<(const Mode &mode)

(16) self & operator<<(Mode &&mode)

(17) template <typename T>
     self & operator<<(const optional< T > &parameter)

(18) template <typename T>
     self & operator<<(optional< T > &&parameter)

Function overload

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

template <typename T>
std::enable_if< !std::is_same< typename std::remove_cv< typename std::remove_reference< T >::type >::type, trantor::Date >::value, self & >::type operator<<(T &&parameter)

Description

No description yet.

Source

Lines 357-440 in orm_lib/inc/drogon/orm/SqlBinder.h.

template <typename T>
typename std::enable_if<
    !std::is_same<typename std::remove_cv<
                      typename std::remove_reference<T>::type>::type,
                  trantor::Date>::value,
    self &>::type
operator<<(T &&parameter)
{
    ++parametersNumber_;
    using ParaType = typename std::remove_cv<
        typename std::remove_reference<T>::type>::type;
    std::shared_ptr<void> obj = std::make_shared<ParaType>(parameter);
    if (type_ == ClientType::PostgreSQL)
    {
__cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900)
        const size_t size = sizeof(T);
        if constexpr (size == 2)
        {
            *std::static_pointer_cast<uint16_t>(obj) = htons(parameter);
        }
        else if constexpr (size == 4)
        {
            *std::static_pointer_cast<uint32_t>(obj) = htonl(parameter);
        }
        else if constexpr (size == 8)
        {
            *std::static_pointer_cast<uint64_t>(obj) = htonll(parameter);
        }
e
        switch (sizeof(T))
        {
            case 2:
                *std::static_pointer_cast<uint16_t>(obj) = htons(parameter);
                break;
            case 4:
                *std::static_pointer_cast<uint32_t>(obj) = htonl(parameter);
                break;
            case 8:
                *std::static_pointer_cast<uint64_t>(obj) =
                    htonll(parameter);
                break;
            case 1:
            default:
                break;
        }
if
        objs_.push_back(obj);
        parameters_.push_back((char *)obj.get());
        lengths_.push_back(sizeof(T));
        formats_.push_back(1);
    }
    else if (type_ == ClientType::Mysql)
    {
        objs_.push_back(obj);
        parameters_.push_back((char *)obj.get());
        lengths_.push_back(0);
        formats_.push_back(getMysqlTypeBySize(sizeof(T)));
    }
    else if (type_ == ClientType::Sqlite3)
    {
        objs_.push_back(obj);
        parameters_.push_back((char *)obj.get());
        lengths_.push_back(0);
        switch (sizeof(T))
        {
            case 1:
                formats_.push_back(Sqlite3TypeChar);
                break;
            case 2:
                formats_.push_back(Sqlite3TypeShort);
                break;
            case 4:
                formats_.push_back(Sqlite3TypeInt);
                break;
            case 8:
                formats_.push_back(Sqlite3TypeInt64);
            default:
                break;
        }
    }
    // LOG_TRACE << "Bind parameter:" << parameter;
    return *this;
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(const char str[])

Description

No description yet.

Source

Lines 442-445 in orm_lib/inc/drogon/orm/SqlBinder.h.

self &operator<<(const char str[])
{
    return operator<<(std::string(str));
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(char str[])

Description

No description yet.

Source

Lines 446-449 in orm_lib/inc/drogon/orm/SqlBinder.h.

self &operator<<(char str[])
{
    return operator<<(std::string(str));
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(const std::string &str)

Description

No description yet.

Source

Line 450 in orm_lib/inc/drogon/orm/SqlBinder.h.

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(std::string &str)

Description

No description yet.

Source

Lines 451-454 in orm_lib/inc/drogon/orm/SqlBinder.h.

self &operator<<(std::string &str)
{
    return operator<<((const std::string &)str);
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(std::string &&str)

Description

No description yet.

Source

Line 455 in orm_lib/inc/drogon/orm/SqlBinder.h.

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(trantor::Date &&date)

Description

No description yet.

Source

Lines 456-459 in orm_lib/inc/drogon/orm/SqlBinder.h.

self &operator<<(trantor::Date &&date)
{
    return operator<<(date.toDbStringLocal());
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(const trantor::Date &date)

Description

No description yet.

Source

Lines 460-463 in orm_lib/inc/drogon/orm/SqlBinder.h.

self &operator<<(const trantor::Date &date)
{
    return operator<<(date.toDbStringLocal());
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(const std::vector< char > &v)

Description

No description yet.

Source

Line 464 in orm_lib/inc/drogon/orm/SqlBinder.h.

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(std::vector< char > &&v)

Description

No description yet.

Source

Line 465 in orm_lib/inc/drogon/orm/SqlBinder.h.

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(float f)

Description

No description yet.

Source

Lines 466-473 in orm_lib/inc/drogon/orm/SqlBinder.h.

self &operator<<(float f)
{
    if (type_ == ClientType::Sqlite3)
    {
        return operator<<((double)f);
    }
    return operator<<(std::to_string(f));
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(double f)

Description

No description yet.

Source

Line 474 in orm_lib/inc/drogon/orm/SqlBinder.h.

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(std::nullptr_t nullp)

Description

No description yet.

Source

Line 475 in orm_lib/inc/drogon/orm/SqlBinder.h.

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(DefaultValue dv)

Description

No description yet.

Source

Line 476 in orm_lib/inc/drogon/orm/SqlBinder.h.

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(const Mode &mode)

Description

No description yet.

Source

Lines 477-481 in orm_lib/inc/drogon/orm/SqlBinder.h.

self &operator<<(const Mode &mode)
{
    mode_ = mode;
    return *this;
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

self & operator<<(Mode &&mode)

Description

No description yet.

Source

Lines 482-486 in orm_lib/inc/drogon/orm/SqlBinder.h.

self &operator<<(Mode &&mode)
{
    mode_ = mode;
    return *this;
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

template <typename T>
self & operator<<(const optional< T > &parameter)

Description

No description yet.

Source

Lines 487-495 in orm_lib/inc/drogon/orm/SqlBinder.h.

template <typename T>
self &operator<<(const optional<T> &parameter)
{
    if (parameter)
    {
        return *this << parameter.value();
    }
    return *this << nullptr;
}

Synopsis

#include <orm_lib/inc/drogon/orm/SqlBinder.h>

template <typename T>
self & operator<<(optional< T > &&parameter)

Description

No description yet.

Source

Lines 496-504 in orm_lib/inc/drogon/orm/SqlBinder.h.

template <typename T>
self &operator<<(optional<T> &&parameter)
{
    if (parameter)
    {
        return *this << std::move(parameter.value());
    }
    return *this << nullptr;
}





Add Discussion as Guest

Log in