[Dbix-class] Proposed readonly patch for DBIx::Class

Rob Kinyon rob.kinyon at gmail.com
Sun Aug 21 03:03:21 GMT 2011


It'd be nice if DBIC would convert the accessors to read-only. I think
that's the point.

Rob

On Fri, Aug 19, 2011 at 15:55, Darren Duncan <darren at darrenduncan.net> wrote:
> Ben Tilly wrote:
>>
>> Often database schemas have tables that should not be changed at
>> runtime in the application.  It would be convenient to be able to mark
>> this fact in the class.  However to avoid accidents you wind up having
>> to override methods in both the Row class and the ResultSet class.
>> Having to synchronize changes to 2 classes is kind of messy.
>>
>> The attached patch makes this look much nicer in the client code.
>> With this in the Result class you just say:
>>
>>  __PACKAGE__->readonly(1);
>>
>> and now you won't accidentally update that table from in Perl.  It can
>> be unset at any time and so doesn't provide any actual security, but
>> it is a useful hint.
>>
>> Is there any possibility that this could be considered for inclusion
>> in DBIx::Class?
>
> A clean solution to this would be to implement it at the DBMS level, either
> at the connection level where you tell the DBMS to fail all write attempts,
> or at the individual table level using privileges, where the application
> doesn't have privileges to write tables, just read. -- Darren Duncan
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>



-- 
Thanks,
Rob Kinyon



More information about the DBIx-Class mailing list