[prev] [thread] [next] [Date index for 2005/01/11]
Opps replied to Tony instead of the group. my message at bottom Jay Tony Bowden wrote: > On Tue, Jan 11, 2005 at 11:14:59AM +0100, Daniel.Brunkhorst@xxxxxxxx.xx wrote: > >>MySQL provides a function called "password" to store passwords encrypted >>in the DB. I was wondering how I could use that while using Class::DBI >>and its create method. >>Here's what I do now: >>my $dbh = MyClass->db_Main(); >>$dbh->do( "INSERT INTO users VALUES ( $id, $name, password( '$pwd' ) " >>); >>Is there a way to better integrate this with Class::DBI? > > > Is it just during create() or during other calls? > > You might be able to do something with setting the placeholder for the > column to 'PASSWORD(?)' rather than just '?'. But if you only need to > do it sometimes it gets much more complicated. Probably something nasy > involving subclasses the methods that need it and locally overriding > another method... > > Tony I use the the crypt function like: sub triggerSetPassword { my $self = shift; my $beforeValue = shift; my $arg = shift; $arg->{password} = $self->cryptPassword($arg->{password}); } sub cryptPassword { my $self = shift; my $password = shift; return crypt $password, $password; } I doesn't use the DB built-in but works for me Jay
[Fwd: Re: How to use DB functions while doing a create?]
|
Generated at 12:15 on 16 Jan 2005 by mariachi v0.52