Most web applications have a single user accessing the database. When I say single user I mean a single DATABASE user. However, most databases are designed such that users are granted privileges. Check: Principle of Least Privilege.

Views are awesome. They let you define a query and treat that query as a table. So you can easily sort and filter on aggregate values and limit what certain users can see. It can severely reduce the amount of complex SQL that is sprinkled throughout your code - instead of multiple long join queries there are smaller ones that are easier to digest.

I don't think interacting with a view via Class::DBI would be beneficial, you don't update a view but rather the tables behind the view. People are mentioning updatable views, but to me that seems wicked because your view could contain aggregate data, and then what?

In reply to Re: [Semi-OT] Views, Stored Procedures, and Class::DBI by saberworks
in thread [Semi-OT] Views, Stored Procedures, and Class::DBI by jgallagher

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.