> From: Tom Lanyon [mailto:[EMAIL PROTECTED] > > On 19/04/2007, at 12:07 PM, Michael Higgins wrote: > > > Hello, all -- > > > > I am trying to set up a simple relationship using schema. > > > > Problem is, the database has column names like 'Invoice #' > and 'Bill > > To'. > > > > The error code for belongs_to and has_many is "no such > column billto > > on foreign class...". > > > > This is true, of course. It has a space in the name. > > > > How do I get DBIx::Class::Schema to look for the right column? > > > > Any clue or example here greatly appreciated. > > > You need to quote the table/column names. Read the > connect_info() docs on DBIx::Class::Storage::DBI. > > Normally you'd have something like: > > Your::Schema->connect([ $dsn, $user, $pass, \%dbi_opts, > { quote_char => q{`}, name_sep => q{.} } ]);
That did the trick. Thanks for giving a clueless one a leg up. ;-) The only glitch is that I have to define my 'Bill 2 Name' column accessor(?) before I can use it: $bill2name = "Bill 2 Name"; print $clients->$bill2name ... and now I can get some work done. Thanks! > -----Original Message----- > From: Adam Jacob [mailto:[EMAIL PROTECTED] > > Others may be more helpful here, but those are terrible things to do in a database column name. Perhaps a refactoring would be better, if you are already moving twoards DBIx::Class? Yes, I agree. If only... Problem is, I'm accessing SQL 2000 tables that are for an application interface written in MS Access that I don't want to touch. Ever... Renaming the tables is just one thing that needs fixing, believe me. Today, I'm just happy to have unixODBC and DBIC working enough to grab this stuff on my linux machine. Cheers, -- Michael Higgins _______________________________________________ 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]/
