Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
6f5f4785
Commit
6f5f4785
authored
Jun 19, 2002
by
bar@gw.udmsearch.izhnet.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default table character set has been added:
CREATE TABLE a (field,...) TYPE=type CHARSET=cset;
parent
f4f4962d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
14 deletions
+39
-14
sql/handler.h
sql/handler.h
+1
-0
sql/lex.h
sql/lex.h
+1
-0
sql/sql_show.cc
sql/sql_show.cc
+7
-1
sql/sql_table.cc
sql/sql_table.cc
+5
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+18
-6
sql/table.cc
sql/table.cc
+6
-5
sql/unireg.cc
sql/unireg.cc
+1
-2
No files found.
sql/handler.h
View file @
6f5f4785
...
@@ -137,6 +137,7 @@ enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
...
@@ -137,6 +137,7 @@ enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
#define HA_CREATE_USED_MAX_ROWS 32
#define HA_CREATE_USED_MAX_ROWS 32
#define HA_CREATE_USED_AVG_ROW_LENGTH 64
#define HA_CREATE_USED_AVG_ROW_LENGTH 64
#define HA_CREATE_USED_PACK_KEYS 128
#define HA_CREATE_USED_PACK_KEYS 128
#define HA_CREATE_USED_CHARSET 256
typedef
struct
st_thd_trans
{
typedef
struct
st_thd_trans
{
void
*
bdb_tid
;
void
*
bdb_tid
;
...
...
sql/lex.h
View file @
6f5f4785
...
@@ -82,6 +82,7 @@ static SYMBOL symbols[] = {
...
@@ -82,6 +82,7 @@ static SYMBOL symbols[] = {
{
"CASE"
,
SYM
(
CASE_SYM
),
0
,
0
},
{
"CASE"
,
SYM
(
CASE_SYM
),
0
,
0
},
{
"CHAR"
,
SYM
(
CHAR_SYM
),
0
,
0
},
{
"CHAR"
,
SYM
(
CHAR_SYM
),
0
,
0
},
{
"CHARACTER"
,
SYM
(
CHAR_SYM
),
0
,
0
},
{
"CHARACTER"
,
SYM
(
CHAR_SYM
),
0
,
0
},
{
"CHARSET"
,
SYM
(
CHARSET
),
0
,
0
},
{
"CHANGE"
,
SYM
(
CHANGE
),
0
,
0
},
{
"CHANGE"
,
SYM
(
CHANGE
),
0
,
0
},
{
"CHANGED"
,
SYM
(
CHANGED
),
0
,
0
},
{
"CHANGED"
,
SYM
(
CHANGED
),
0
,
0
},
{
"CHECK"
,
SYM
(
CHECK_SYM
),
0
,
0
},
{
"CHECK"
,
SYM
(
CHECK_SYM
),
0
,
0
},
...
...
sql/sql_show.cc
View file @
6f5f4785
...
@@ -1156,6 +1156,12 @@ store_create_info(THD *thd, TABLE *table, String *packet)
...
@@ -1156,6 +1156,12 @@ store_create_info(THD *thd, TABLE *table, String *packet)
char
buff
[
128
];
char
buff
[
128
];
char
*
p
;
char
*
p
;
if
(
table
->
table_charset
)
{
packet
->
append
(
" CHARSET="
);
packet
->
append
(
table
->
table_charset
->
name
);
}
if
(
table
->
min_rows
)
if
(
table
->
min_rows
)
{
{
packet
->
append
(
" MIN_ROWS="
);
packet
->
append
(
" MIN_ROWS="
);
...
@@ -1386,7 +1392,7 @@ int mysqld_show_charsets(THD *thd, const char *wild)
...
@@ -1386,7 +1392,7 @@ int mysqld_show_charsets(THD *thd, const char *wild)
net_store_data
(
&
packet2
,(
uint32
)
cs
->
mbmaxlen
);
net_store_data
(
&
packet2
,(
uint32
)
cs
->
mbmaxlen
);
if
(
my_net_write
(
&
thd
->
net
,
(
char
*
)
packet2
.
ptr
(),
packet2
.
length
()))
if
(
my_net_write
(
&
thd
->
net
,
(
char
*
)
packet2
.
ptr
(),
packet2
.
length
()))
goto
err
;
/* purecov: inspected */
goto
err
;
}
}
}
}
send_eof
(
&
thd
->
net
);
send_eof
(
&
thd
->
net
);
...
...
sql/sql_table.cc
View file @
6f5f4785
...
@@ -375,6 +375,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -375,6 +375,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
sql_field
->
offset
=
pos
;
sql_field
->
offset
=
pos
;
if
(
MTYP_TYPENR
(
sql_field
->
unireg_check
)
==
Field
::
NEXT_NUMBER
)
if
(
MTYP_TYPENR
(
sql_field
->
unireg_check
)
==
Field
::
NEXT_NUMBER
)
auto_increment
++
;
auto_increment
++
;
if
(
!
sql_field
->
charset
)
sql_field
->
charset
=
create_info
->
table_charset
?
create_info
->
table_charset
:
default_charset_info
;
pos
+=
sql_field
->
pack_length
;
pos
+=
sql_field
->
pack_length
;
}
}
if
(
auto_increment
>
1
)
if
(
auto_increment
>
1
)
...
@@ -1645,6 +1648,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -1645,6 +1648,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
create_info
->
max_rows
=
table
->
max_rows
;
create_info
->
max_rows
=
table
->
max_rows
;
if
(
!
(
used_fields
&
HA_CREATE_USED_AVG_ROW_LENGTH
))
if
(
!
(
used_fields
&
HA_CREATE_USED_AVG_ROW_LENGTH
))
create_info
->
avg_row_length
=
table
->
avg_row_length
;
create_info
->
avg_row_length
=
table
->
avg_row_length
;
if
(
!
(
used_fields
&
HA_CREATE_USED_CHARSET
))
create_info
->
table_charset
=
table
->
table_charset
;
table
->
file
->
update_create_info
(
create_info
);
table
->
file
->
update_create_info
(
create_info
);
if
((
create_info
->
table_options
&
if
((
create_info
->
table_options
&
...
...
sql/sql_yacc.yy
View file @
6f5f4785
...
@@ -162,6 +162,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -162,6 +162,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token CACHE_SYM
%token CACHE_SYM
%token CASCADE
%token CASCADE
%token CAST_SYM
%token CAST_SYM
%token CHARSET
%token CHECKSUM_SYM
%token CHECKSUM_SYM
%token CHECK_SYM
%token CHECK_SYM
%token CIPHER
%token CIPHER
...
@@ -767,7 +768,7 @@ create:
...
@@ -767,7 +768,7 @@ create:
bzero((char*) &lex->create_info,sizeof(lex->create_info));
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.options=$2 | $4;
lex->create_info.options=$2 | $4;
lex->create_info.db_type= default_table_type;
lex->create_info.db_type= default_table_type;
lex->create_info.table_charset=
default_charset_info
;
lex->create_info.table_charset=
NULL
;
}
}
create2
create2
...
@@ -881,6 +882,17 @@ create_table_option:
...
@@ -881,6 +882,17 @@ create_table_option:
table_list->next=0;
table_list->next=0;
lex->create_info.used_fields|= HA_CREATE_USED_UNION;
lex->create_info.used_fields|= HA_CREATE_USED_UNION;
}
}
| CHARSET EQ ident
{
CHARSET_INFO *cs=get_charset_by_name($3.str,MYF(MY_WME));
if (!cs)
{
net_printf(¤t_thd->net,ER_UNKNOWN_CHARACTER_SET,$3);
YYABORT;
}
Lex->create_info.table_charset=cs;
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
}
| INSERT_METHOD EQ merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;}
| INSERT_METHOD EQ merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;}
| DATA_SYM DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.data_file_name= $4.str; }
| DATA_SYM DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.data_file_name= $4.str; }
| INDEX DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.index_file_name= $4.str; };
| INDEX DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.index_file_name= $4.str; };
...
@@ -965,7 +977,7 @@ field_spec:
...
@@ -965,7 +977,7 @@ field_spec:
LEX *lex=Lex;
LEX *lex=Lex;
lex->length=lex->dec=0; lex->type=0; lex->interval=0;
lex->length=lex->dec=0; lex->type=0; lex->interval=0;
lex->default_value=lex->comment=0;
lex->default_value=lex->comment=0;
lex->charset=
default_charset_info
;
lex->charset=
NULL
;
}
}
type opt_attribute
type opt_attribute
{
{
...
@@ -1116,8 +1128,8 @@ attribute:
...
@@ -1116,8 +1128,8 @@ attribute:
| COMMENT_SYM text_literal { Lex->comment= $2; };
| COMMENT_SYM text_literal { Lex->comment= $2; };
opt_binary:
opt_binary:
/* empty */ { Lex->charset=
default_charset_info
; }
/* empty */ { Lex->charset=
NULL
; }
| BINARY { Lex->type|=BINARY_FLAG; Lex->charset=
default_charset_info
; }
| BINARY { Lex->type|=BINARY_FLAG; Lex->charset=
NULL
; }
| CHAR_SYM SET ident
| CHAR_SYM SET ident
{
{
CHARSET_INFO *cs=get_charset_by_name($3.str,MYF(MY_WME));
CHARSET_INFO *cs=get_charset_by_name($3.str,MYF(MY_WME));
...
@@ -1130,7 +1142,7 @@ opt_binary:
...
@@ -1130,7 +1142,7 @@ opt_binary:
};
};
default_charset:
default_charset:
/* empty */ { Lex->charset
-default_charset_info
; }
/* empty */ { Lex->charset
=NULL
; }
| DEFAULT CHAR_SYM SET ident
| DEFAULT CHAR_SYM SET ident
{
{
CHARSET_INFO *cs=get_charset_by_name($4.str,MYF(MY_WME));
CHARSET_INFO *cs=get_charset_by_name($4.str,MYF(MY_WME));
...
@@ -1259,7 +1271,7 @@ alter:
...
@@ -1259,7 +1271,7 @@ alter:
bzero((char*) &lex->create_info,sizeof(lex->create_info));
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= DB_TYPE_DEFAULT;
lex->create_info.db_type= DB_TYPE_DEFAULT;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->create_info.table_charset=
default_charset_info
;
lex->create_info.table_charset=
NULL
;
lex->alter_keys_onoff=LEAVE_AS_IS;
lex->alter_keys_onoff=LEAVE_AS_IS;
lex->simple_alter=1;
lex->simple_alter=1;
}
}
...
...
sql/table.cc
View file @
6f5f4785
...
@@ -118,7 +118,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
...
@@ -118,7 +118,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam
->
raid_chunks
=
head
[
42
];
outparam
->
raid_chunks
=
head
[
42
];
outparam
->
raid_chunksize
=
uint4korr
(
head
+
43
);
outparam
->
raid_chunksize
=
uint4korr
(
head
+
43
);
if
(
!
(
outparam
->
table_charset
=
get_charset
((
uint
)
head
[
38
],
MYF
(
0
))))
if
(
!
(
outparam
->
table_charset
=
get_charset
((
uint
)
head
[
38
],
MYF
(
0
))))
outparam
->
table_charset
=
default_charset_info
;
outparam
->
table_charset
=
NULL
;
// QQ display error message?
null_field_first
=
1
;
null_field_first
=
1
;
}
}
outparam
->
db_record_offset
=
1
;
outparam
->
db_record_offset
=
1
;
...
@@ -358,7 +358,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
...
@@ -358,7 +358,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
uint
comment_length
=
uint2korr
(
strpos
+
13
);
uint
comment_length
=
uint2korr
(
strpos
+
13
);
field_type
=
(
enum_field_types
)
(
uint
)
strpos
[
11
];
field_type
=
(
enum_field_types
)
(
uint
)
strpos
[
11
];
if
(
!
(
charset
=
get_charset
((
uint
)
strpos
[
12
],
MYF
(
0
))))
if
(
!
(
charset
=
get_charset
((
uint
)
strpos
[
12
],
MYF
(
0
))))
charset
=
outparam
->
table_charset
;
charset
=
outparam
->
table_charset
?
outparam
->
table_charset
:
default_charset_info
;
if
(
!
comment_length
)
if
(
!
comment_length
)
{
{
comment
.
str
=
(
char
*
)
""
;
comment
.
str
=
(
char
*
)
""
;
...
@@ -375,7 +375,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
...
@@ -375,7 +375,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
{
{
/* old frm file */
/* old frm file */
field_type
=
(
enum_field_types
)
f_packtype
(
pack_flag
);
field_type
=
(
enum_field_types
)
f_packtype
(
pack_flag
);
charset
=
outparam
->
table_charset
;
charset
=
outparam
->
table_charset
?
outparam
->
table_charset
:
default_charset_info
;
bzero
((
char
*
)
&
comment
,
sizeof
(
comment
));
bzero
((
char
*
)
&
comment
,
sizeof
(
comment
));
}
}
*
field_ptr
=
reg_field
=
*
field_ptr
=
reg_field
=
...
@@ -1041,7 +1041,7 @@ File create_frm(register my_string name, uint reclength, uchar *fileinfo,
...
@@ -1041,7 +1041,7 @@ File create_frm(register my_string name, uint reclength, uchar *fileinfo,
int2store
(
fileinfo
+
30
,
create_info
->
table_options
);
int2store
(
fileinfo
+
30
,
create_info
->
table_options
);
fileinfo
[
32
]
=
0
;
// No filename anymore
fileinfo
[
32
]
=
0
;
// No filename anymore
int4store
(
fileinfo
+
34
,
create_info
->
avg_row_length
);
int4store
(
fileinfo
+
34
,
create_info
->
avg_row_length
);
fileinfo
[
38
]
=
create_info
->
table_charset
->
number
;
fileinfo
[
38
]
=
create_info
->
table_charset
?
create_info
->
table_charset
->
number
:
0
;
fileinfo
[
40
]
=
(
uchar
)
create_info
->
row_type
;
fileinfo
[
40
]
=
(
uchar
)
create_info
->
row_type
;
fileinfo
[
41
]
=
(
uchar
)
create_info
->
raid_type
;
fileinfo
[
41
]
=
(
uchar
)
create_info
->
raid_type
;
fileinfo
[
42
]
=
(
uchar
)
create_info
->
raid_chunks
;
fileinfo
[
42
]
=
(
uchar
)
create_info
->
raid_chunks
;
...
@@ -1072,6 +1072,7 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
...
@@ -1072,6 +1072,7 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
create_info
->
raid_type
=
table
->
raid_type
;
create_info
->
raid_type
=
table
->
raid_type
;
create_info
->
raid_chunks
=
table
->
raid_chunks
;
create_info
->
raid_chunks
=
table
->
raid_chunks
;
create_info
->
raid_chunksize
=
table
->
raid_chunksize
;
create_info
->
raid_chunksize
=
table
->
raid_chunksize
;
create_info
->
table_charset
=
table
->
table_charset
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1094,7 +1095,7 @@ char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr)
...
@@ -1094,7 +1095,7 @@ char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr)
{
{
Field
*
field
=
table
->
field
[
fieldnr
];
Field
*
field
=
table
->
field
[
fieldnr
];
char
buff
[
MAX_FIELD_WIDTH
];
char
buff
[
MAX_FIELD_WIDTH
];
String
str
(
buff
,
sizeof
(
buff
),
table
->
table_charset
);
String
str
(
buff
,
sizeof
(
buff
),
default_charset_info
);
field
->
val_str
(
&
str
,
&
str
);
field
->
val_str
(
&
str
,
&
str
);
uint
length
=
str
.
length
();
uint
length
=
str
.
length
();
if
(
!
length
)
if
(
!
length
)
...
...
sql/unireg.cc
View file @
6f5f4785
...
@@ -459,8 +459,7 @@ static bool pack_fields(File file,List<create_field> &create_fields)
...
@@ -459,8 +459,7 @@ static bool pack_fields(File file,List<create_field> &create_fields)
int2store
(
buff
+
8
,
field
->
unireg_check
);
int2store
(
buff
+
8
,
field
->
unireg_check
);
buff
[
10
]
=
(
uchar
)
field
->
interval_id
;
buff
[
10
]
=
(
uchar
)
field
->
interval_id
;
buff
[
11
]
=
(
uchar
)
field
->
sql_type
;
buff
[
11
]
=
(
uchar
)
field
->
sql_type
;
buff
[
12
]
=
(
uchar
)
(
field
->
charset
?
field
->
charset
->
number
:
buff
[
12
]
=
(
uchar
)
field
->
charset
->
number
;
default_charset_info
->
number
);
int2store
(
buff
+
13
,
field
->
comment
.
length
);
int2store
(
buff
+
13
,
field
->
comment
.
length
);
comment_length
+=
field
->
comment
.
length
;
comment_length
+=
field
->
comment
.
length
;
set_if_bigger
(
int_count
,
field
->
interval_id
);
set_if_bigger
(
int_count
,
field
->
interval_id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment