[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-internals
Subject:    bk commit into 4.1 tree (1.1483)
From:       bar () mysql ! com
Date:       2003-02-28 15:22:22
[Download RAW message or body]

Below is the list of changes that have just been committed into a local
4.1 repository of bar. When bar 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1483 03/02/28 19:22:20 bar@bar.mysql.r18.ru +8 -0
  Many files:
     Coercibility, initial stage
  item_func.h:
    Coercibility, initial stage

  sql/sql_yacc.yy
    1.244 03/02/28 19:22:09 bar@bar.mysql.r18.ru +1 -1
     Coercibility, initial stage

  sql/lex.h
    1.99 03/02/28 19:22:07 bar@bar.mysql.r18.ru +1 -0
     Coercibility, initial stage

  sql/item_func.cc
    1.115 03/02/28 19:22:06 bar@bar.mysql.r18.ru +11 -0
     Coercibility, initial stage

  sql/item.h
    1.58 03/02/28 19:22:03 bar@bar.mysql.r18.ru +9 -3
     Coercibility, initial stage

  sql/item_create.h
    1.20 03/02/28 19:22:01 bar@bar.mysql.r18.ru +1 -0
     Coercibility, initial stage

  sql/item_create.cc
    1.28 03/02/28 19:21:59 bar@bar.mysql.r18.ru +5 -0
     Coercibility, initial stage

  sql/item.cc
    1.59 03/02/28 19:21:54 bar@bar.mysql.r18.ru +6 -2
     Coercibility, initial stage

  sql/item_func.h
    1.70 03/02/28 19:21:33 bar@bar.mysql.r18.ru +9 -0
    Coercibility, initial stage

# 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:	bar
# Host:	bar.mysql.r18.ru
# Root:	/usr/home/bar/mysql-4.1

--- 1.58/sql/item.cc	Fri Feb 14 13:47:37 2003
+++ 1.59/sql/item.cc	Fri Feb 28 19:21:54 2003
@@ -39,6 +39,7 @@
 {
   marker= 0;
   maybe_null=null_value=with_sum_func=unsigned_flag=0;
+  coercibility=COER_NOCOLL;
   name= 0;
   decimals= 0; max_length= 0;
   THD *thd= current_thd;
@@ -63,7 +64,8 @@
   null_value(item.null_value),
   unsigned_flag(item.unsigned_flag),
   with_sum_func(item.with_sum_func),
-  fixed(item.fixed)
+  fixed(item.fixed),
+  coercibility(item.coercibility)
 {
   next=thd->free_list;			// Put in free list
   thd->free_list= this;
@@ -169,6 +171,7 @@
 Item_field::Item_field(Field *f) :Item_ident(NullS,f->table_name,f->field_name)
 {
   set_field(f);
+  coercibility= COER_IMPLICIT;
   fixed= 1; // This item is not needed in fix_fields
 }
 
@@ -177,7 +180,7 @@
   Item_ident(thd, item),
   field(item.field),
   result_field(item.result_field)
-{}
+{ coercibility= COER_IMPLICIT; }
 
 void Item_field::set_field(Field *field_par)
 {
@@ -189,6 +192,7 @@
   field_name=field_par->field_name;
   unsigned_flag=test(field_par->flags & UNSIGNED_FLAG);
   set_charset(field_par->charset());
+  coercibility= COER_IMPLICIT;
 }
 
 const char *Item_ident::full_name() const

--- 1.57/sql/item.h	Thu Feb 27 05:49:24 2003
+++ 1.58/sql/item.h	Fri Feb 28 19:22:03 2003
@@ -39,6 +39,8 @@
              SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM};
 
   enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE };
+  enum coercion    { COER_NOCOLL=0,   COER_COERCIBLE=1, 
+  		     COER_IMPLICIT=2, COER_EXPLICIT=3  };
 
   String str_value;			/* used to store value */
   my_string name;			/* Name from select */
@@ -50,6 +52,7 @@
   my_bool unsigned_flag;
   my_bool with_sum_func;
   my_bool fixed;                        /* If item fixed with fix_fields */
+  enum coercion coercibility;		/* Precedence order of collation */
 
   // alloc & destruct is done as start of select using sql_alloc
   Item();
@@ -155,7 +158,7 @@
   Item_field(const char *db_par,const char *table_name_par,
 	     const char *field_name_par)
     :Item_ident(db_par,table_name_par,field_name_par),field(0),result_field(0)
-  {}
+  { coercibility= COER_IMPLICIT; }
   // Constructor need to process subselect with temporary tables (see Item)
   Item_field(THD *thd, Item_field &item);
   Item_field(Field *field);
@@ -350,17 +353,20 @@
 class Item_string :public Item
 {
 public:
-  Item_string(const char *str,uint length,CHARSET_INFO *cs)
+  Item_string(const char *str,uint length,
+  	      CHARSET_INFO *cs, enum coercion coer= COER_COERCIBLE)
   {
     str_value.set(str,length,cs);
+    coercibility= coer;
     max_length=length;
     name=(char*) str_value.ptr();
     decimals=NOT_FIXED_DEC;
   }
   Item_string(const char *name_par, const char *str, uint length,
-	      CHARSET_INFO *cs)
+	      CHARSET_INFO *cs, enum coercion coer= COER_COERCIBLE)
   {
     str_value.set(str,length,cs);
+    coercibility= coer;
     max_length=length;
     name=(char*) name_par;
     decimals=NOT_FIXED_DEC;

--- 1.27/sql/item_create.cc	Thu Feb 27 05:44:32 2003
+++ 1.28/sql/item_create.cc	Fri Feb 28 19:21:59 2003
@@ -230,6 +230,11 @@
   return new Item_func_bit_length(a);
 }
 
+Item *create_func_coercibility(Item* a)
+{
+  return new Item_func_coercibility(a);
+}
+
 Item *create_func_char_length(Item* a)
 {
   return new Item_func_char_length(a);

--- 1.19/sql/item_create.h	Thu Feb 27 05:44:32 2003
+++ 1.20/sql/item_create.h	Fri Feb 28 19:22:01 2003
@@ -25,6 +25,7 @@
 Item *create_func_bin(Item* a);
 Item *create_func_bit_count(Item* a);
 Item *create_func_bit_length(Item* a);
+Item *create_func_coercibility(Item* a);
 Item *create_func_ceiling(Item* a);
 Item *create_func_char_length(Item* a);
 Item *create_func_cast(Item *a, Item_cast cast_type);

--- 1.114/sql/item_func.cc	Thu Feb 27 06:07:27 2003
+++ 1.115/sql/item_func.cc	Fri Feb 28 19:22:06 2003
@@ -107,6 +107,7 @@
     return 0;					// Fatal error if flag is set!
   if (arg_count)
   {						// Print purify happy
+    coercibility= COER_NOCOLL;
     for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
     {
       if ((*arg)->fix_fields(thd, tables, arg) ||
@@ -1004,6 +1005,16 @@
   return (longlong) (!args[0]->binary()) ? res->numchars() : res->length();
 }
 
+longlong Item_func_coercibility::val_int()
+{
+  if (args[0]->null_value)
+  {
+    null_value= 1;
+    return 0;
+  }
+  null_value= 0;
+  return (longlong) args[0]->coercibility;
+}
 
 longlong Item_func_locate::val_int()
 {

--- 1.69/sql/item_func.h	Thu Feb 27 05:44:32 2003
+++ 1.70/sql/item_func.h	Fri Feb 28 19:21:33 2003
@@ -590,6 +590,15 @@
   void fix_length_and_dec() { max_length=10; }
 };
 
+class Item_func_coercibility :public Item_int_func
+{
+public:
+  Item_func_coercibility(Item *a) :Item_int_func(a) {}
+  longlong val_int();
+  const char *func_name() const { return "coercibility"; }
+  void fix_length_and_dec() { max_length=10; }
+};
+
 class Item_func_locate :public Item_int_func
 {
   String value1,value2;

--- 1.98/sql/lex.h	Thu Feb 27 06:07:27 2003
+++ 1.99/sql/lex.h	Fri Feb 28 19:22:07 2003
@@ -441,6 +441,7 @@
   { "CHAR_LENGTH",	SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)},
   { "CHARACTER_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)},
   { "COALESCE",		SYM(COALESCE),0,0},
+  { "COERCIBILITY",	SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_coercibility)},
   { "CONCAT",		SYM(CONCAT),0,0},
   { "CONCAT_WS",	SYM(CONCAT_WS),0,0},
   { "CONNECTION_ID",	SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_connection_id)},

--- 1.243/sql/sql_yacc.yy	Thu Feb 27 17:45:23 2003
+++ 1.244/sql/sql_yacc.yy	Fri Feb 28 19:22:09 2003
@@ -3778,7 +3778,7 @@
 	{ $$ = new Item_string($1.str,$1.length,
 			       YYTHD->variables.thd_charset); }
 	| UNDERSCORE_CHARSET TEXT_STRING
-	  { $$ = new Item_string($2.str,$2.length,Lex->charset); }
+	  { $$ = new Item_string($2.str,$2.length,Lex->charset,Item::COER_EXPLICIT); }
 	| text_literal TEXT_STRING
 	  { ((Item_string*) $1)->append($2.str,$2.length); };
 

---------------------------------------------------------------------
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 internals-thread7227@lists.mysql.com
To unsubscribe, e-mail <internals-unsubscribe@lists.mysql.com>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic