def sqlupdate(table, rowupdate, where):
validate_name(table)<EOL>fields = sorted(rowupdate.keys())<EOL>validate_names(fields)<EOL>values = [rowupdate[field] for field in fields]<EOL>setparts = [field + '<STR_LIT>' for field in fields]<EOL>setclause = '<STR_LIT:U+002CU+0020>'.join(setparts)<EOL>sql = "<STR_LIT>".format(table) + setclause<EOL>(whereclause, wherevalues) = sqlwhere(where)<EOL>if whereclause:<EOL><INDENT>sql = sql + "<STR_LIT>" + whereclause<EOL><DEDENT>return (sql, values + wherevalues)<EOL>
Generates SQL update table set ...
    Returns (sql, parameters)

    >>> sqlupdate('mytable', {'field1': 3, 'field2': 'hello'}, {'id': 5})
    ('update mytable set field1=%s, field2=%s where id=%s', [3, 'hello', 5])