[Dbix-class] automatically applying db-functions on specific
fields
"Dieter Späth"
SHAD0WRUNNER at gmx.de
Mon May 7 09:18:48 GMT 2007
-------- 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 = $schema->resultset('Employee')->search(undef, {
+select => [ \"AES_DECRYPT(field_name,'password')" ],
+as => [qw/ decrypted_field_name /],
});
More Information can be found
http://search.cpan.org/~jrobinson/DBIx-Class-0.07005/lib/DBIx/Class/Manual/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
More information about the Dbix-class
mailing list