Permalink
Browse files

(9) - full_name virtual column writable + display_column

  • Loading branch information...
vanstyn committed Sep 12, 2013
1 parent e49bd2a commit c8fe46946d27348523e45fd5e4f05837bd681565
Showing with 16 additions and 1 deletion.
  1. BIN chinook.db
  2. +6 −0 cmd_history.sh
  3. +10 −1 lib/RA/ChinookDemo.pm
BIN +0 Bytes (100%) chinook.db
Binary file not shown.
@@ -229,3 +229,9 @@ script/ra_chinookdemo_server.pl
# Setup a virtual column
vim lib/RA/ChinookDemo.pm
Commit '(8) - created "full_name" virtual column'
# Start the test server:
script/ra_chinookdemo_server.pl
#
# Make virtual column writable
vim lib/RA/ChinookDemo.pm
Commit '(9) - full_name virtual column writable + display_column'
@@ -87,6 +87,10 @@ __PACKAGE__->config(
Artist => {
display_column => 'name'
},
Employee => {
# Use virtual column 'full_name' as the display column:
display_column => 'full_name'
},
Genre => {
display_column => 'name',
auto_editor_type => 'combo'
@@ -144,7 +148,12 @@ __PACKAGE__->config(
data_type => "varchar",
is_nullable => 0,
size => 255,
sql => 'SELECT self.firstname || " " || self.lastname'
sql => 'SELECT self.firstname || " " || self.lastname',
set_function => sub {
my ($row, $value) = @_;
my ($fn, $ln) = split(/\s+/,$value,2);
$row->update({ firstname=>$fn, lastname=>$ln });
},
},
},
}, # (virtual_columns)

0 comments on commit c8fe469

Please sign in to comment.