Bill Moseley wrote: > > > On Tue, May 11, 2010 at 8:02 AM, Peter Rabbitson <[email protected] > <mailto:rabbit%[email protected]>> wrote: > > > I didn't see this as a bug in Ordered. Ordered asked for the column > > data and got an undefined value and assumed it was null. Seemed more > > like an example of why might be good for DBIC to throw an > exception if a > > column is accessed w/o being fetched. > > It may or may not be - this is beyond the point. The public API from > day one > has been "you get all columns by default" and "every accessor always > works". > > > But part of the API is also passing in "columns", correct? > > > If you alter the selector, and then do not check that you are asking for > something that *you* did not bring back from the db - you get to > keep the > pieces. In this case Ordered is clearly misusing the API, thus the > problem > is with Ordered, and it will be fixed sooner or later (sooner if we > get a > test case contribution). > > > Guess I still don't follow. I've *given* Ordered an item I fetched w/o > including the position column. It's really my fault for doing that. > Ordered has no way of knowing that the object passed to it didn't fetch > the column it needs, right? Is there currently a way to inspect a row > object and determine what columns were fetched from the store?
This means you didn't even read the original thread, which clearly mentioned http://search.cpan.org/~frew/DBIx-Class-0.08121/lib/DBIx/Class/Row.pm#has_column_loaded So yes, if a component *relies* on some data being available, it *must* ensure it is available (as shown above). > ^^ nowhere do you inform DBIC that there is in fact a unique constraint > on the source/table. The moment you do the appropriate > add_unique_constraint > the SQL will magically change to being correct :) > > > Well, that makes sense. Any exactly why I posted the full example. > > Although now the database takes more of a beating... ;) http://dev.catalystframework.org/svnweb/bast/blame/DBIx-Class/0.08/trunk/lib/DBIx/Class/Ordered.pm Read the comment at lines 791-794, I need a volunteer to make me a list of databases which can do that without stepping on its own toes. Then we can make exceptions based on underlying storage. _______________________________________________ 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/[email protected]
