// Get the user id for a user-name.
Select (user_idnr) from users where (userid = 'john');
user_id_var = GetSelectResult();
// Get maximum mail box size allow for a specific user.
select (maxmail_size) from users where (user_idnr = user_id_var);
maxmailbox_size = GetSelectResult();
// Sum the bytes used for a specific mailbox / user.
select sum(blocksize) from messageblks where (messageblk_idnr =
user_id_var);
current_bytes_used = GetSelectResult();
// Now do something with this spiffy info! ;-)
percent_quota_used = (current_bytes_used / maxmailbox_size)*100;
percent_quota_remaining = 100 - percent_quota_used;
if (percent_quota_remaining < 5)
{
// sound the alarm!
}
Where GetSelectResult() is some API function that gets the string/value
returned from the SQL query... you will have to RTFM on PHP or whatever
you decide to use...
If you want to test the select constructs in a sql-query-editor, you
should probably change variables to a real values.
Hope that helps.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf
> Of Igor Olemskoi
> Sent: Tuesday, January 14, 2003 1:59 PM
> To: Dave Meador
> Subject: Re[2]: [Dbmail] quota
>
> DM> Assume you have a connection context with the dbmail database.
> DM> 1. Query the users table to get the quota value in maxmail_size
for a
> DM> specific user and store the user_idnr around in a variable for use
in
> DM> the next step.
> DM> 2. Query the messageblk table where messageblk_idnr = user_idnr
and
> sum
> DM> the blocksize field for all messages returned for a particular
user.
> DM> That should yield you a total bytes stored for a single mailbox.
> DM> 3. Compare summed bytes against maxmail_size bytes however you
desire.
>
> Can you give me the sample in SQL?
>
>
> Thanks.
>
> _______________________________________________
> Dbmail mailing list
> [email protected]
> https://mailman.fastxs.nl/mailman/listinfo/dbmail