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
e8412e9e
Commit
e8412e9e
authored
Feb 27, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
field.cc:
Now all text fields convert data into proper charset before storing
parent
a5cfbcd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletion
+45
-1
sql/field.cc
sql/field.cc
+45
-1
No files found.
sql/field.cc
View file @
e8412e9e
...
@@ -3878,6 +3878,15 @@ void Field_datetime::sql_type(String &res) const
...
@@ -3878,6 +3878,15 @@ void Field_datetime::sql_type(String &res) const
int
Field_string
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
int
Field_string
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
{
{
int
error
=
0
;
int
error
=
0
;
char
buff
[
80
];
String
tmpstr
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
/* Convert character set if nesessary */
if
((
cs
!=
field_charset
)
&&
(
cs
!=&
my_charset_bin
)
&&
(
!
binary
()))
{
tmpstr
.
copy
(
from
,
length
,
cs
,
field_charset
);
from
=
tmpstr
.
ptr
();
length
=
tmpstr
.
length
();
}
if
(
length
<=
field_length
)
if
(
length
<=
field_length
)
{
{
memcpy
(
ptr
,
from
,
length
);
memcpy
(
ptr
,
from
,
length
);
...
@@ -4051,6 +4060,15 @@ uint Field_string::max_packed_col_length(uint max_length)
...
@@ -4051,6 +4060,15 @@ uint Field_string::max_packed_col_length(uint max_length)
int
Field_varstring
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
int
Field_varstring
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
{
{
int
error
=
0
;
int
error
=
0
;
char
buff
[
80
];
String
tmpstr
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
/* Convert character set if nesessary */
if
((
cs
!=
field_charset
)
&&
(
cs
!=&
my_charset_bin
)
&&
(
!
binary
()))
{
tmpstr
.
copy
(
from
,
length
,
cs
,
field_charset
);
from
=
tmpstr
.
ptr
();
length
=
tmpstr
.
length
();
}
if
(
length
>
field_length
)
if
(
length
>
field_length
)
{
{
length
=
field_length
;
length
=
field_length
;
...
@@ -4359,6 +4377,15 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
...
@@ -4359,6 +4377,15 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
}
}
else
else
{
{
char
buff
[
80
];
String
tmpstr
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
/* Convert character set if nesessary */
if
((
cs
!=
field_charset
)
&&
(
cs
!=&
my_charset_bin
)
&&
(
!
binary
()))
{
tmpstr
.
copy
(
from
,
length
,
cs
,
field_charset
);
from
=
tmpstr
.
ptr
();
length
=
tmpstr
.
length
();
}
Field_blob
::
store_length
(
length
);
Field_blob
::
store_length
(
length
);
if
(
table
->
copy_blobs
||
length
<=
MAX_FIELD_WIDTH
)
if
(
table
->
copy_blobs
||
length
<=
MAX_FIELD_WIDTH
)
{
// Must make a copy
{
// Must make a copy
...
@@ -4827,6 +4854,15 @@ uint find_enum(TYPELIB *lib,const char *x, uint length)
...
@@ -4827,6 +4854,15 @@ uint find_enum(TYPELIB *lib,const char *x, uint length)
int
Field_enum
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
int
Field_enum
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
{
{
int
err
=
0
;
int
err
=
0
;
char
buff
[
80
];
String
tmpstr
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
/* Convert character set if nesessary */
if
((
cs
!=
field_charset
)
&&
(
cs
!=&
my_charset_bin
)
&&
(
!
binary
()))
{
tmpstr
.
copy
(
from
,
length
,
cs
,
field_charset
);
from
=
tmpstr
.
ptr
();
length
=
tmpstr
.
length
();
}
uint
tmp
=
find_enum
(
typelib
,
from
,
length
);
uint
tmp
=
find_enum
(
typelib
,
from
,
length
);
if
(
!
tmp
)
if
(
!
tmp
)
{
{
...
@@ -5033,7 +5069,15 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
...
@@ -5033,7 +5069,15 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
int
err
=
0
;
int
err
=
0
;
char
*
not_used
;
char
*
not_used
;
uint
not_used2
;
uint
not_used2
;
char
buff
[
80
];
String
tmpstr
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
/* Convert character set if nesessary */
if
((
cs
!=
field_charset
)
&&
(
cs
!=&
my_charset_bin
)
&&
(
!
binary
()))
{
tmpstr
.
copy
(
from
,
length
,
cs
,
field_charset
);
from
=
tmpstr
.
ptr
();
length
=
tmpstr
.
length
();
}
ulonglong
tmp
=
find_set
(
typelib
,
from
,
length
,
&
not_used
,
&
not_used2
);
ulonglong
tmp
=
find_set
(
typelib
,
from
,
length
,
&
not_used
,
&
not_used2
);
if
(
!
tmp
&&
length
&&
length
<
22
)
if
(
!
tmp
&&
length
&&
length
<
22
)
{
{
...
...
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