in reply to Re: Message Reply Sequencing
in thread Message Reply Sequencing

for the sequencing of message_id's, I normally use a database trigger on INSERT, that queries the table searching for the maximum message_id, add 1, and set as the new message_id

Oooooorrrr... you could just add an auto_incremented message_id field and let the database handle the incrementing mechanism. :)

Replies are listed 'Best First'.
Re: Re^2: Message Reply Sequencing
by Roger (Parson) on Dec 03, 2003 at 06:09 UTC
    Well, that could be really nice, but I am using Oracle here that doesn't have this feature unfortunately. :-(

      But Oracle does have sequences, which are very handy indeed for this kind of thing. In fact, I generally like sequences better than auto_increment fields, because they're not so magical, and give lots o' control. You should definitely investigate them, if you haven't.

        I agree with you on the ease of using Oracle sequences. But I am a bit annoyed when Oracle sequences tend to leave 'holes' in the sequence number, when a process dies after fetching the sequence, but before inserting into the table, for example. So I tend to use a trigger on insert instead to simulate a contineous auto sequence.