[Gambas-user] import mysql dump EXEC or SHELL?

Ron_1st ronstk at ...239...
Wed Dec 17 04:37:02 CET 2008


On Tuesday 16 December 2008, Doriano Blengino wrote:
> Ron_1st ha scritto:
> > On Tuesday 16 December 2008, wig wrote:
> >   
> >>  sImport = "< " & Application.Path & "/mytables.sql"
> >>
> >>  EXEC ["mysql", sUser, sPassword, sHost, sDatabase, sImport]
> >>
> >>     
> >
> >   sImport = "< "
> >   sSqlFile = Application.Path & "/mytables.sql"
> >
> >   EXEC ["mysql", sUser, sPassword, sHost, sDatabase, sImport, sSqlFile ]
> >
> > Every item on the line for EXEC should be a seprate item in the array.
> > The "<" is a seperate item/part of the line, it has space on both adjacent sides!
> >   
> No,
> 
> the "<" construct is a shell construct, not a linux/unix one. It is 
> /bin/sh, or whatever, which interprets this notation and does a lot of 
> job about it.
> The gambas SHELL instruction calls /bin/sh, which is powerful 
> (environment, PATH search, redirection and much more), so you can use 
> all its features.
> 
> EXEC calls the unix system call execXX() (there are various) which are 
> faster but not as powerful as /bin/sh.
> 
> I think the most notably differences are:
> 1. Using SHELL you specify the command to execute as you would do on the 
> command line. ls is ls, and fdisk is fdisk. In EXEC, you *must* specify 
> the correct path: /bin/ls, /sbin/fdisk... - Linux won't search the file 
> for you. EXEC ["mysql", ...] can not work.
> 
> 2. Again, parameters and constructs of SHELL are the same as those in 
> the command line; you can use < > | and so on, and must quote words 
> which contain spaces and other special chars. Using EXEC you don't have 
> (well, you must not) quote parameters. and you don't have /bin/sh 
> constructs.
> 
> Regards,
> 

Thanks for explaination.

When I do understand it correct the error in the line
> >   EXEC ["mysql", sUser, sPassword, sHost, sDatabase, sImport, sSqlFile ]
is the missing path for "mysql" (?)


Best regards
Ron_1st

 




More information about the User mailing list