简体   繁体   中英

Why isn't DBIx::Class::Schema::Loader creating my classes?

I am trying to generate static schemas using DBIx::Class in Perl. The command shown below outputs a Schema.pm and no other files. Any idea what I'm doing wrong, or how to to debug this?

U:\wohlfarj\Software\PARS>perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:.\lib 
-e "make_schema_at('PARS::Schema',{debug=>1},['dbi:ODBC:PARS','user','password',{AutoCommit=>0}])"
Dumping manual schema for PARS::Schema to directory .\lib ...
Schema dump completed.

I'm using Strawberry Perl on Windows XP. The database is SQL Server 2000, accessed through an ODBC connection. I can successfully run queries using plain old DBI with the same ODBC connection.

尝试添加db_schema =>“ dbo”和odbc_exec_direct => 1,如下所示:

perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:.\lib -e "make_schema_at('PARS::Schema',{debug=>1, db_schema => "dbo"},['dbi:ODBC:PARS','user','password',{AutoCommit=>0, odbc_exec_direct => 1}])

I have found that if there are any errors at all in the schema loading, make_schema_at will abort and not write anything at all. Ensure you diagnose any errors it outputs and try again.

In my case, I had debug=>1 set, which then outputs to terminal what it is doing, but it means you can't easily see if there are any errors in amongst all that output. Try setting debug=>0 to check for actual errors.

I have a hunch that .\\lib is not correct. Try again with ./lib or just lib .

> perl -e'print ".\lib"' | hex
0000  2e 69 62                                          .ib

I had the same problem trying to extract a schema (1200 tables!) from a Navision database. I ended up just using a "-o constraint" for the tables I wanted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM