List:Internals« Previous MessageNext Message »
From:ahristov Date:December 28 2005 4:29pm
Subject:bk commit into 5.1 tree (andrey:1.2012)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of andrey. When andrey 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.2012 05/12/28 18:29:32 andrey@lmy004. +4 -0
  WL #1034 update
  - fix problem with too long identifier name

  sql/sql_yacc.yy
    1.431 05/12/28 18:28:42 andrey@lmy004. +1 -3
    remove debug info and whitespace

  sql/share/errmsg.txt
    1.66 05/12/28 18:28:41 andrey@lmy004. +2 -0
    new error message

  sql/event_priv.h
    1.13 05/12/28 18:28:41 andrey@lmy004. +4 -3
    name the enum
    fix truncation problem

  sql/event.cc
    1.18 05/12/28 18:28:41 andrey@lmy004. +36 -11
    report an error when identifier too long

# 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:	andrey
# Host:	lmy004.
# Root:	/work/mysql-5.1-tt-copy-works

--- 1.430/sql/sql_yacc.yy	2005-12-28 13:43:16 +02:00
+++ 1.431/sql/sql_yacc.yy	2005-12-28 18:28:42 +02:00
@@ -4275,10 +4275,8 @@
               sql_command is set here because some rules in ev_sql_stmt
               can overwrite it
             */
-            printf("5=%d 6=%d 7=%d 8=%d 9=%d 10=%d", $<ulong_num>5 , $<ulong_num>6 , $<ulong_num>7 ,
-                $<ulong_num>8 , $<ulong_num>9 , $<ulong_num>10);
             if (!($<ulong_num>5 || $<ulong_num>6 || $<ulong_num>7 ||
-                $<ulong_num>8 || $<ulong_num>9 || $<ulong_num>10))
+                  $<ulong_num>8 || $<ulong_num>9 || $<ulong_num>10))
             {
 	      yyerror(ER(ER_SYNTAX_ERROR));
               YYABORT;

--- 1.17/sql/event.cc	2005-12-28 12:07:43 +02:00
+++ 1.18/sql/event.cc	2005-12-28 18:28:41 +02:00
@@ -211,6 +211,11 @@
        table  the row to fill out
        et     Event's data
    
+   Returns
+     0 - ok
+     EVEX_GENERAL_ERROR    - bad data
+     EVEX_GET_FIELD_FAILED - field count does not match. table corrupted? 
+
    DESCRIPTION 
      Used both when an event is created and when it is altered.
 */
@@ -218,6 +223,8 @@
 static int
 evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
 {
+  enum evex_table_field field_num;
+
   DBUG_ENTER("evex_fill_row");
 
   if (table->s->fields != EVEX_FIELD_COUNT)
@@ -229,10 +236,13 @@
   DBUG_PRINT("info", ("dbname.len=%d",et->dbname.length));  
   DBUG_PRINT("info", ("name.len=%d",et->name.length));  
 
-  table->field[EVEX_FIELD_DB]->
-      store(et->dbname.str, et->dbname.length, system_charset_info);
-  table->field[EVEX_FIELD_NAME]->
-      store(et->name.str, et->name.length, system_charset_info);
+  if (table->field[field_num= EVEX_FIELD_DB]->
+                  store(et->dbname.str, et->dbname.length, system_charset_info))
+    goto trunc_err;
+
+  if (table->field[field_num= EVEX_FIELD_NAME]->
+                  store(et->name.str, et->name.length, system_charset_info))
+    goto trunc_err;
 
   table->field[EVEX_FIELD_ON_COMPLETION]->set_notnull();
   table->field[EVEX_FIELD_ON_COMPLETION]->store((longlong)et->on_completion);
@@ -243,8 +253,9 @@
 
   // ToDo: Andrey. How to use users current charset?
   if (et->body.str)
-    table->field[EVEX_FIELD_BODY]->
-      store(et->body.str, et->body.length, system_charset_info);
+    if (table->field[field_num= EVEX_FIELD_BODY]->
+                     store(et->body.str, et->body.length, system_charset_info))
+      goto trunc_err;
 
   if (et->starts.year)
   {
@@ -290,10 +301,14 @@
   ((Field_timestamp *)table->field[EVEX_FIELD_MODIFIED])->set_time();
 
   if (et->comment.length)
-    table->field[EVEX_FIELD_COMMENT]->
-	store(et->comment.str, et->comment.length, system_charset_info);
-
-  DBUG_RETURN(0);  
+    if (table->field[field_num= EVEX_FIELD_COMMENT]->
+	store(et->comment.str, et->comment.length, system_charset_info))
+      goto trunc_err;
+
+  DBUG_RETURN(0);
+trunc_err:
+  my_error(ER_EVENT_DATA_TOO_LONG, MYF(0));
+  DBUG_RETURN(EVEX_GENERAL_ERROR);
 }
 
 
@@ -353,11 +368,21 @@
   
   restore_record(table, s->default_values); // Get default values for fields
 
-  if (et->name.length > table->field[EVEX_FIELD_NAME]->field_length)
+  if (system_charset_info->cset->numchars(system_charset_info, et->dbname.str,
+                                    et->dbname.str + et->dbname.length)
+                                    > EVEX_DB_FIELD_LEN)
+  {
+    my_error(ER_TOO_LONG_IDENT, MYF(0), et->dbname.str);
+    goto err;
+  }
+  if (system_charset_info->cset->numchars(system_charset_info, et->name.str,
+                                    et->name.str + et->name.length)
+                                    > EVEX_DB_FIELD_LEN)
   {
     my_error(ER_TOO_LONG_IDENT, MYF(0), et->name.str);
     goto err;
   }
+
   if (et->body.length > table->field[EVEX_FIELD_BODY]->field_length)
   {
     my_error(ER_TOO_LONG_BODY, MYF(0), et->name.str);

--- 1.12/sql/event_priv.h	2005-12-28 12:07:44 +02:00
+++ 1.13/sql/event_priv.h	2005-12-28 18:28:41 +02:00
@@ -24,7 +24,7 @@
 #define UNLOCK_MUTEX_AND_BAIL_OUT(__mutex, __label) \
     { VOID(pthread_mutex_unlock(&__mutex)); goto __label; }
 
-enum
+enum evex_table_field
 {
   EVEX_FIELD_DB = 0,
   EVEX_FIELD_NAME,
@@ -42,9 +42,10 @@
   EVEX_FIELD_ON_COMPLETION,
   EVEX_FIELD_COMMENT,
   EVEX_FIELD_COUNT /* a cool trick to count the number of fields :) */
-};
-
+} ;
 
+#define EVEX_DB_FIELD_LEN 64
+#define EVEX_NAME_FIELD_LEN 64
 
 int
 my_time_compare(TIME *a, TIME *b);

--- 1.65/sql/share/errmsg.txt	2005-12-28 13:00:01 +02:00
+++ 1.66/sql/share/errmsg.txt	2005-12-28 18:28:41 +02:00
@@ -5751,3 +5751,5 @@
         eng "Error during compilation of event's body"
 ER_EVENT_SAME_NAME
         eng "Same old and new event name"
+ER_EVENT_DATA_TOO_LONG
+        eng "Data for column '%s' too long"
Thread
bk commit into 5.1 tree (andrey:1.2012)ahristov28 Dec