# HG changeset patch # User Pascal Volk # Date 1296673434 0 # Node ID 7518d927d4432c2ba7af164fab858d4253fac088 # Parent af56cee51e677ee2089f74e1b871d6b93f16f60f VMM/*: Use target column names in all INSERT statements. In order to avoid trouble after the definition of a table was changed. diff -r af56cee51e67 -r 7518d927d443 VirtualMailManager/alias.py --- a/VirtualMailManager/alias.py Tue Feb 01 16:57:09 2011 +0000 +++ b/VirtualMailManager/alias.py Wed Feb 02 19:03:54 2011 +0000 @@ -125,8 +125,9 @@ return destinations self._check_expansion(len(destinations)) dbc = self._dbh.cursor() - dbc.executemany("INSERT INTO alias VALUES (%d, '%s', %%s)" % - (self._gid, self._addr.localpart), + dbc.executemany("INSERT INTO alias (gid, address, destination) " + "VALUES (%d, '%s', %%s)" % (self._gid, + self._addr.localpart), ((str(destination),) for destination in destinations)) self._dbh.commit() dbc.close() diff -r af56cee51e67 -r 7518d927d443 VirtualMailManager/aliasdomain.py --- a/VirtualMailManager/aliasdomain.py Tue Feb 01 16:57:09 2011 +0000 +++ b/VirtualMailManager/aliasdomain.py Wed Feb 02 19:03:54 2011 +0000 @@ -75,8 +75,8 @@ raise ADErr(_(u"The target domain '%s' doesn't exist.") % self._domain.name, NO_SUCH_DOMAIN) dbc = self._dbh.cursor() - dbc.execute('INSERT INTO domain_name VALUES (%s, %s, FALSE)', - (self._name, self._domain.gid)) + dbc.execute('INSERT INTO domain_name (domainname, gid, is_primary) ' + 'VALUES (%s, %s, FALSE)', (self._name, self._domain.gid)) self._dbh.commit() dbc.close() self._gid = self._domain.gid diff -r af56cee51e67 -r 7518d927d443 VirtualMailManager/domain.py --- a/VirtualMailManager/domain.py Tue Feb 01 16:57:09 2011 +0000 +++ b/VirtualMailManager/domain.py Wed Feb 02 19:03:54 2011 +0000 @@ -166,10 +166,11 @@ DOMAIN_EXISTS) assert self._directory is not None and self._transport is not None dbc = self._dbh.cursor() - dbc.execute("INSERT INTO domain_data VALUES (%s, %s, %s)", (self._gid, - self._transport.tid, self._directory)) - dbc.execute("INSERT INTO domain_name VALUES (%s, %s, %s)", (self._name, - self._gid, True)) + dbc.execute('INSERT INTO domain_data (gid, tid, domaindir) VALUES ' + '(%s, %s, %s)', (self._gid, self._transport.tid, + self._directory)) + dbc.execute('INSERT INTO domain_name (domainname, gid, is_primary) ' + 'VALUES (%s, %s, TRUE)', (self._name, self._gid)) self._dbh.commit() dbc.close() self._new = False diff -r af56cee51e67 -r 7518d927d443 VirtualMailManager/relocated.py --- a/VirtualMailManager/relocated.py Tue Feb 01 16:57:09 2011 +0000 +++ b/VirtualMailManager/relocated.py Wed Feb 02 19:03:54 2011 +0000 @@ -82,7 +82,8 @@ dbc = self._dbh.cursor() if not update: - dbc.execute('INSERT INTO relocated VALUES (%s, %s, %s)', + dbc.execute('INSERT INTO relocated (gid, address, destination) ' + 'VALUES (%s, %s, %s)', (self._gid, self._addr.localpart, str(self._dest))) else: dbc.execute('UPDATE relocated SET destination = %s WHERE gid = %s ' diff -r af56cee51e67 -r 7518d927d443 VirtualMailManager/transport.py --- a/VirtualMailManager/transport.py Tue Feb 01 16:57:09 2011 +0000 +++ b/VirtualMailManager/transport.py Wed Feb 02 19:03:54 2011 +0000 @@ -96,8 +96,8 @@ dbc = self._dbh.cursor() dbc.execute("SELECT nextval('transport_id')") self._tid = dbc.fetchone()[0] - dbc.execute('INSERT INTO transport VALUES (%s, %s)', (self._tid, - self._transport)) + dbc.execute('INSERT INTO transport (tid, transport) VALUES (%s, %s)', + (self._tid, self._transport)) self._dbh.commit() dbc.close()