On Jul 19, 2005, at 6:03 PM, Rick Widmer wrote:
John Simpson wrote:

and if so, does mysql have any guaranteed order that it will present the records with an explicit ORDER BY clause in the query?

There is no ORDER BY clause in the query, so the order the records is random. They may appear to follow the order they were entered in, but adds and deletes can change the order.

that's what i figured from quickly glancing through the code- it's nice to know i didn't miss anything.

second, if a user has one or more existing valias records, the "valias -i" command would seem to work by sending an INSERT query with the new line. is the new line added to the beginning of the sequence, the end of the sequence, or is there in fact no guaranteed sequence at all?

If there is no ORDER BY clause in a query the order the records are returned in is random, and subject to change without notice. We need to add an order field, and an ORDER BY clause, but it hasn't happened yet.

i don't know that i'll have the free time, but i'm certainly willing to look at it.

so what's actually needed would be:

- a sequence field in the table, integral type, 32-bit unsigned integer (i would say limit it to 8 or 16 bits, but you never know...)

- vdelivermail.c needs an ORDER BY clause. it may also need to be modified to treat exit code 99 from a program delivery the same way qmail-local does (i.e. treat it as a success but stop processing alias lines) unless i'm missing something and it already does this?

- need a script to convert a non-sequence table into a sequence table. this involves creating a new table with the sequence field, copying the old table to the new one (manually creating the sequence for all entries), deleting the old table, and renaming the new one to the old name. it could also identify any "problem" mailboxes- those with multiple lines, at least one of which is a program delivery.

- valias.c needs the same ORDER BY clause as vdelivermail.c (for use when listing aliases.) we may also want a "-n" command line flag which makes "-s" show the seqence numbers in addition to the current output (but don't change the output, that would break scripts which depend on this output.)

- the valias_insert() functions in vmysql.c, vpalias.c, and vpgsql.c need a fourth parameter, a sequence number (unsigned). technically it's how many lines to skip before adding the new entry- 0 means "add at the beginning", 1 means "skip the first line and then insert the new one", and so forth... anything >= number of lines in the file is treated as "add to the end". the functions need to be able to re- number the existing rules in the database as needed to maintain the correct sequence.

- dotqmail2valias.c needs to make all of its calls with -1 as the sequence, meaning that all rules added would be added to the end of whatever instructions are already there for that alias.

- valias.c would use the new "-n" command line option to specify the sequence for the new rule added by the "-i" option. (i'm assuming that "-i" and "-s" are mutually exclusive in the code.)

am i missing anything?

| John M. Simpson - KG4ZOW - Programmer At Large |
| http://www.jms1.net/           <[EMAIL PROTECTED]> |
| Mac OS X proves that it's easier to make UNIX  |
| pretty than it is to make Windows secure.      |

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to