Re: SOURCE command somewhere in manual?

2001-11-27 Thread Benjamin Pflugmann

Hi.

On Tue, Nov 20, 2001 at 09:07:58AM +0800, [EMAIL PROTECTED] wrote:
 The bitbybit.dk MySQL FAQ says:
 
 
 How do I use a batch file with MySQL?
 
 From within the MySQL client (v. 3.23.9 and above):
 
 mysql SOURCE filename
 
 
 Is there really a SOURCE command?

An explanation why you did not simply try it, would be nice. Maybe
that would have helped to get an early answer.

 Where is it in the official manual?

This is part of the command line client, the belonging manual section
is http://www.mysql.com/doc/m/y/mysql.html

 Also, if you have 
 
 
 mysql set @var = xyz;
 mysql SOURCE filename
 
 
 can @var be used in filename?

I am not certain about what you mean, but I presume you mean whether a
command within the file may make use of @var?

If so, the answer is yes. SOURCE runs the commands in 'filesname' just
as if you had typed them by hand. It should be the same as if you
would copypaste the commands from an editor to the client.

Bye,

Benjamin.

-- 
[EMAIL PROTECTED]

-
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 somewhere in manual?

2001-11-27 Thread Uriel Wittenberg

  Is there really a SOURCE command?

 An explanation why you did not simply try it, would be nice. Maybe
 that would have helped to get an early answer.

  Where is it in the official manual?

 This is part of the command line client, the belonging manual section
 is http://www.mysql.com/doc/m/y/mysql.html

The point is, you can't find it in the manual. It's not in the command
index and I wasn't able to find it when I searched.




-
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 somewhere in manual?

2001-11-20 Thread Giuseppe Maxia


 Is there really a SOURCE command? Where is it in the official manual?

source is a command available within the mysql client only. It is not a SQL command.
The client can also get external batch files by piping the commands, in Unix style.
Once you have your file of SQL instructions (say lines.sql) you can call the client 
$ mysql -u username -p  lines.sql


 
 mysql set @var = xyz;
 mysql SOURCE filename
  
 can @var be used in filename?

Yes, it can.
Variables are valid within the same thread.

$ echo select @var;  hhh.sql
$ mysql -p -u xyz

mysql select @var:=curdate();
+-+
| @var:=curdate() |
+-+
| 2001-11-20  |
+-+
1 row in set (0.00 sec)

mysql source hhh.sql
++
| @var   |
++
| 2001-11-20 |
++
1 row in set (0.00 sec)

mysql select @var:=AAA;
+-+
| @var:=AAA |
+-+
| AAA |
+-+
1 row in set (0.00 sec)

mysql source hhh.sql
+--+
| @var |
+--+
| AAA  |
+--+
1 row in set (0.00 sec)

Bye
Giuseppe





-
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