On 6 January 2013 07:30, Denis Arnaud <[email protected]> wrote:
> Hi Mateusz,
>
> [just to stress out the difference,] could you expand the example to have
> several consecutive calls, e.g., incrementing the value by, say, 3.


My example is taken directly from the test6

void test6()
{
    {
        session sql(backEnd, connectString);

        table_creator_for_test6 tableCreator(sql);

        for (int i = 0; i != 10; i++)
        {
            sql << "insert into soci_test(val) values(:val)", use(i);
        }

        statement st1 = (sql.prepare <<
            "update soci_test set val = val + 1");
        st1.execute(false);

        assert(st1.get_affected_rows() == 10);

        statement st2 = (sql.prepare <<
            "delete from soci_test where val <= 5");
        st2.execute(false);

        assert(st2.get_affected_rows() == 5);

        statement st3 = (sql.prepare <<
            "update soci_test set val = val + 1");
        st3.execute(true); // true or false shoudl make no difference,
both should lead to load_one()

        assert(st3.get_affected_rows() == 5);
    }

    std::cout << "test 6 passed" << std::endl;
}

I'm not sure what update it may need.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to