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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
13e11faa
Commit
13e11faa
authored
Mar 29, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.1
parents
17384904
1c4138bf
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
179 additions
and
2 deletions
+179
-2
libmysqld/Makefile.am
libmysqld/Makefile.am
+1
-1
sql/Makefile.am
sql/Makefile.am
+1
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+140
-0
sql/item_strfunc.h
sql/item_strfunc.h
+23
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+14
-0
No files found.
libmysqld/Makefile.am
View file @
13e11faa
...
@@ -49,7 +49,7 @@ sqlsources = convert.cc derror.cc field.cc field_conv.cc filesort.cc \
...
@@ -49,7 +49,7 @@ sqlsources = convert.cc derror.cc field.cc field_conv.cc filesort.cc \
repl_failsafe.cc slave.cc
\
repl_failsafe.cc slave.cc
\
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc
\
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc
\
sql_crypt.cc sql_db.cc sql_delete.cc sql_insert.cc sql_lex.cc
\
sql_crypt.cc sql_db.cc sql_delete.cc sql_insert.cc sql_lex.cc
\
sql_list.cc sql_manager.cc sql_map.cc sql_parse.cc
\
sql_list.cc sql_manager.cc sql_map.cc sql_parse.cc
sql_derived.cc
\
sql_rename.cc sql_repl.cc sql_select.cc sql_do.cc sql_show.cc
\
sql_rename.cc sql_repl.cc sql_select.cc sql_do.cc sql_show.cc
\
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc
\
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc
\
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc
\
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc
\
...
...
sql/Makefile.am
View file @
13e11faa
...
@@ -79,7 +79,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
...
@@ -79,7 +79,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc
\
sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc
\
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc
\
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc
\
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc
\
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc
\
slave.cc sql_repl.cc sql_union.cc
\
slave.cc sql_repl.cc sql_union.cc
sql_derived.cc
\
mini_client.cc mini_client_errors.c
\
mini_client.cc mini_client_errors.c
\
stacktrace.c repl_failsafe.h repl_failsafe.cc
\
stacktrace.c repl_failsafe.h repl_failsafe.cc
\
gstream.cc spatial.cc
gstream.cc spatial.cc
...
...
sql/item_strfunc.cc
View file @
13e11faa
...
@@ -1776,6 +1776,146 @@ String *Item_func_conv::val_str(String *str)
...
@@ -1776,6 +1776,146 @@ String *Item_func_conv::val_str(String *str)
}
}
String
*
Item_func_conv_charset
::
val_str
(
String
*
str
)
{
my_wc_t
wc
;
int
cnvres
;
const
uchar
*
s
,
*
se
;
uchar
*
d
,
*
d0
,
*
de
;
uint
dmaxlen
;
String
*
arg
=
args
[
0
]
->
val_str
(
str
);
CHARSET_INFO
*
from
,
*
to
;
if
(
!
arg
)
{
null_value
=
1
;
return
0
;
}
from
=
arg
->
charset
();
to
=
conv_charset
;
s
=
(
const
uchar
*
)
arg
->
ptr
();
se
=
s
+
arg
->
length
();
dmaxlen
=
arg
->
length
()
*
(
conv_charset
->
mbmaxlen
?
conv_charset
->
mbmaxlen
:
1
)
+
1
;
str
->
alloc
(
dmaxlen
);
d0
=
d
=
(
unsigned
char
*
)
str
->
ptr
();
de
=
d
+
dmaxlen
;
while
(
s
<
se
&&
d
<
de
){
cnvres
=
from
->
mb_wc
(
from
,
&
wc
,
s
,
se
);
if
(
cnvres
>
0
)
{
s
+=
cnvres
;
}
else
if
(
cnvres
==
MY_CS_ILSEQ
)
{
s
++
;
wc
=
'?'
;
}
else
break
;
outp:
cnvres
=
to
->
wc_mb
(
to
,
wc
,
d
,
de
);
if
(
cnvres
>
0
)
{
d
+=
cnvres
;
}
else
if
(
cnvres
==
MY_CS_ILUNI
&&
wc
!=
'?'
)
{
wc
=
'?'
;
goto
outp
;
}
else
break
;
};
str
->
length
((
uint
)
(
d
-
d0
));
str
->
set_charset
(
to
);
return
str
;
}
void
Item_func_conv_charset
::
fix_length_and_dec
()
{
/* BAR TODO: What to do here??? */
}
String
*
Item_func_conv_charset3
::
val_str
(
String
*
str
)
{
my_wc_t
wc
;
int
cnvres
;
const
uchar
*
s
,
*
se
;
uchar
*
d
,
*
d0
,
*
de
;
uint
dmaxlen
;
String
*
arg
=
args
[
0
]
->
val_str
(
str
);
String
*
to_cs
=
args
[
1
]
->
val_str
(
str
);
String
*
from_cs
=
args
[
2
]
->
val_str
(
str
);
CHARSET_INFO
*
from_charset
;
CHARSET_INFO
*
to_charset
;
if
(
!
arg
||
args
[
0
]
->
null_value
||
!
to_cs
||
args
[
1
]
->
null_value
||
!
from_cs
||
args
[
2
]
->
null_value
||
!
(
from_charset
=
find_compiled_charset_by_name
(
from_cs
->
ptr
()))
||
!
(
to_charset
=
find_compiled_charset_by_name
(
to_cs
->
ptr
())))
{
null_value
=
1
;
return
0
;
}
s
=
(
const
uchar
*
)
arg
->
ptr
();
se
=
s
+
arg
->
length
();
dmaxlen
=
arg
->
length
()
*
(
to_charset
->
mbmaxlen
?
to_charset
->
mbmaxlen
:
1
)
+
1
;
str
->
alloc
(
dmaxlen
);
d0
=
d
=
(
unsigned
char
*
)
str
->
ptr
();
de
=
d
+
dmaxlen
;
while
(
s
<
se
&&
d
<
de
){
cnvres
=
from_charset
->
mb_wc
(
from_charset
,
&
wc
,
s
,
se
);
if
(
cnvres
>
0
)
{
s
+=
cnvres
;
}
else
if
(
cnvres
==
MY_CS_ILSEQ
)
{
s
++
;
wc
=
'?'
;
}
else
break
;
outp:
cnvres
=
to_charset
->
wc_mb
(
to_charset
,
wc
,
d
,
de
);
if
(
cnvres
>
0
)
{
d
+=
cnvres
;
}
else
if
(
cnvres
==
MY_CS_ILUNI
&&
wc
!=
'?'
)
{
wc
=
'?'
;
goto
outp
;
}
else
break
;
};
str
->
length
((
uint
)
(
d
-
d0
));
str
->
set_charset
(
to_charset
);
return
str
;
}
void
Item_func_conv_charset3
::
fix_length_and_dec
()
{
/* BAR TODO: What to do here??? */
}
String
*
Item_func_hex
::
val_str
(
String
*
str
)
String
*
Item_func_hex
::
val_str
(
String
*
str
)
{
{
if
(
args
[
0
]
->
result_type
()
!=
STRING_RESULT
)
if
(
args
[
0
]
->
result_type
()
!=
STRING_RESULT
)
...
...
sql/item_strfunc.h
View file @
13e11faa
...
@@ -476,6 +476,29 @@ class Item_func_export_set: public Item_str_func
...
@@ -476,6 +476,29 @@ class Item_func_export_set: public Item_str_func
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
3
*
8
+
7
;
}
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
3
*
8
+
7
;
}
};
};
class
Item_func_conv_charset
:
public
Item_str_func
{
CHARSET_INFO
*
conv_charset
;
public:
Item_func_conv_charset
(
Item
*
a
,
CHARSET_INFO
*
cs
)
:
Item_str_func
(
a
)
{
conv_charset
=
cs
;
}
String
*
val_str
(
String
*
);
void
fix_length_and_dec
();
const
char
*
func_name
()
const
{
return
"conv_charset"
;
}
};
class
Item_func_conv_charset3
:
public
Item_str_func
{
public:
Item_func_conv_charset3
(
Item
*
arg1
,
Item
*
arg2
,
Item
*
arg3
)
:
Item_str_func
(
arg1
,
arg2
,
arg3
)
{}
String
*
val_str
(
String
*
);
void
fix_length_and_dec
();
const
char
*
func_name
()
const
{
return
"conv_charset3"
;
}
};
/*******************************************************
/*******************************************************
Spatial functions
Spatial functions
...
...
sql/sql_yacc.yy
View file @
13e11faa
...
@@ -1654,6 +1654,20 @@ simple_expr:
...
@@ -1654,6 +1654,20 @@ simple_expr:
| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
{ $$= new Item_func_case(* $4, $2, $5 ); }
{ $$= new Item_func_case(* $4, $2, $5 ); }
| CONVERT_SYM '(' expr ',' cast_type ')' { $$= create_func_cast($3, $5); }
| CONVERT_SYM '(' expr ',' cast_type ')' { $$= create_func_cast($3, $5); }
| CONVERT_SYM '(' expr USING IDENT ')'
{
CHARSET_INFO *cs=find_compiled_charset_by_name($5.str);
if (!cs)
{
net_printf(¤t_thd->net,ER_UNKNOWN_CHARACTER_SET,$5);
YYABORT;
}
$$= new Item_func_conv_charset($3,cs);
}
| CONVERT_SYM '(' expr ',' expr ',' expr ')'
{
$$= new Item_func_conv_charset3($3,$5,$7);
}
| FUNC_ARG0 '(' ')'
| FUNC_ARG0 '(' ')'
{ $$= ((Item*(*)(void))($1.symbol->create_func))();}
{ $$= ((Item*(*)(void))($1.symbol->create_func))();}
| FUNC_ARG1 '(' expr ')'
| FUNC_ARG1 '(' expr ')'
...
...
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