Hit the wrong button.  The blank line at the after the IF statement at
the end of the code should be "throw new
InvalidUsernameException(...);".

Sorry about that.

cheers,
barneyb


On Wed, 3 Nov 2004 11:35:40 -0800, Barney Boisvert <[EMAIL PROTECTED]> wrote:
> Absolutely I am.  That's the only thing that knows for sure.
> 
> public setUsername(username) {
>  if (username.length() < 5)
>    throw new ValidationException(...);
>  if (username.length() > 15)
>    throw new ValidationException(...);
>  if (REfind("[^a-zA-Z0-9]", username) > 0)
>    throw new ValidationException(...);
>  try {
>    var id = userHome.getUserIDFromUsername(username);
>    // if an id exists, we need to check and see if it matches this object's
>    // id, for when we're calling an update operation.  the column is unsigned
>    // so only positive values are allowed.  getId() returns -1 for unpersisted
>    // objects.
>    if (id != getId())
>      throw new ValidationException(...);
>  } catch (InvalidUsernameException iue) {
>    // good, it's unique.
>  }
> }
> 
> the getUserIdFromUsername method in the userHome object looks like this:
> 
> public getUserIdFromUsername(username)
>  throws InvalidUsernameException
> {
>  var get = "";
>  <cfquery ... name="get">
>    SELECT id
>    FROM user
>    WHERE username = <cfqp value="#username#" ... />
>  </cfquery>
>  if (get.recordCount == 0)
> 
>  return get.id;
> 
> 
> }
> 
-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/blog/

I currently have 0 GMail invites for the taking
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to