'Method responsible for dumping the database into SQL,
excluding the tables that should not be synced between nodes.'

def dump(self):

    cur = self.cursor()
    cur.executelocal("select    name    from    sqlite_master    where    type    =    'table'")
    script = []
    for row in cur.fetchall():
        table = row[0]
        if (table in NO_SYNC_MAP):
            tbloptions = NO_SYNC_MAP.get(table)
            if (not tbloptions):
                continue
        cur.executelocal(("PRAGMA    table_info('%s');" % table))
        fieldnames = [i[1] for i in cur.fetchall()]
        script.append(('DELETE    FROM    %s' % table))
        cur.executelocal(('SELECT    %s    FROM    %s' % (("'INSERT    INTO    %s    (%s)    VALUES    ('    ||    %s    ||')'" % (table, ',    '.join([('`%s`' % f) for f in fieldnames]), "    ||    ','    ||    ".join([('quote(`%s`)' % field) for field in fieldnames]))), table)))
        for row in cur.fetchall():
            script.append(row[0])
    return script
