Re: "source" command problem

2001-11-29 Thread Paul DuBois

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



   -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.




Note that the "source" line you show above doesn't end with a semicolon.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: "source" command problem

2001-11-29 Thread Shankar Unni

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.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: "source" command problem

2001-11-28 Thread sherzodR


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 query.sql file:

CREATE TABLE ( id INT, value CHAR(30) )

-- in source.sql file:

source query.sql

# or \. query.sql

[/EXAMPLE]

Then you can envoke your source.sql script the same way as you do others



Paul DuBois wrote:

PD: >  > database,sql,query,table
PD: >
PD: >
PD: >I notice that "source" is only accepted at the *command line*. This
PD: >means that I can't source a script that sources another file.
PD: >
PD: >I guess "source" is implemented in some special way that prevents it
PD: >from being recursively used?
PD: >
PD: >Is there a way to do what I want (have scripts call other scripts)?
PD: >
PD: >Thx,
PD: >--
PD: >Shankar.
PD:
PD: SOURCE is a command understood by the mysql client program.  It's not
PD: part of the version of SQL understood by the client.  If you want to use
PD: SOURCE in your scripts, you'll have to parse them yourself and implement
PD: it on the client side.
PD:
PD: -
PD: Before posting, please check:
PD:http://www.mysql.com/manual.php   (the manual)
PD:http://lists.mysql.com/   (the list archive)
PD:
PD: To request this thread, e-mail <[EMAIL PROTECTED]>
PD: To unsubscribe, e-mail 
<[EMAIL PROTECTED]>
PD: Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
PD:

-- 
sherzodR <[EMAIL PROTECTED]>
use CGI::Session;


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: "source" command problem

2001-11-28 Thread Paul DuBois

>  > database,sql,query,table
>
>
>I notice that "source" is only accepted at the *command line*. This 
>means that I can't source a script that sources another file.
>
>I guess "source" is implemented in some special way that prevents it 
>from being recursively used?
>
>Is there a way to do what I want (have scripts call other scripts)?
>
>Thx,
>--
>Shankar.

SOURCE is a command understood by the mysql client program.  It's not
part of the version of SQL understood by the client.  If you want to use
SOURCE in your scripts, you'll have to parse them yourself and implement
it on the client side.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




"source" command problem

2001-11-28 Thread Shankar Unni

 > database,sql,query,table


I notice that "source" is only accepted at the *command line*. This means 
that I can't source a script that sources another file.

I guess "source" is implemented in some special way that prevents it from 
being recursively used?

Is there a way to do what I want (have scripts call other scripts)?

Thx,
--
Shankar.





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php