diff options
author | monty@mysql.com <> | 2003-12-15 18:02:29 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2003-12-15 18:02:29 +0200 |
commit | 76eb2197811f840ed8eee154e41dadd0af620c38 (patch) | |
tree | d48c7f36c2a60f715dc3bbf72eca1d5ac8a11cf0 /sql | |
parent | 6e4329cbe6dab9a06124b26dbd021ecc5f087cdc (diff) | |
parent | 27427015746230b2e7d324e644d8b767d98b3e0a (diff) | |
download | mariadb-git-76eb2197811f840ed8eee154e41dadd0af620c38.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/my/mysql-4.1
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.h | 22 | ||||
-rw-r--r-- | sql/item.cc | 87 | ||||
-rw-r--r-- | sql/mysqld.cc | 3 |
3 files changed, 54 insertions, 58 deletions
diff --git a/sql/field.h b/sql/field.h index 0b6ba7dde09..508fbad41a1 100644 --- a/sql/field.h +++ b/sql/field.h @@ -327,11 +327,6 @@ public: unireg_check_arg, field_name_arg, table_arg, dec_arg, zero_arg,unsigned_arg) {} - Field_decimal(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg,bool unsigned_arg) - :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg,0,0,unsigned_arg) - {} enum_field_types type() const { return FIELD_TYPE_DECIMAL;} enum ha_base_keytype key_type() const { return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; } @@ -362,11 +357,6 @@ public: unireg_check_arg, field_name_arg, table_arg, 0, zero_arg,unsigned_arg) {} - Field_tiny(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg,bool unsigned_arg) - :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, - NONE, field_name_arg, table_arg,0,0,unsigned_arg) - {} enum Item_result result_type () const { return INT_RESULT; } enum_field_types type() const { return FIELD_TYPE_TINY;} enum ha_base_keytype key_type() const @@ -608,13 +598,9 @@ public: :Field_str(ptr_arg, len_arg, null, 1, unireg_check_arg, field_name_arg, table_arg, cs) {} - Field_null(uint32 len_arg, const char *field_name_arg, - struct st_table *table_arg, CHARSET_INFO *cs) - :Field_str((char*) 0, len_arg, null, 1, - NONE, 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; } + int store(const char *to, uint length, CHARSET_INFO *cs) + { null[0]=1; return 0; } int store(double nr) { null[0]=1; return 0; } int store(longlong nr) { null[0]=1; return 0; } void reset(void) {} @@ -684,10 +670,6 @@ public: :Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, table_arg, 1, 1) {} - Field_year(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg) - :Field_tiny(len_arg,maybe_null_arg,field_name_arg,table_arg,1) - {} enum_field_types type() const { return FIELD_TYPE_YEAR;} int store(const char *to,uint length,CHARSET_INFO *charset); int store(double nr); diff --git a/sql/item.cc b/sql/item.cc index 9af2c300202..072a7e5878f 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -995,35 +995,42 @@ enum_field_types Item::field_type() const Field *Item::tmp_table_field_from_field_type(TABLE *table) { - switch (field_type()) - { + /* + The field functions defines a field to be not null if null_ptr is not 0 + */ + uchar *null_ptr= maybe_null ? (uchar*) "" : 0; + + switch (field_type()) { case MYSQL_TYPE_DECIMAL: - return new Field_decimal(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_decimal((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, decimals, 0, unsigned_flag); case MYSQL_TYPE_TINY: - return new Field_tiny(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_tiny((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); case MYSQL_TYPE_SHORT: - return new Field_short(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_short((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); case MYSQL_TYPE_LONG: - return new Field_long(max_length, maybe_null, name, table, - unsigned_flag); - case MYSQL_TYPE_FLOAT: - return new Field_float(max_length, maybe_null, name, table, decimals); - case MYSQL_TYPE_DOUBLE: - return new Field_double(max_length, maybe_null, name, table, decimals); - case MYSQL_TYPE_NULL: - return new Field_null(max_length, name, table, &my_charset_bin); + return new Field_long((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); #ifdef HAVE_LONG_LONG case MYSQL_TYPE_LONGLONG: - return new Field_longlong(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_longlong((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); #endif + case MYSQL_TYPE_FLOAT: + return new Field_float((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, decimals, 0, unsigned_flag); + case MYSQL_TYPE_DOUBLE: + return new Field_double((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, decimals, 0, unsigned_flag); + case MYSQL_TYPE_NULL: + return new Field_null((char*) 0, max_length, Field::NONE, + name, table, &my_charset_bin); case MYSQL_TYPE_NEWDATE: case MYSQL_TYPE_INT24: - return new Field_long(max_length, maybe_null, name, table, - unsigned_flag); + return new Field_medium((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table, 0, unsigned_flag); case MYSQL_TYPE_DATE: return new Field_date(maybe_null, name, table, &my_charset_bin); case MYSQL_TYPE_TIME: @@ -1032,34 +1039,38 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table) case MYSQL_TYPE_DATETIME: return new Field_datetime(maybe_null, name, table, &my_charset_bin); case MYSQL_TYPE_YEAR: - return new Field_year(max_length, maybe_null, name, table); + return new Field_year((char*) 0, max_length, null_ptr, 0, Field::NONE, + name, table); + default: + /* This case should never be choosen */ + DBUG_ASSERT(0); + /* If something goes awfully wrong, it's better to get a string than die */ case MYSQL_TYPE_ENUM: case MYSQL_TYPE_SET: - return new Field_long(max_length, maybe_null, name, table, - unsigned_flag); + case MYSQL_TYPE_VAR_STRING: + if (max_length > 255) + break; // If blob + return new Field_varstring(max_length, maybe_null, name, table, + collation.collation); + case MYSQL_TYPE_STRING: + if (max_length > 255) // If blob + break; + return new Field_string(max_length, maybe_null, name, table, + collation.collation); case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_BLOB: case MYSQL_TYPE_GEOMETRY: - return new Field_blob(max_length, maybe_null, name, table, collation.collation); - case MYSQL_TYPE_VAR_STRING: - if (max_length > 255) - return new Field_blob(max_length, maybe_null, name, table, collation.collation); - else - return new Field_varstring(max_length, maybe_null, name, table, collation.collation); - case MYSQL_TYPE_STRING: - if (max_length > 255) - return new Field_blob(max_length, maybe_null, name, table, collation.collation); - else - return new Field_string(max_length, maybe_null, name, table, collation.collation); - default: - // This case should never be choosen - DBUG_ASSERT(0); - return 0; + break; // Blob handled outside of case } + + /* blob is special as it's generated for both blobs and long strings */ + return new Field_blob(max_length, maybe_null, name, table, + collation.collation); } + /* ARGSUSED */ void Item_field::make_field(Send_field *tmp_field) { diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 805e6860f65..49f0b753549 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2787,6 +2787,9 @@ int main(int argc, char **argv) int2str((int) GetCurrentProcessId(),strmov(shutdown_event_name, "MySQLShutdown"), 10); + /* Must be initialized early for comparison of service name */ + system_charset_info= &my_charset_utf8_general_ci; + if (Service.GetOS()) /* true NT family */ { char file_path[FN_REFLEN]; |