Reputation: 1771
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.
Upvotes: 1
Views: 1242
Reputation: 375
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.
Upvotes: 0
Reputation: 147
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.
Upvotes: 2
Reputation: 31
try adding db_schema => "dbo" and odbc_exec_direct => 1, as in:
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}])
Upvotes: 3
Reputation: 39158
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
Upvotes: 0