summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorbar@bar.mysql.r18.ru <>2002-10-30 17:09:37 +0400
committerbar@bar.mysql.r18.ru <>2002-10-30 17:09:37 +0400
commit03e7fc31802681cb6f7740cec087049a10b7ca6f (patch)
treed42496394ec3c44e78f9d404c7911e6c52454a29 /sql
parentb43876b9dd5a4e361c458d271110da88eea5d43a (diff)
downloadmariadb-git-03e7fc31802681cb6f7740cec087049a10b7ca6f.tar.gz
date and time fields now have charset arg in constructor
my_charset_latin1
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc10
-rw-r--r--sql/field.h34
-rw-r--r--sql/item_timefunc.h18
3 files changed, 33 insertions, 29 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 374b62f5191..d8742d487f9 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5283,19 +5283,19 @@ Field *make_field(char *ptr, uint32 field_length,
unireg_check, field_name, table);
case FIELD_TYPE_DATE:
return new Field_date(ptr,null_pos,null_bit,
- unireg_check, field_name, table);
+ unireg_check, field_name, table, field_charset);
case FIELD_TYPE_NEWDATE:
return new Field_newdate(ptr,null_pos,null_bit,
- unireg_check, field_name, table);
+ unireg_check, field_name, table, field_charset);
case FIELD_TYPE_TIME:
return new Field_time(ptr,null_pos,null_bit,
- unireg_check, field_name, table);
+ unireg_check, field_name, table, field_charset);
case FIELD_TYPE_DATETIME:
return new Field_datetime(ptr,null_pos,null_bit,
- unireg_check, field_name, table);
+ unireg_check, field_name, table, field_charset);
case FIELD_TYPE_NULL:
default: // Impossible (Wrong version)
- return new Field_null(ptr,field_length,unireg_check,field_name,table);
+ return new Field_null(ptr,field_length,unireg_check,field_name,table, field_charset);
}
return 0; // Impossible (Wrong version)
}
diff --git a/sql/field.h b/sql/field.h
index e4c1bd046ab..6505b2c8462 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -528,9 +528,9 @@ class Field_null :public Field_str {
public:
Field_null(char *ptr_arg, uint32 len_arg,
enum utype unireg_check_arg, const char *field_name_arg,
- struct st_table *table_arg)
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, len_arg, null, 1,
- unireg_check_arg, field_name_arg, table_arg, default_charset_info)
+ unireg_check_arg, field_name_arg, table_arg, cs)
{}
enum_field_types type() const { return FIELD_TYPE_NULL;}
int store(const char *to, uint length, CHARSET_INFO *cs) { null[0]=1; return 0; }
@@ -544,7 +544,7 @@ public:
int cmp(const char *a, const char *b) { return 0;}
void sort_string(char *buff, uint length) {}
uint32 pack_length() const { return 0; }
- void sql_type(String &str) const { str.set("null",4,default_charset_info); }
+ void sql_type(String &str) const { str.set("null",4,my_thd_charset); }
uint size_of() const { return sizeof(*this); }
};
@@ -615,14 +615,14 @@ class Field_date :public Field_str {
public:
Field_date(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
- struct st_table *table_arg)
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
- unireg_check_arg, field_name_arg, table_arg, default_charset_info)
+ unireg_check_arg, field_name_arg, table_arg, cs)
{}
Field_date(bool maybe_null_arg, const char *field_name_arg,
- struct st_table *table_arg)
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str((char*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
- NONE, field_name_arg, table_arg, default_charset_info) {}
+ NONE, field_name_arg, table_arg, cs) {}
enum_field_types type() const { return FIELD_TYPE_DATE;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
enum Item_result cmp_type () const { return INT_RESULT; }
@@ -645,9 +645,9 @@ class Field_newdate :public Field_str {
public:
Field_newdate(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
- struct st_table *table_arg)
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
- unireg_check_arg, field_name_arg, table_arg, default_charset_info)
+ unireg_check_arg, field_name_arg, table_arg, cs)
{}
enum_field_types type() const { return FIELD_TYPE_DATE;}
enum_field_types real_type() const { return FIELD_TYPE_NEWDATE; }
@@ -676,14 +676,14 @@ class Field_time :public Field_str {
public:
Field_time(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
- struct st_table *table_arg)
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, 8, null_ptr_arg, null_bit_arg,
- unireg_check_arg, field_name_arg, table_arg, default_charset_info)
+ unireg_check_arg, field_name_arg, table_arg, cs)
{}
Field_time(bool maybe_null_arg, const char *field_name_arg,
- struct st_table *table_arg)
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str((char*) 0,8, maybe_null_arg ? (uchar*) "": 0,0,
- NONE, field_name_arg, table_arg, default_charset_info) {}
+ NONE, field_name_arg, table_arg, cs) {}
enum_field_types type() const { return FIELD_TYPE_TIME;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
enum Item_result cmp_type () const { return INT_RESULT; }
@@ -708,14 +708,14 @@ class Field_datetime :public Field_str {
public:
Field_datetime(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
- struct st_table *table_arg)
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg,
- unireg_check_arg, field_name_arg, table_arg, default_charset_info)
+ unireg_check_arg, field_name_arg, table_arg, cs)
{}
Field_datetime(bool maybe_null_arg, const char *field_name_arg,
- struct st_table *table_arg)
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str((char*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
- NONE, field_name_arg, table_arg, default_charset_info) {}
+ NONE, field_name_arg, table_arg, cs) {}
enum_field_types type() const { return FIELD_TYPE_DATETIME;}
#ifdef HAVE_LONG_LONG
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 66c9a1a4438..fab8ea9fa9c 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -243,7 +243,7 @@ public:
}
Field *tmp_table_field(TABLE *t_arg)
{
- return (!t_arg) ? result_field : new Field_date(maybe_null, name, t_arg);
+ return (!t_arg) ? result_field : new Field_date(maybe_null, name, t_arg, my_thd_charset);
}
};
@@ -261,7 +261,7 @@ public:
Field *tmp_table_field(TABLE *t_arg)
{
return (!t_arg) ? result_field : new Field_datetime(maybe_null, name,
- t_arg);
+ t_arg, my_thd_charset);
}
};
@@ -287,7 +287,8 @@ public:
}
Field *tmp_table_field(TABLE *t_arg)
{
- return (!t_arg) ? result_field : new Field_time(maybe_null, name, t_arg);
+ return (!t_arg) ? result_field :
+ new Field_time(maybe_null, name, t_arg, my_thd_charset);
}
};
@@ -379,7 +380,8 @@ public:
}
Field *tmp_table_field(TABLE *t_arg)
{
- return (!t_arg) ? result_field : new Field_time(maybe_null, name, t_arg);
+ return (!t_arg) ? result_field :
+ new Field_time(maybe_null, name, t_arg, my_thd_charset);
}
};
@@ -443,7 +445,8 @@ public:
}
Field *tmp_table_field(TABLE *t_arg)
{
- return (!t_arg) ? result_field : new Field_date(maybe_null, name, t_arg);
+ return (!t_arg) ? result_field :
+ new Field_date(maybe_null, name, t_arg, my_thd_charset);
}
};
@@ -458,7 +461,8 @@ public:
}
Field *tmp_table_field(TABLE *t_arg)
{
- return (!t_arg) ? result_field : new Field_time(maybe_null, name, t_arg);
+ return (!t_arg) ? result_field :
+ new Field_time(maybe_null, name, t_arg, my_thd_charset);
}
};
@@ -474,6 +478,6 @@ public:
Field *tmp_table_field(TABLE *t_arg)
{
return (!t_arg) ? result_field : new Field_datetime(maybe_null, name,
- t_arg);
+ t_arg, my_thd_charset);
}
};