List:MySQL++« Previous MessageNext Message »
From:David Walthour Date:March 30 2010 5:55pm
Subject:Why is there no replace function in query.h that takes two iterators
as arguments?
View as plain text  
It seems for symmetry reasons (and that I really want this function) that
there should be a function for replace that takes two iterators just like
insert does:

    template <class Iter>
    Query& replace(Iter first, Iter last)
    {
        reset();
        if (first == last) {
            return *this;    // empty set!
        }

        MYSQLPP_QUERY_THISPTR << std::setprecision(16) <<
                "REPLACE INTO " << first->table() << " (" <<
                first->field_list() << ") VALUES (" <<
                first->value_list() << ')';

        Iter it = first + 1;
        while (it != last) {
            MYSQLPP_QUERY_THISPTR << ",(" << it->value_list() << ')';
            ++it;
        }

        return *this;
    }

Thread
Why is there no replace function in query.h that takes two iterators as arguments?David Walthour30 Mar
  • Re: Why is there no replace function in query.h that takes two iterators as arguments?Warren Young30 Mar
    • Re: Why is there no replace function in query.h that takes two iterators as arguments?David Walthour30 Mar