On Behalf Of David Wheeler
> Sent: Saturday, 5 August 2006 5:32 a.m.
> 
> > So, my question is: Is there any way to create such a pseudocolumn
> > that can
> > be populated as a result of the values of the other columns?
> 
> If you want to use a real column, you can add it to your table and
> then add a trigger to the table to compute the hash. Something like
> this (in PostgreSQL):
> 
> CREATE OR REPLACE FUNCTION hash_row() RETURNS trigger AS $$
>    NEW.hash = md5(NEW.foo || NEW.bar || NEW.baz);
>    RETURN NEW;
> $$ LANGUAGE sql;
> 
> CREATE TRIGGER hash_row BEFORE UPDATE OR INSERT ON mytable
> FOR EACH ROW EXECUTE PROCEDURE hash_row();
> 

Thanks, David

Alas, I'm using a version of MySQL that doesn't support triggers!

Dan


_______________________________________________
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/[email protected]/

Reply via email to