[Dbix-class] automatically applying db-functions on specific fields

Oleg Pronin syber.rus at gmail.com
Mon May 7 11:06:01 GMT 2007


For this to be done automatically,
in your result source Employee:

__PACKAGE__->resultset_attributes({
     +select =3D> [ \"AES_DECRYPT(field_name,'password')" ],
     +as     =3D> [qw/ decrypted_field_name /],
});


2007/5/7, "Dieter Sp=E4th" <SHAD0WRUNNER at gmx.de>:
>
>
> -------- Original-Nachricht --------
> Datum: Mon, 07 May 2007 09:44:28 +0200
> Von: quarky at quantentunnel.de
> An: dbix-class at lists.rawmode.org
> Betreff: [Dbix-class] automatically applying db-functions on specific
> fields
>
> > Hi,
> >
> > hope this is not too much a newby question, but it really bugs me.
> >
> > I have a table with encrypted information in one field. Actually it is
> > encrypted with the aes_encrypt function of mysql. I would like to use
> this
> > function to automatically encrypt and decrypt the values in this field
> using
> > the database function, but I do not find any hook where I can attach the
> > function to DBIx::Class. I imagine it to work just automatically
> everytime I
> > insert, update or read values.
> >
> > Any suggestions? (In the unlikely event, that someone might know how to
> > emulate aes_encrypt by using perl on the client side, I would appreciate
> this
> > information too, but I am still interested in usage of db-functions on
> > fields anyways)
> >
> > Best Regards
> > Wolfgang Warner
>
> For reading try this:
>
> $rs =3D $schema->resultset('Employee')->search(undef, {
>      +select =3D> [ \"AES_DECRYPT(field_name,'password')" ],
>      +as     =3D> [qw/ decrypted_field_name /],
> });
>
> More Information can be found
>
>
> http://search.cpan.org/~jrobinson/DBIx-Class-0.07005/lib/DBIx/Class/Manua=
l/Cookbook.pod#Using_database_functions_or_stored_procedures
>
> "Using database functions or stored procedures"
>
> &&
>
> perldoc SQL::Abstract
>
>
> >
> > --
> > "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> > Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
> >
> > _______________________________________________
> > List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> > Wiki: http://dbix-class.shadowcatsystems.co.uk/
> > IRC: irc.perl.org#dbix-class
> > SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> > Searchable Archive:
> > http://www.mail-archive.com/dbix-class@lists.rawmode.org/
>
> --
> FastJack
>
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
>
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive:
> http://www.mail-archive.com/dbix-class@lists.rawmode.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070507/144=
85c35/attachment.htm


More information about the Dbix-class mailing list