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
e89cb7f2
Commit
e89cb7f2
authored
Feb 03, 2013
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Translate column names to UTF-8 in ha_connect::pre_create.
parent
9ca150aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+25
-9
storage/connect/ha_connect.h
storage/connect/ha_connect.h
+1
-0
No files found.
storage/connect/ha_connect.cc
View file @
e89cb7f2
...
...
@@ -3133,6 +3133,22 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key,
DBUG_RETURN
(
rows
);
}
// end of records_in_range
/**
Convert an ISO-8859-1 column name to UTF-8
*/
char
*
ha_connect
::
encode
(
PGLOBAL
g
,
char
*
cnm
)
{
char
*
buf
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
cnm
)
*
3
);
uint
dummy_errors
;
uint32
len
=
copy_and_convert
(
buf
,
strlen
(
cnm
)
*
3
,
&
my_charset_utf8_bin
,
cnm
,
strlen
(
cnm
),
&
my_charset_latin1
,
&
dummy_errors
);
buf
[
len
]
=
'\0'
;
return
buf
;
}
// end of Encode
/**
Store field definition for create.
...
...
@@ -3349,7 +3365,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
}
// endif ttp
if
(
ok
)
{
char
*
length
,
*
decimals
,
*
nm
,
*
rem
;
char
*
length
,
*
decimals
,
*
c
nm
,
*
rem
;
int
i
,
len
,
dec
;
bool
b
;
LEX_STRING
*
comment
,
*
name
;
...
...
@@ -3392,18 +3408,18 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
}
// endif qrp
for
(
i
=
0
;
i
<
qrp
->
Nblin
;
i
++
)
{
crp
=
qrp
->
Colresp
;
// Column Name
nm
=
crp
->
Kdata
->
GetCharValue
(
i
);
name
=
thd
->
make_lex_string
(
NULL
,
nm
,
strlen
(
nm
),
true
);
crp
=
crp
->
Next
;
// Data Type
crp
=
qrp
->
Colresp
;
// Column Name
cnm
=
encode
(
g
,
crp
->
Kdata
->
GetCharValue
(
i
)
);
name
=
thd
->
make_lex_string
(
NULL
,
cnm
,
strlen
(
c
nm
),
true
);
crp
=
crp
->
Next
;
// Data Type
type
=
PLGtoMYSQL
(
crp
->
Kdata
->
GetIntValue
(
i
),
true
);
crp
=
crp
->
Next
;
// Type Name
crp
=
crp
->
Next
;
// Precision (length)
crp
=
crp
->
Next
;
// Type Name
crp
=
crp
->
Next
;
// Precision (length)
len
=
crp
->
Kdata
->
GetIntValue
(
i
);
length
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
8
);
sprintf
(
length
,
"%d"
,
len
);
crp
=
crp
->
Next
;
// Length
crp
=
crp
->
Next
;
// Scale (precision)
crp
=
crp
->
Next
;
// Length
crp
=
crp
->
Next
;
// Scale (precision)
if
((
dec
=
crp
->
Kdata
->
GetIntValue
(
i
)))
{
decimals
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
8
);
...
...
storage/connect/ha_connect.h
View file @
e89cb7f2
...
...
@@ -347,6 +347,7 @@ char *GetValStr(OPVAL vop, bool neg);
protected:
char
*
GetListOption
(
char
*
opname
,
const
char
*
oplist
,
char
*
def
=
NULL
);
char
*
encode
(
PGLOBAL
g
,
char
*
cnm
);
bool
add_fields
(
THD
*
thd
,
void
*
alter_info
,
LEX_STRING
*
field_name
,
enum_field_types
type
,
...
...
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