From: Warren Young Date: June 30 2008 6:09am Subject: Re: Query::update List-Archive: http://lists.mysql.com/plusplus/7713 Message-Id: <8821B050-8E11-42EE-9465-2C82CB340810@etr-usa.com> MIME-Version: 1.0 (Apple Message framework v924) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Jun 29, 2008, at 11:23 PM, Soul Boy wrote: > you need to access the database twice No, actually, you don't. The second parameter to the sql_create_x sets the first N members of the SSQLS as key fields, which are used in building the UPDATE statement. Thus, if I have a table with a single unique key field (call it "id"), then I can update the row where id=42 like this: sql_create_X(foo, 1, 0, mysqlpp::sql_int, id, other, fields, go, here) foo new_row(5000, init, other, parameters); query.update(foo(42), new_row); query.execute(); This builds a query of the form: "UPDATE foo SET (id=5000,...) WHERE (id=42)" This works because we said the first field of foo is the unique key column, so we got a 1-parameter ctor taking mysqlpp::sql_int. We passed a temporary foo to update(), with only this first field set.