List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:August 9 2005 7:17pm
Subject:bk commit into 5.0 tree (jimw:1.1959) BUG#11523
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1959 05/08/09 12:17:28 jimw@stripped +4 -0
  Fix 'source' command in mysql client to handle delimiter command
  in sourced file properly. (Bug #11523)

  mysql-test/t/mysql_delimiter_source.sql
    1.1 05/08/09 12:17:25 jimw@stripped +8 -0
    New BitKeeper file ``mysql-test/t/mysql_delimiter_source.sql''

  mysql-test/t/mysql_delimiter_source.sql
    1.0 05/08/09 12:17:25 jimw@stripped +0 -0
    BitKeeper file /home/jimw/my/mysql-5.0-11523/mysql-test/t/mysql_delimiter_source.sql

  mysql-test/t/mysql_delimiter.sql
    1.2 05/08/09 12:17:25 jimw@stripped +4 -1
    Add new test

  mysql-test/r/mysql.result
    1.3 05/08/09 12:17:25 jimw@stripped +4 -0
    Add results

  client/mysql.cc
    1.177 05/08/09 12:17:25 jimw@stripped +8 -8
    Rename read_lines() to read_and_execute() and change interface so it
    is clear when we are reading and processing lines interactively versus
    in batch mode or from a file being sourced.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-11523

--- 1.176/client/mysql.cc	2005-07-31 02:49:45 -07:00
+++ 1.177/client/mysql.cc	2005-08-09 12:17:25 -07:00
@@ -203,7 +203,7 @@
            com_edit(String *str,char*), com_shell(String *str, char *);
 #endif
 
-static int read_lines(bool execute_commands);
+static int read_and_execute(bool interactive);
 static int sql_connect(char *host,char *database,char *user,char *password,
 		       uint silent);
 static int put_info(const char *str,INFO_TYPE info,uint error=0,
@@ -468,7 +468,7 @@
 	  "Type 'help [[%]function name[%]]' to get help on usage of function.\n");
 #endif
   put_info(buff,INFO_INFO);
-  status.exit_status=read_lines(1);		// read lines and execute them
+  status.exit_status= read_and_execute(!status.batch);
   if (opt_outfile)
     end_tee();
   mysql_end(0);
@@ -948,7 +948,7 @@
   return(0);
 }
 
-static int read_lines(bool execute_commands)
+static int read_and_execute(bool interactive)
 {
 #if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
   char linebuffer[254];
@@ -963,7 +963,7 @@
   
   for (;;)
   {
-    if (status.batch || !execute_commands)
+    if (!interactive)
     {
       line=batch_readline(status.line_buff);
       line_number++;
@@ -1041,7 +1041,7 @@
       Check if line is a mysql command line
       (We want to allow help, print and clear anywhere at line start
     */
-    if (execute_commands && (named_cmds || glob_buffer.is_empty()) 
+    if ((named_cmds || glob_buffer.is_empty())
 	&& !in_string && (com=find_command(line,0)))
     {
       if ((*com->func)(&glob_buffer,line) > 0)
@@ -1049,7 +1049,7 @@
       if (glob_buffer.is_empty())		// If buffer was emptied
 	in_string=0;
 #ifdef HAVE_READLINE
-      if (status.add_to_history && not_in_history(line))
+      if (interactive && status.add_to_history && not_in_history(line))
 	add_history(line);
 #endif
       continue;
@@ -1059,7 +1059,7 @@
   }
   /* if in batch mode, send last query even if it doesn't end with \g or go */
 
-  if ((status.batch || !execute_commands) && !status.exit_status)
+  if (!interactive && !status.exit_status)
   {
     remove_cntrl(glob_buffer);
     if (!glob_buffer.is_empty())
@@ -2777,7 +2777,7 @@
   status.line_buff=line_buff;
   status.file_name=source_name;
   glob_buffer.length(0);			// Empty command buffer
-  error=read_lines(0);				// Read lines from file
+  error= read_and_execute(false);
   status=old_status;				// Continue as before
   my_fclose(sql_file,MYF(0));
   batch_readline_end(line_buff);
--- New file ---
+++ mysql-test/t/mysql_delimiter_source.sql	05/08/09 12:17:25
delimiter //
create table t2 (a int) //
delimiter ;
\d //
create table t3 (a int) //
\d ;
show tables;
drop table t2, t3;


--- 1.2/mysql-test/r/mysql.result	2005-06-03 06:29:01 -07:00
+++ 1.3/mysql-test/r/mysql.result	2005-08-09 12:17:25 -07:00
@@ -31,6 +31,10 @@
 Test delimiter delimiter
 a
 1
+Tables_in_test
+t1
+t2
+t3
 
 Test delimiter : from command line
 a

--- 1.1/mysql-test/t/mysql_delimiter.sql	2005-05-17 12:13:30 -07:00
+++ 1.2/mysql-test/t/mysql_delimiter.sql	2005-08-09 12:17:25 -07:00
@@ -45,4 +45,7 @@
 select * from t1 delimiter
 delimiter ; # Reset delimiter
 
-
+#
+# Bug #11523: \d works differently than delimiter
+#
+source t/mysql_delimiter_source.sql
Thread
bk commit into 5.0 tree (jimw:1.1959) BUG#11523Jim Winstead9 Aug