My sad story.

I am trying to run sqlt on our (large) Oracle schema to produce  
Class::DBI modules.
I first tried with our .sql schema files, but the modules were  
produced (1 per table) without any columns or constraints, or linking  
info.  I think this is because (for whatever reason) our DBA added  
the constraints after the fact (including primary keys, etc) with  
TABLE ALTER rather than directly in the CREATE TABLE command.

No matter, I can just connect directly to the database with -f DBI  
(and DBD::Oracle, etc.) and that should give me some useful modules...

Alas I am stuck. I  cannot get DBI to parse my schema.

Here is a test script:

#! /usr/bin/perl

   use SQL::Translator;
   use DBI;

   my $dbh = DBI->connect('dbi:Oracle:host=yeast;sid=sdev', 'user',  
'pass',
       {
           RaiseError       => 1,
           FetchHashKeyName => 'NAME_lc',
       }
   );

print $dbh->selectrow_array('select count(*) from bud.feature'),"\n";
# a test to make sure I can connect remotely to the DB.


   my $tr          = SQL::Translator->new(
       # Print debug info
       debug               => 1,
       # Print Parse::RecDescent trace
       trace               => 1,
       # Don't include comments in output
       no_comments         => 1,
       # Print name mutations, conflicts
       show_warnings       => 0,
       # Add "drop table" statements
       add_drop_table      => 1,
       # to quote or not to quote, thats the question
       quote_table_names     => 1,
       quote_field_names     => 1,
       # Validate schema object
       validate            => 1,

       parser => 'DBI',
       dbh => $dbh,
   );

$tr->parse();

This (after connecting correctly and printing something) .

gives me:
[SQL::Translator] Got parser: SQL::Translator::Parser::DBI::parse
[SQL::Translator] Got producer: code ref
No DSN at /Library/Perl/5.8.6/SQL/Translator/Parser/DBI.pm line 165.

If I put the dsn directly in the constructor via parser_args => {}, I  
get this (after about 30 seconds)

Can't call method "add_field" on an undefined value at /Library/Perl/ 
5.8.6/SQL/Translator/Parser/DBI/Oracle.pm line 78.

I also get the exact message with command line sqlt -f DBI.

I should also say that this is on Mac OSX 10.4 (Tiger), Perl 5.8.6,  
SQL::Translator 0.08 with ClassDBI.pm shoehorned in from 0.07 (why  
was it dropped, I wonder???)

Thanks for your help,

Ben

--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO  
Consortium
Stanford University ** [EMAIL PROTECTED]




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
-- 
sqlfairy-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlfairy-developers

Reply via email to