On 8/24/06, James Masters <[EMAIL PROTECTED]> wrote:
Thanks for the advice.  I have been re-reading the documentation and have made some progress by using the Loader Debugger.
 
Firstly, let me reply to your 2 points.  Of course, I did first try to use ->load_classes.  This didn't work - the error said I was missing a module; I can't remember the name of it now but I couldn't find a win32 version of it so gave up

First, you should stop right there and work on that problem.  What is this missing module, why is it missing, and can it be fixed?  This doesn't sound sane/normal.  I've haven't heard about people who cannot use load_classes.  And no, "use MG::Schema::Foo" is *not* an adequate substitute.

Anyway, with the debugger, I have learnt that the Loader was working fine. I can see all the tables, columns and PKs being loaded.  Also I got the resultsets to work - the problem was that I was specifying CountryCode (which is indeed the correct name of my column) but to get it to work I have to use lower case "countrycode".  Someone has told me that this is because MySQL columns are not case-sensitive and all columns are stored in lower case.  [ Still, I don't think this is ideal behaviour personally as I like my "cased" column names.  Wouldn't a better behaviour be for the methods to accept any case?  Not sure if possible as might mess up other database interfaces - just wondering. ]

The Loader currently does force all column names to lower case.  Normal DBIx::Class lets you specify them however you like, and honors that specification.  The decision to lowercase them all in Schema::Loader just makes the code *much* simpler than dealing with all of the cross-vendor case issues that exist for what Loader is doing.  At least for the time being, if you want CamelCase column names in DBIx::Class, you have to do it for yourself.

However, I am left with a problem.  The following error:
 
Attempt to free unreferenced scalar: SV 0x1fa7a5c, Perl interpreter: 0x224234 at C:/Perl/site/lib/SQL/Abstract/Limit.pm line 325.
occurs every time I attempt to use a resultset.  Tinkering has established that it occurs with each of the following lines.
my @livecountries = $schema->resultset('Country')->search(live => 'Y');
my $m = $schema->resultset('Country')->next->countryname;
my @allcountries = $schema->resultset('Country')->all;
my $country  = $schema->resultset('Country')->find(1)->countryname;
my $r = $schema->resultset('Region')->find(1)->regionname;
my $p = $schema->resultset('Product')->find(1)->description;
If I put all 6 lines, it occurs 6 times.  It happens if this is the last thing in the script.
 
This only happens when the schema is loaded via Loader - it did not appear when the schema was loaded via my manually created module. The Loader debugger does not give any clues.  If anyone can point me in the right direction for further reading/investigation, I'd be very grateful.

The error itself is pointing you somewhere.  What's on line 325 of S::A::L? (and what version do you have installed from where?).

-- Brandon

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to