[CDBI] Connection with a fixed "where" clause.

Brian Phillips bpphillips at gmail.com
Mon Aug 22 12:17:24 BST 2005

Class::DBI::View *might* do what you're wanting

On 8/22/05, Karl.Moens at marsh.com <Karl.Moens at marsh.com> wrote:
> Hi ListMembers, 
> Is it possible to have a class with a fixed "where" clause? 
> I was thinking of the following situation. I have a big database with a 
> lot of customer related info (let's say ordering info). I would like to have 
> one Catalyst application to access this database, but depending on who is 
> using it, they should only be able to see the records of one customer only. 
> I probably can do it by adding some hidden fields in the forms or some 
> parameters in the URL and build a "where" clause out of it for each access, 
> but that would be easy to "break" and thus allow the user to see other 
> customers' data. Therefore I was thinking of setting up a CDBI-class which 
> would have this "where" clause built-in, so that it was impossible to get 
> outside of the allowed set of records (it would be like some sort of "VIEW" 
> on the database, but the version of MySQL I'm using doesn't support VIEWs 
> yet). All I would have to do is to switch to another Model-class if the 
> customer changes. The way Catalyst works it would be transparent for the 
> rest of the application. 
> But can it be done in CDBI? 
> I haven't written any code yet, it is just a thought experiment right now 
> to see if it can be done at all. Any pointers in the right direction (or a 
> simple" It cannot be done") will help. 
> Karl 
> (aka CountZero on PerlMonks) 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> This message and any attachments are confidential. If you have received 
> this message in error please delete it from your system. If you require any 
> assistance please notify the sender. Thank You.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
> _______________________________________________
> ClassDBI mailing list
> ClassDBI at lists.digitalcraftsmen.net
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/mailman/private/classdbi/attachments/20050822/68963f05/attachment.htm

More information about the ClassDBI mailing list