Re: How to execute file containing sql statements using dbi.

2002-09-23 Thread Tim Bunce

There's also the DBI shell: dbish.

dbish dsn user pass < file.sql

Tim.

On Sun, Sep 22, 2002 at 12:09:06AM +0200, Bart Lateur wrote:
> On Thu, 19 Sep 2002 15:10:50 -0700 (PDT), Arvind Raina wrote:
> 
> >My requirement is to execute a set of sql statements which are stored in a file .
> >
> >I wanted to know if there is any method of doing the same using dbi .
> >
> >If not can you suggest some methods of doing the same.
> 
> What database? If it's mysql, the easiest way would be to do
> 
>   mysql  mydb  
> from the command line (likely with command line options -u for username
> and -p for password). I don't understand why you'd need the involvement
> of DBI, at all.
> 
> -- 
>   Bart.



Re: How to execute file containing sql statements using dbi.

2002-09-23 Thread Rory Campbell-Lange

On 19/09/02, Arvind Raina ([EMAIL PROTECTED]) wrote:
> My requirement is to execute a set of sql statements which are stored
> in a file .
> 
> I wanted to know if there is any method of doing the same using dbi .
> 
> If not can you suggest some methods of doing the same.

For postgres:
psql -U user -d database < file.sql
from the command line on Unix.
-- 
Rory Campbell-Lange 
<[EMAIL PROTECTED]>




Re: How to execute file containing sql statements using dbi.

2002-09-21 Thread Bart Lateur

On Thu, 19 Sep 2002 15:10:50 -0700 (PDT), Arvind Raina wrote:

>My requirement is to execute a set of sql statements which are stored in a file .
>
>I wanted to know if there is any method of doing the same using dbi .
>
>If not can you suggest some methods of doing the same.

What database? If it's mysql, the easiest way would be to do

mysql  mydb 


Re: How to execute file containing sql statements using dbi.

2002-09-20 Thread William McKee

On 19 Sep 2002 at 15:10, Arvind Raina wrote:
> My requirement is to execute a set of sql statements which are stored in a
> file .
> 
> I wanted to know if there is any method of doing the same using dbi .

Sure, open the file with 'open', read the commands and pass them to dbi. 
If you are using taint-checking (you are using taint-checking, aren't 
you?), then you'll need to untaint the data before passing to dbi if you 
are inserting data into the db (I'm not sure if other operations with 
tainted data will cause an error or not...). See perlsec for details on 
untainting.

Good luck,
William

-- 
 Lead Developer
 Knowmad Services Inc. || Internet Applications & Database Integration
 http://www.knowmad.com
 




How to execute file containing sql statements using dbi.

2002-09-20 Thread Arvind Raina


Hi ,

My requirement is to execute a set of sql statements which are stored in a file .

I wanted to know if there is any method of doing the same using dbi .

If not can you suggest some methods of doing the same.

Thanks ,

Arvind



-
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!