[Dbix-class] dirty-flag on inflated columns
Marc Mims
marc at questright.com
Wed May 13 19:10:18 GMT 2009
* Matt S Trout <dbix-class at trout.me.uk> [090513 09:29]:
> On Tue, May 12, 2009 at 01:51:00PM -0700, Marc Mims wrote:
> > * Matt S Trout <dbix-class at trout.me.uk> [090512 11:34]:
> > > On Mon, May 11, 2009 at 12:14:07PM -0700, Marc Mims wrote:
> > > > * Matt S Trout <dbix-class at trout.me.uk> [090511 10:29]:
> > > > > Thoughts on whether make_column_dirty should clear the deflated value if an
> > > > > inflated one is present, guys?
> > > >
> > > > That would break DBIx::Class::InflateColumn::FS, causing it to leave an
> > > > orphaned file in the file system.
> > >
> > > Why?
> >
> > FS uses the deflated value to determine whether it needs to overwrite an
> > existing file or create a new file. If the deflated value is cleared by
> > make_column_dirty, FS will always make a copy, potentially orphaning a
> > file in fs_column_path.
>
> That's a bug. Deflation should not be dependent on the deflated value even
> being there - store_inflated_column for e.g. deletes the deflated value.
Ok. So, now how to fix it?
I need a unique filename to deflate to, but I only want to create it
once. Rather than using the deflated value {_column_data}{$column}, I
can create {_fs_column_filename}{$column} and use it, instead. I need
to populate {_fs_column_filename} when a row is read from the db. Looks
like I can do that by extending inflate_result.
Does that sound like the correct way for FS to deal with it?
> So your code was already broken, you just hadn't noticed yet - doc patches
> to ::InflateColumn on writing safe inflators very welcome :)
Obviously, I don't know how to write a safe inflator, yet. :)
-Marc
More information about the DBIx-Class
mailing list