def xsqlofa(values, table, cols, addcol=[], sameval=[]):
    """ returns operation and values for cursor.execute """
    cols = cols.split(',')
    psql = 'insert into ' + table + '('
    sql = ''
    params = []
    for i in cols:
        psql = psql + i.strip() + ','
    if len(addcol) > 0:
        for i in range(len(addcol)):
            psql = psql + addcol[i] + ','
    psql = psql[0:-1]
    psql = psql + ') values ('
    for j in range(len(cols)):
        x = '%s'
        sql = sql + '"' + x + '"' + ','
    sql = psql + sql[0:-1] + ')'
    for i in values:
        for j in range(len(cols)):
            if j < len(i):
                x = str(i[j])
            else:
                x = ''
            params.append(x)
        if len(addcol) > 0:
            for i in range(len(addcol)):
                params.append(sameval[i])
    return sql, params
