List:Commits« Previous MessageNext Message »
From:cbell Date:April 3 2007 3:45pm
Subject:bk commit into 5.1 tree (cbell:1.2490)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cbell. When cbell 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@stripped, 2007-04-03 11:44:57-04:00, cbell@mysql_cab_desk. +5 -0
  WL#3762 - Initial SQL for Online Backup
  
  This patch adds SQL parser code to capture the BACKUP DATABASE and 
  RESTORE DATABASE commands.

  sql/sql_lex.h@stripped, 2007-04-03 11:44:53-04:00, cbell@mysql_cab_desk. +1 -1
    WL#3762 - Initial SQL for Online Backup
    
    This patch adds the new SQLCOM enums for backup database and restore database commands.

  sql/sql_parse.cc@stripped, 2007-04-03 11:44:53-04:00, cbell@mysql_cab_desk. +29 -1
    WL#3762 - Initial SQL for Online Backup
    
    This patch adds code to process the backup database and restore database commands.

  sql/sql_table.cc@stripped, 2007-04-03 11:44:53-04:00, cbell@mysql_cab_desk. +1 -1
    WL#3762 - Initial SQL for Online Backup
    
    This patch changed the backup_dir from a char * to a LEX_STRING. The code
    change correctly uses the .str attribute to create a char *.

  sql/sql_yacc.yy@stripped, 2007-04-03 11:44:54-04:00, cbell@mysql_cab_desk. +30 -10
    WL#3762 - Initial SQL for Online Backup
    
    This patch modifies the parser to recognize the commands BACKUP DATABASE and
    RESTORE DATABASE.

  storage/myisam/ha_myisam.cc@stripped, 2007-04-03 11:44:54-04:00, cbell@mysql_cab_desk. +2 -2
    WL#3762 - Initial SQL for Online Backup
    
    This patch changed the backup_dir from a char * to a LEX_STRING. The code
    change correctly uses the .str attribute to create a char *.

# 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:	cbell
# Host:	mysql_cab_desk.
# Root:	C:/source/c++/mysql-5.1_WL_3762

--- 1.210/storage/myisam/ha_myisam.cc	2007-04-03 11:45:10 -04:00
+++ 1.211/storage/myisam/ha_myisam.cc	2007-04-03 11:45:10 -04:00
@@ -798,7 +798,7 @@
 int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
 {
   HA_CHECK_OPT tmp_check_opt;
-  char *backup_dir= thd->lex->backup_dir;
+  char *backup_dir= thd->lex->backup_dir.str;
   char src_path[FN_REFLEN], dst_path[FN_REFLEN];
   char table_name[FN_REFLEN];
   int error;
@@ -841,7 +841,7 @@
 
 int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
 {
-  char *backup_dir= thd->lex->backup_dir;
+  char *backup_dir= thd->lex->backup_dir.str;
   char src_path[FN_REFLEN], dst_path[FN_REFLEN];
   char table_name[FN_REFLEN];
   int error;

--- 1.263/sql/sql_lex.h	2007-04-03 11:45:10 -04:00
+++ 1.264/sql/sql_lex.h	2007-04-03 11:45:10 -04:00
@@ -945,7 +945,7 @@
   LEX_STRING name;
   Table_ident *like_name;
   char *help_arg;
-  char *backup_dir;				/* For RESTORE/BACKUP */
+  LEX_STRING backup_dir;			 	/* For RESTORE/BACKUP */
   char* to_log;                                 /* For PURGE MASTER LOGS TO */
   char* x509_subject,*x509_issuer,*ssl_cipher;
   char* found_semicolon;                        /* For multi queries - next query */

--- 1.632/sql/sql_parse.cc	2007-04-03 11:45:10 -04:00
+++ 1.633/sql/sql_parse.cc	2007-04-03 11:45:10 -04:00
@@ -1859,8 +1859,22 @@
 
   case SQLCOM_BACKUP_TABLE:
   {
+    if (thd->lex->backup_dir.length > 0)
+    {
+      /*
+        TODO:
+          - Check database validity
+          - Check directory validity
+          - Pass database name to backup kernel
+      */
+      printf("\nCaught BACKUP DATABASE command:\n");
+      printf("database name = %s\n", lex->name.str);
+      printf("to : %s\n", lex->backup_dir.str);
+      send_ok(thd);
+    }
+    else
 #ifndef EMBEDDED_LIBRARY
-     backup::do_backup(thd);
+      backup::do_backup(thd);
 #endif
 /*    
    DBUG_ASSERT(first_table == all_tables && first_table != 0);
@@ -1876,6 +1890,20 @@
   }
   case SQLCOM_RESTORE_TABLE:
   {
+    if (thd->lex->backup_dir.length > 0)
+    {
+      /*
+        TODO:
+          - Check database validity
+          - Check directory validity
+          - Pass database name to backup kernel
+      */
+      printf("\nCaught RESTORE DATABASE command:\n");
+      printf("database name = %s\n", lex->name.str);
+      printf("from : %s\n", lex->backup_dir.str);
+      send_ok(thd);
+    }
+    else
 #ifndef EMBEDDED_LIBRARY
     backup::do_restore(thd);
 #endif

--- 1.394/sql/sql_table.cc	2007-04-03 11:45:10 -04:00
+++ 1.395/sql/sql_table.cc	2007-04-03 11:45:10 -04:00
@@ -3821,7 +3821,7 @@
   }
   else
   {
-    char* backup_dir= thd->lex->backup_dir;
+    char* backup_dir= thd->lex->backup_dir.str;
     char src_path[FN_REFLEN], dst_path[FN_REFLEN], uname[FN_REFLEN];
     char* table_name= table->table_name;
     char* db= table->db;

--- 1.545/sql/sql_yacc.yy	2007-04-03 11:45:10 -04:00
+++ 1.546/sql/sql_yacc.yy	2007-04-03 11:45:10 -04:00
@@ -5582,6 +5582,15 @@
 
 
 restore:
+	RESTORE_SYM DATABASE
+	{
+	   Lex->sql_command = SQLCOM_RESTORE_TABLE;
+	}
+	FROM TEXT_STRING_sys
+  {
+	  Lex->backup_dir = $5; 
+  } 
+  |
 	RESTORE_SYM /* table_or_tables */
 	{
 	   Lex->sql_command = SQLCOM_RESTORE_TABLE;
@@ -5591,23 +5600,34 @@
 /*
 	table_list FROM TEXT_STRING_sys
         {
-	  Lex->backup_dir = $6.str;
+	  Lex->backup_dir = $6;
         };
 */
 
 backup:
-	BACKUP_SYM /* table_or_tables */
+	BACKUP_SYM DATABASE ident
 	{
 	   Lex->sql_command = SQLCOM_BACKUP_TABLE;
-/*           WARN_DEPRECATED(yythd, "5.2", "BACKUP TABLE",
-                           "MySQL Administrator (mysqldump, mysql)");
-*/	};
-	/* 
+     Lex->name= $3;
+	}
+	TO_SYM TEXT_STRING_sys
+  {
+	  Lex->backup_dir = $6; 
+  } 
+/*
+	| BACKUP_SYM table_or_tables
+	{
+	   Lex->sql_command = SQLCOM_BACKUP_TABLE;
+	}
 	table_list TO_SYM TEXT_STRING_sys
-        {
-	  Lex->backup_dir = $6.str;
-        }; 
-	*/
+  {
+	  Lex->backup_dir = $6;
+  }
+*/
+	| BACKUP_SYM 
+	{
+	   Lex->sql_command = SQLCOM_BACKUP_TABLE;
+	};
 
 checksum:
         CHECKSUM_SYM table_or_tables

Thread
bk commit into 5.1 tree (cbell:1.2490)cbell3 Apr