'Receives the dump from the other side, executing via script within
a transaction.'

def dump_recv(self, script):

    cur = self.cursor()
    cur.executelocal("select    name    from    sqlite_master    where    type    =    'table'")
    for row in cur.fetchall():
        table = row[0]
        if (table not in NO_SYNC_MAP):
            continue
        tbloptions = NO_SYNC_MAP.get(table)
        if (not tbloptions):
            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])
        else:
            fieldnames = tbloptions['fields']
            cur.executelocal(('SELECT    %s    FROM    %s' % (("'UPDATE    %s    SET    '    ||    %s    ||    '    WHERE    id    =    '    ||    id" % (table, "    ||    ',    '    ||    ".join([("'`%s`    =    '    ||    quote(`%s`)" % (f, f)) for f in fieldnames]))), table)))
            for row in cur.fetchall():
                script.append(row[0])
    cur.executescript(';'.join(((['PRAGMA    foreign_keys=OFF', 'BEGIN    TRANSACTION'] + script) + ['COMMIT;'])))
    with Journal() as j:
        j.queries = []
    return True
