On Mon, May 16, 2011 at 10:31 PM, Octavian Rasnita <span dir="ltr"><<a href="mailto:orasnita@gmail.com">orasnita@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff">
<div><b>From:</b> <a title="moseley@hank.org" href="mailto:moseley@hank.org" target="_blank">Bill
Moseley</a> </div>
<blockquote style="padding-right:0px;padding-left:5px;margin-left:5px;border-left:#000000 2px solid;margin-right:0px"><div class="im">
<div><font face="Arial" size="2"></font><font face="Arial" size="2"></font><br></div>
<div><font face="Arial" size="2"></font><br></div>I have two databases that are
very similar. For example, the "person" table in one db has an "email"
column and the other does not have that column, otherwise the tables are the
same.
<div><font face="Arial" size="2"></font><br></div>
<div>My application uses the schema with the table that has the "email"
column, so there's places in the application that call $person->get_column(
'email' ), and also $person_rs->create( { name => $name, email =>
$email } ); </div>
<div><font face="Arial" size="2"></font><br></div>
<div>Now, I want to use the second schema with the same application, but as
mentioned above does not have an "email" column on the person table.
it's not important that the column does not exist.</div>
<div><font face="Arial" size="2"></font><br></div>
<div>My question is what can I do to make get_column and create (and other
methods that assume there is an "email" column) work without this column
defined in the result class. Is there any way to have define a column
that is never used when constructing database queries?</div>
<div><font face="Arial" size="2"></font><font face="Arial" size="2"></font><br></div>
<div><font face="Arial" size="2"></font><font face="Arial" size="2"></font><font face="Arial" size="2"></font><br> </div>
</div><div><font face="Arial" size="2">Hi,</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Use in the Result class:</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">__PACKAGE__->mk_group_accessors( simple =>
'email' );</font></div></blockquote></div></blockquote><div>No. Although that makes an accessor (just as my "sub email {}" example would provide) it doesn't register a column so ->get_column and ->create will still fail.</div>
<div><br></div><div><br></div></div><br>-- <br>Bill Moseley<br><a href="mailto:moseley@hank.org" target="_blank">moseley@hank.org</a><br>