>>
>> Most databases have an AUTO_INCREMENT function, so I imagine that in the
>> table definition, the sql definition of the cid is probably something like
>>
>> cid INT NOT NULL AUTO_INCREMENT
>>
>> the AUTO_INCREMENT is what increases the counter.  It is up to the
>> database software to track the counters (not sure how that is done)
>>
>
> Hi,
>
> Thanks for the reply.  But come on dude, give me some credit: I am well
> aware of "AUTO_INCREMENT" types.  The reason why I asked is because
> the solution used by Scoop cannot possibly be a simple AUTO_INCREMENT.

True enough.

grep is your friend.

grepping for "new" and "cid" gives you Comments.pm:

my $new_cid = $S->post_comment();
$cid = $new_cid;

grepping for "post_comment" says to look in Post.pm:

my $cid = $S->_make_cid($sid);

and grepping for "make_cid" gives you Post.pm again:

         # Make new cid
         my ($rv, $sth) = $S->db_select({
                 ARCHIVE => $S->_check_archivestatus($sid),
                 WHAT => 'cid',
                 FROM => 'comments',
                 WHERE => qq|sid = $quoted_sid|,
                 ORDER_BY => 'cid desc',
                 LIMIT => '1',
                 NOCACHE => 1});

         my $cid;
         if ($rv eq '0') {
                 $cid = 1;
         } else {
                 my $last = $sth->fetchrow_hashref;
                 $cid = ($last->{cid} + 1);
         }
         $sth->finish;