.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "DBIx::Class::Helper::Row::StorageValues 3pm" .TH DBIx::Class::Helper::Row::StorageValues 3pm "2018-04-19" "perl v5.26.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DBIx::Class::Helper::Row::StorageValues \- Keep track of stored vs in\-memory row values .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& package MyApp::Schema::Result::BlogPost; \& \& use parent \*(AqDBIx::Class::Core\*(Aq; \& \& _\|_PACKAGE_\|_\->load_components(qw(Helper::Row::StorageValues)); \& \& _\|_PACKAGE_\|_\->table(\*(AqBlogPost\*(Aq); \& _\|_PACKAGE_\|_\->add_columns( \& id => { \& data_type => \*(Aqinteger\*(Aq, \& is_auto_increment => 1, \& }, \& title => { \& data_type => \*(Aqvarchar\*(Aq, \& length => 32, \& keep_storage_value => 1, \& }, \& body => { \& data_type => \*(Aqtext\*(Aq, \& }, \& ); \& \& 1; \& \& # elsewhere: \& \& my $post = $blog_rs\->create({ \& title => \*(AqComponents for fun and profit\*(Aq, \& body => \*(Aq...\*(Aq, \& }); \& \& $post\->title(\*(AqComponents for fun\*(Aq); \& \& warn sprintf \*(AqChanging title from %s to %s\*(Aq, \& $post\->storage_value(\*(Aqtitle\*(Aq), $post\->title; \& \& $post\->update; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This component keeps track of the value for a given column in the database. If you change the column's value and do not call \f(CW\*(C`update\*(C'\fR, the \f(CW\*(C`storage_value\*(C'\fR will be different; once \f(CW\*(C`update\*(C'\fR is called the \f(CW\*(C`storage_value\*(C'\fR will be set to the value of the accessor. Note that the fact that it uses the accessor is an important distinction. If you are using DBIx::Class::FilterColumn or DBIx::Class::InflateColumn it will get the non-storage or inflated values, respectively. .SH "METHODS" .IX Header "METHODS" .SS "_has_storage_value" .IX Subsection "_has_storage_value" .Vb 1 \& $self\->_has_storage_value(\*(Aqcolname\*(Aq) .Ve .PP returns true if we should store the storage value from the database. Override this if you'd like to enable storage on all integers or something like that: .PP .Vb 2 \& sub _has_storage_value { \& my ( $self, $column ) = @_; \& \& my $info = $self\->column_info($column); \& \& return defined $info\->{data_type} && $info\->{data_type} eq \*(Aqinteger\*(Aq; \& } .Ve .SS "storage_value_columns" .IX Subsection "storage_value_columns" .Vb 1 \& $self\->storage_value_columns .Ve .PP returns a list of columns to store .SS "get_storage_value" .IX Subsection "get_storage_value" .Vb 1 \& $self\->get_storage_value(\*(Aqcolname\*(Aq) .Ve .PP returns the value for that column which is in storage .SH "AUTHOR" .IX Header "AUTHOR" Arthur Axel \*(L"fREW\*(R" Schmidt .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2018 by Arthur Axel \*(L"fREW\*(R" Schmidt. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.