Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Does DBI::Shell work for you?

by jZed (Prior)
on Mar 05, 2005 at 20:09 UTC ( #436955=note: print w/replies, xml ) Need Help??


in reply to Does DBI::Shell work for you?

DBI::Shell and dbish are great. There's a lot in there although the interfaces is sometimes confusing. The basic thing you're missing, I think is a DSN. Try something along the lines of dbish dbi:DBM: e.g. for using DBD::DBM. Note this should be everthing that normally goes in the DSN, including the colon after the driver name. You can also add user, password and other flags as arguments to dbish, including --batch which runs it in batch mode (e.g. reading a bunch of SQL from a file and executing it).

Replies are listed 'Best First'.
Re^2: Does DBI::Shell work for you?
by saintmike (Vicar) on Mar 05, 2005 at 20:54 UTC
    Supplying DSN, user and password on the command line as in
    dbish dbi:mysql root ""
    brings up a list of databases, selecting one by number asks for the password again (tsk, tsk!):

    Connecting to 'DBI:mysql:sometable' as 'root'... Password for root ( not echoed to screen):
    which, after confirming it's empty, brings up a shell accepting SQL commands and executing them after entering a semicolon. Very similar to the mysql command line utility.

    But how would I get back out to the previous view, to get the list of databases again? Are there ways other than the native SQL commands (show tables; show columns from tablename) to display the schema(s)? Can I load data into variables and look at them? Guess I'm just confused with the interface. I was expecting more than what a native SQL client provides, guess it's somewhere hidden in there, I'm just not sure how to submit shell commands other than SQL statements, executed as soon as the semicolon gets entered.

      > But how would I get back out to the previous view, to get
      > the list of databases again?
      
      /connect then enter
      >Are there ways other than the native SQL commands
      >(show tables; show columns from tablename) to display
      >the schema(s)?
      
      /col_info /table_info etc. ... type /help and press enter for a list

      > Can I load data into variables and look at them?
      
      Yes, you can, though I forget whether that's something I had to patch.
      >I'm just not sure how to submit shell commands other than 
      > SQL statements, executed as soon as the semicolon gets 
      > entered.
      
      type a forward slash, the command, then press enter
        That was the missing piece! It's hard to believe, but the man page indeed doesn't mention it. Thanks for your help!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://436955]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-08-14 12:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?