You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Jaak <va...@hot.ee> on 2002/08/21 22:57:33 UTC

DBIx::Recordset and mySQL PASSWORD()

Hello,

I am using

 *db = DBIx::Recordset -> Insert ({'!DataSource'    => $req->{db}->{dsn},
                                   '!Username'   => $req->{db}->{username},
                                   '!Password'   => $req->{db}->{password},
                                   '!Table'         => 'users',
                                   'uid'            => $regusername,
                                   'email'         => $regemail,
                                   'passwd'      => $rnd_pass
                                  }) ;

How to insert into database something like INSERT INTO ... VALUES ( 
PASSWORD($rnd_pass)  ); ?

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: DBIx::Recordset and mySQL PASSWORD()

Posted by Gerald Richter <ri...@ecos.de>.
>How to insert into database something like INSERT INTO ... VALUES

>PASSWORD($rnd_pass)  ); ?

You need to prefix the field name with a \, then the value gets copied
literaly into the sql statmenet:

 *db = DBIx::Recordset -> Insert ({'!DataSource'    => $req->{db}->{dsn},
                                   '!Username'   => $req->{db}->{username},
                                   '!Password'   => $req->{db}->{password},
                                   '!Table'         => 'users',
                                   'uid'            => $regusername,
                                   'email'         => $regemail,
                                   '\passwd'      => "PASSWORD($rnd_pass)"
                                  }) ;

Gerald

P.S. Make sure $rnd_pass is checked correctly before, because it gets
literaly inserted in the SQL, so if any bad guy enters some SQL that you
don't expect, who knows what will happen...

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org



-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org