List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:November 29 2001 6:40pm
Subject:Re: "source" command problem
View as plain text  
At 10:33 AM -0800 11/29/01, Shankar Unni wrote:
>sherzodR wrote:
>
>>Well, Paul, i think he means using source in an .sql script.
>>Yes you can, Shankar. I used it several times for several reasons :)
>>
>>And u can envoke your sql script the same as you use your other
>>scripts.
>>
>>[EXAMPLE]
>>[...]
>>-- in source.sql file:
>>
>>source query.sql
>>
>># or \. query.sql
>>[/EXAMPLE]
>
>
>Thanks - that last one (using \.) worked. Using "source" doesn't. In 
>the above example, if you had the line
>
>    source query.sql
>
>in source.sql, then you can't do
>
>% mysql
>mysql> source source.sql
>ERROR 1064: You have an error in your SQL syntax near 'source 
>query.sql' on line 1.
>
>But using
>
>   \. query.sql
>
>works. So that lets me get on with the scripts.. Thanks again.
>
>--
>Shankar.

Ah.  If that's the case, then perhaps you are being bitten by the
--no-named-commands option:

% mysql --help

<snip>

   -g, --no-named-commands
			Named commands are disabled. Use \* form only, or
                         use named commands only in the beginning of a line
                         ending with a semicolon (;) Since version 10.9 the
                         client now starts with this option ENABLED by
                         default! Disable with '-G'. Long format commands
                         still work from the first line.
   -G, --enable-named-commands
                         Named commands are enabled. Opposite to -g.

<snip>


Note that the "source" line you show above doesn't end with a semicolon.
Thread
"source" command problemShankar Unni29 Nov
  • Re: "source" command problemPaul DuBois29 Nov
    • Re: "source" command problemsherzodR29 Nov
      • Re: "source" command problemShankar Unni29 Nov
        • Re: "source" command problemPaul DuBois29 Nov