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
4cefc97f
Commit
4cefc97f
authored
Nov 25, 2002
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed CAST( xxx as CHAR)
parent
5dbea1b7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
14 deletions
+34
-14
sql/item.h
sql/item.h
+6
-4
sql/item_strfunc.cc
sql/item_strfunc.cc
+7
-4
sql/item_strfunc.h
sql/item_strfunc.h
+2
-1
sql/item_timefunc.h
sql/item_timefunc.h
+16
-3
sql/sql_string.h
sql/sql_string.h
+3
-2
No files found.
sql/item.h
View file @
4cefc97f
...
...
@@ -85,12 +85,14 @@ public:
virtual
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
);
virtual
bool
get_time
(
TIME
*
ltime
);
virtual
bool
is_null
()
{
return
0
;
};
virtual
CHARSET_INFO
*
thd_charset
()
const
;
virtual
CHARSET_INFO
*
charset
()
const
{
return
str_value
.
charset
();
};
virtual
bool
binary
()
const
{
return
str_value
.
charset
()
->
state
&
MY_CS_BINSORT
?
1
:
0
;
}
virtual
void
set_charset
(
CHARSET_INFO
*
cs
)
{
str_value
.
set_charset
(
cs
);
}
virtual
bool
check_loop
(
uint
id
);
virtual
void
top_level_item
()
{}
virtual
bool
binary
()
const
{
return
str_value
.
charset
()
->
state
&
MY_CS_BINSORT
?
1
:
0
;
}
CHARSET_INFO
*
thd_charset
()
const
;
CHARSET_INFO
*
charset
()
const
{
return
str_value
.
charset
();
};
void
set_charset
(
CHARSET_INFO
*
cs
)
{
str_value
.
set_charset
(
cs
);
}
};
...
...
sql/item_strfunc.cc
View file @
4cefc97f
...
...
@@ -1363,17 +1363,19 @@ String *Item_func_decode::val_str(String *str)
String
*
Item_func_database
::
val_str
(
String
*
str
)
{
if
(
!
current_thd
->
db
)
THD
*
thd
=
current_thd
;
if
(
!
thd
->
db
)
str
->
length
(
0
);
else
str
->
copy
((
const
char
*
)
current_thd
->
db
,(
uint
)
strlen
(
current_thd
->
db
),
system_charset_info
,
thd_charset
());
str
->
copy
((
const
char
*
)
thd
->
db
,(
uint
)
strlen
(
thd
->
db
),
system_charset_info
,
thd
->
thd_charset
);
return
str
;
}
String
*
Item_func_user
::
val_str
(
String
*
str
)
{
THD
*
thd
=
current_thd
;
CHARSET_INFO
*
cs
=
thd
_charset
()
;
CHARSET_INFO
*
cs
=
thd
->
thd_charset
;
const
char
*
host
=
thd
->
host
?
thd
->
host
:
thd
->
ip
?
thd
->
ip
:
""
;
uint32
res_length
=
(
strlen
(
thd
->
user
)
+
strlen
(
host
)
+
10
)
*
cs
->
mbmaxlen
;
...
...
@@ -2128,7 +2130,8 @@ String *Item_func_charset::val_str(String *str)
if
((
null_value
=
(
args
[
0
]
->
null_value
||
!
res
->
charset
())))
return
0
;
str
->
copy
(
res
->
charset
()
->
name
,
strlen
(
res
->
charset
()
->
name
),
my_charset_latin1
,
thd_charset
());
str
->
copy
(
res
->
charset
()
->
name
,
strlen
(
res
->
charset
()
->
name
),
my_charset_latin1
,
thd_charset
());
return
str
;
}
...
...
sql/item_strfunc.h
View file @
4cefc97f
...
...
@@ -494,6 +494,7 @@ public:
{
String
*
tmp
=
args
[
0
]
->
val_str
(
a
);
null_value
=
args
[
0
]
->
null_value
;
tmp
->
set_charset
(
my_charset_bin
);
return
tmp
;
}
void
fix_length_and_dec
()
...
...
sql/item_timefunc.h
View file @
4cefc97f
...
...
@@ -534,8 +534,17 @@ public:
Item_typecast
(
Item
*
a
)
:
Item_str_func
(
a
)
{}
const
char
*
func_name
()
const
{
return
"char"
;
}
String
*
val_str
(
String
*
a
)
{
a
=
args
[
0
]
->
val_str
(
a
);
null_value
=
args
[
0
]
->
null_value
;
return
a
;
}
void
fix_length_and_dec
()
{
max_length
=
args
[
0
]
->
max_length
;
}
{
String
*
tmp
=
args
[
0
]
->
val_str
(
a
);
null_value
=
args
[
0
]
->
null_value
;
tmp
->
set_charset
(
charset
());
return
tmp
;
}
void
fix_length_and_dec
()
{
set_charset
(
thd_charset
());
max_length
=
args
[
0
]
->
max_length
;
}
void
print
(
String
*
str
);
};
...
...
@@ -544,7 +553,11 @@ class Item_char_typecast :public Item_typecast
{
public:
Item_char_typecast
(
Item
*
a
)
:
Item_typecast
(
a
)
{}
void
fix_length_and_dec
()
{
binary
=
0
;
max_length
=
args
[
0
]
->
max_length
;
}
void
fix_length_and_dec
()
{
set_charset
(
thd_charset
());
max_length
=
args
[
0
]
->
max_length
;
}
};
...
...
sql/sql_string.h
View file @
4cefc97f
...
...
@@ -72,7 +72,7 @@ public:
{
sql_element_free
(
ptr_arg
);
}
~
String
()
{
free
();
}
inline
void
set_charset
(
CHARSET_INFO
*
charset
)
{
str_charset
=
charset
;
}
inline
void
set_charset
(
CHARSET_INFO
*
charset
)
{
str_charset
=
charset
;
}
inline
CHARSET_INFO
*
charset
()
const
{
return
str_charset
;
}
inline
uint32
length
()
const
{
return
str_length
;}
inline
uint32
alloced_length
()
const
{
return
Alloced_length
;}
...
...
@@ -177,7 +177,8 @@ public:
bool
copy
();
// Alloc string if not alloced
bool
copy
(
const
String
&
s
);
// Allocate new string
bool
copy
(
const
char
*
s
,
uint32
arg_length
,
CHARSET_INFO
*
cs
);
// Allocate new string
bool
copy
(
const
char
*
s
,
uint32
arg_length
,
CHARSET_INFO
*
csfrom
,
CHARSET_INFO
*
csto
);
bool
copy
(
const
char
*
s
,
uint32
arg_length
,
CHARSET_INFO
*
csfrom
,
CHARSET_INFO
*
csto
);
bool
append
(
const
String
&
s
);
bool
append
(
const
char
*
s
,
uint32
arg_length
=
0
);
bool
append
(
IO_CACHE
*
file
,
uint32
arg_length
);
...
...
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