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
8e6a2e98
Commit
8e6a2e98
authored
Feb 11, 2004
by
dlenev@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-bg2248
parents
d38c4fca
7d361a6c
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
59 additions
and
194 deletions
+59
-194
include/mysql.h
include/mysql.h
+1
-0
libmysql/libmysql.c
libmysql/libmysql.c
+2
-3
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+19
-1
mysql-test/r/cast.result
mysql-test/r/cast.result
+0
-6
mysql-test/r/ctype_many.result
mysql-test/r/ctype_many.result
+0
-123
mysql-test/r/func_system.result
mysql-test/r/func_system.result
+14
-0
mysql-test/t/cast.test
mysql-test/t/cast.test
+0
-2
mysql-test/t/ctype_many.test
mysql-test/t/ctype_many.test
+0
-5
mysql-test/t/func_system.test
mysql-test/t/func_system.test
+6
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-38
sql/item_strfunc.h
sql/item_strfunc.h
+2
-12
sql/sql_class.h
sql/sql_class.h
+2
-0
sql/sql_parse.cc
sql/sql_parse.cc
+11
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+0
-2
No files found.
include/mysql.h
View file @
8e6a2e98
...
...
@@ -572,6 +572,7 @@ typedef struct st_mysql_methods
int
(
*
unbuffered_fetch
)(
MYSQL
*
mysql
,
char
**
row
);
void
(
*
free_embedded_thd
)(
MYSQL
*
mysql
);
const
char
*
(
*
read_statistic
)(
MYSQL
*
mysql
);
int
(
*
next_result
)(
MYSQL
*
mysql
);
#endif
}
MYSQL_METHODS
;
...
...
libmysql/libmysql.c
View file @
8e6a2e98
...
...
@@ -3460,7 +3460,6 @@ my_bool STDCALL mysql_more_results(MYSQL *mysql)
/*
Reads and returns the next query results
*/
int
STDCALL
mysql_next_result
(
MYSQL
*
mysql
)
{
DBUG_ENTER
(
"mysql_next_result"
);
...
...
@@ -3479,8 +3478,8 @@ int STDCALL mysql_next_result(MYSQL *mysql)
mysql
->
affected_rows
=
~
(
my_ulonglong
)
0
;
if
(
mysql
->
last_used_con
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
)
DBUG_RETURN
((
*
mysql
->
methods
->
read_query
_result
)(
mysql
));
DBUG_RETURN
((
*
mysql
->
methods
->
next
_result
)(
mysql
));
DBUG_RETURN
(
-
1
);
/* No more results */
}
...
...
libmysqld/lib_sql.cc
View file @
8e6a2e98
...
...
@@ -245,6 +245,18 @@ static MYSQL_RES * emb_mysql_store_result(MYSQL *mysql)
return
mysql_store_result
(
mysql
);
}
int
emb_next_result
(
MYSQL
*
mysql
)
{
THD
*
thd
=
(
THD
*
)
mysql
->
thd
;
DBUG_ENTER
(
"emb_next_result"
);
if
(
emb_advanced_command
(
mysql
,
COM_QUERY
,
0
,
0
,
thd
->
query_rest
,
thd
->
query_rest_length
,
1
)
||
emb_mysql_read_query_result
(
mysql
))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
0
);
/* No more results */
}
MYSQL_METHODS
embedded_methods
=
{
...
...
@@ -259,7 +271,8 @@ MYSQL_METHODS embedded_methods=
emb_read_binary_rows
,
emb_unbuffered_fetch
,
emb_free_embedded_thd
,
emb_read_statistic
emb_read_statistic
,
emb_next_result
};
C_MODE_END
...
...
@@ -749,6 +762,11 @@ bool Protocol::net_store_data(const char *from, uint length)
return
false
;
}
char
*
memdup_mysql
(
struct
st_mysql
*
mysql
,
const
char
*
data
,
int
length
)
{
return
memdup_root
(
&
mysql
->
field_alloc
,
data
,
length
);
}
#if 0
/* The same as Protocol::net_store_data but does the converstion
*/
...
...
mysql-test/r/cast.result
View file @
8e6a2e98
...
...
@@ -64,12 +64,6 @@ test
select cast(_koi8r'' as char character set cp1251);
cast(_koi8r'' as char character set cp1251)
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci")
test
select convert(_koi8r'', "koi8r_general_ci", "cp1251_general_ci");
convert(_koi8r'', "koi8r_general_ci", "cp1251_general_ci")
create table t1 select cast(_koi8r'' as char character set cp1251) as t;
show create table t1;
Table Create Table
...
...
mysql-test/r/ctype_many.result
View file @
8e6a2e98
No preview for this file type
mysql-test/r/func_system.result
View file @
8e6a2e98
...
...
@@ -51,6 +51,20 @@ t1 CREATE TABLE `t1` (
`version` char(40) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
charset(charset(_utf8'a')) charset(collation(_utf8'a'))
utf8 utf8
select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
collation(charset(_utf8'a')) collation(collation(_utf8'a'))
utf8_general_ci utf8_general_ci
create table t1 select charset(_utf8'a'), collation(_utf8'a');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`charset(_utf8'a')` char(64) character set utf8 NOT NULL default '',
`collation(_utf8'a')` char(64) character set utf8 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select TRUE,FALSE,NULL;
TRUE FALSE NULL
1 0 NULL
mysql-test/t/cast.test
View file @
8e6a2e98
...
...
@@ -28,8 +28,6 @@ select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
set
names
binary
;
select
cast
(
_latin1
'test'
as
char
character
set
latin2
);
select
cast
(
_koi8r
''
as
char
character
set
cp1251
);
select
convert
(
_latin1
'test'
,
"latin1_german1_ci"
,
"latin1_swedish_ci"
);
select
convert
(
_koi8r
''
,
"koi8r_general_ci"
,
"cp1251_general_ci"
);
create
table
t1
select
cast
(
_koi8r
''
as
char
character
set
cp1251
)
as
t
;
show
create
table
t1
;
drop
table
t1
;
...
...
mysql-test/t/ctype_many.test
View file @
8e6a2e98
...
...
@@ -147,11 +147,6 @@ UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
SET
CHARACTER
SET
koi8r
;
SELECT
*
FROM
t1
;
#
# codecovarage for Item_func_conv_charset3
#
select
CONVERT
(
koi8_ru_f
,
'cp1251_general_ci'
,
'utf8_general_ci'
),
comment
from
t1
;
explain
extended
select
CONVERT
(
koi8_ru_f
,
'cp1251_general_ci'
,
'utf8_general_ci'
),
comment
from
t1
;
ALTER
TABLE
t1
ADD
bin_f
CHAR
(
32
)
BYTE
NOT
NULL
;
UPDATE
t1
SET
bin_f
=
koi8_ru_f
;
...
...
mysql-test/t/func_system.test
View file @
8e6a2e98
...
...
@@ -23,4 +23,10 @@ create table t1 (version char(40)) select database(), user(), version() as 'vers
show
create
table
t1
;
drop
table
t1
;
select
charset
(
charset
(
_utf8
'a'
)),
charset
(
collation
(
_utf8
'a'
));
select
collation
(
charset
(
_utf8
'a'
)),
collation
(
collation
(
_utf8
'a'
));
create
table
t1
select
charset
(
_utf8
'a'
),
collation
(
_utf8
'a'
);
show
create
table
t1
;
drop
table
t1
;
select
TRUE
,
FALSE
,
NULL
;
sql/item_strfunc.cc
View file @
8e6a2e98
...
...
@@ -2124,42 +2124,6 @@ void Item_func_conv_charset::print(String *str)
str
->
append
(
')'
);
}
String
*
Item_func_conv_charset3
::
val_str
(
String
*
str
)
{
char
cs1
[
30
],
cs2
[
30
];
String
to_cs_buff
(
cs1
,
sizeof
(
cs1
),
default_charset_info
);
String
from_cs_buff
(
cs2
,
sizeof
(
cs2
),
default_charset_info
);
String
*
arg
=
args
[
0
]
->
val_str
(
str
);
String
*
to_cs
=
args
[
1
]
->
val_str
(
&
to_cs_buff
);
String
*
from_cs
=
args
[
2
]
->
val_str
(
&
from_cs_buff
);
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
=
get_charset_by_name
(
from_cs
->
ptr
(),
MYF
(
MY_WME
)))
||
!
(
to_charset
=
get_charset_by_name
(
to_cs
->
ptr
(),
MYF
(
MY_WME
))))
{
null_value
=
1
;
return
0
;
}
if
(
str_value
.
copy
(
arg
->
ptr
(),
arg
->
length
(),
from_charset
,
to_charset
))
{
null_value
=
1
;
return
0
;
}
null_value
=
0
;
return
&
str_value
;
}
void
Item_func_conv_charset3
::
fix_length_and_dec
()
{
max_length
=
args
[
0
]
->
max_length
;
}
String
*
Item_func_set_collation
::
val_str
(
String
*
str
)
{
str
=
args
[
0
]
->
val_str
(
str
);
...
...
@@ -2226,7 +2190,7 @@ String *Item_func_charset::val_str(String *str)
if
((
null_value
=
(
args
[
0
]
->
null_value
||
!
res
->
charset
())))
return
0
;
str
->
copy
(
res
->
charset
()
->
csname
,
strlen
(
res
->
charset
()
->
csname
),
&
my_charset_latin1
,
default_charset
()
);
&
my_charset_latin1
,
collation
.
collation
);
return
str
;
}
...
...
@@ -2237,7 +2201,7 @@ String *Item_func_collation::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
,
default_charset
()
);
&
my_charset_latin1
,
collation
.
collation
);
return
str
;
}
...
...
sql/item_strfunc.h
View file @
8e6a2e98
...
...
@@ -619,16 +619,6 @@ class Item_func_set_collation :public Item_str_func
void
print
(
String
*
str
)
{
print_op
(
str
);
}
};
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
"convert"
;
}
};
class
Item_func_charset
:
public
Item_str_func
{
public:
...
...
@@ -637,8 +627,8 @@ class Item_func_charset :public Item_str_func
const
char
*
func_name
()
const
{
return
"charset"
;
}
void
fix_length_and_dec
()
{
max_length
=
40
;
// should be enough
collation
.
set
(
system_charset_info
);
max_length
=
64
*
collation
.
collation
->
mbmaxlen
;
// should be enough
};
};
...
...
@@ -650,8 +640,8 @@ class Item_func_collation :public Item_str_func
const
char
*
func_name
()
const
{
return
"collation"
;
}
void
fix_length_and_dec
()
{
max_length
=
40
;
// should be enough
collation
.
set
(
system_charset_info
);
max_length
=
64
*
collation
.
collation
->
mbmaxlen
;
// should be enough
};
};
...
...
sql/sql_class.h
View file @
8e6a2e98
...
...
@@ -565,6 +565,8 @@ class THD :public ilink,
struct
st_mysql_bind
*
client_params
;
char
*
extra_data
;
ulong
extra_length
;
char
*
query_rest
;
uint32
query_rest_length
;
#endif
NET
net
;
// client connection descriptor
MEM_ROOT
warn_root
;
// For warnings and errors
...
...
sql/sql_parse.cc
View file @
8e6a2e98
...
...
@@ -48,6 +48,7 @@
extern
"C"
int
gethostname
(
char
*
name
,
int
namelen
);
#endif
char
*
memdup_mysql
(
struct
st_mysql
*
mysql
,
const
char
*
data
,
int
length
);
static
int
check_for_max_user_connections
(
THD
*
thd
,
USER_CONN
*
uc
);
static
void
decrease_user_connections
(
USER_CONN
*
uc
);
static
bool
check_db_used
(
THD
*
thd
,
TABLE_LIST
*
tables
);
...
...
@@ -1397,11 +1398,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
char
*
packet
=
thd
->
lex
->
found_colon
;
/*
Multiple queries exits, execute them individually
in embedded server - just store them to be executed later
*/
#ifndef EMBEDDED_LIBRARY
if
(
thd
->
lock
||
thd
->
open_tables
||
thd
->
derived_tables
)
close_thread_tables
(
thd
);
ulong
length
=
thd
->
query_length
-
(
ulong
)(
thd
->
lex
->
found_colon
-
thd
->
query
);
#endif
ulong
length
=
thd
->
query_length
-
(
ulong
)(
packet
-
thd
->
query
);
/* Remove garbage at start of query */
while
(
my_isspace
(
thd
->
charset
(),
*
packet
)
&&
length
>
0
)
...
...
@@ -1414,7 +1417,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
query_id
=
query_id
++
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
#ifndef EMBEDDED_LIBRARY
mysql_parse
(
thd
,
packet
,
length
);
#else
thd
->
query_rest
=
(
char
*
)
memdup_mysql
(
thd
->
mysql
,
packet
,
length
);
thd
->
query_rest_length
=
length
;
break
;
#endif
/*EMBEDDED_LIBRARY*/
}
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
...
...
sql/sql_yacc.yy
View file @
8e6a2e98
...
...
@@ -2574,8 +2574,6 @@ simple_expr:
}
| CONVERT_SYM '(' expr USING charset_name ')'
{ $$= new Item_func_conv_charset($3,$5); }
| CONVERT_SYM '(' expr ',' expr ',' expr ')'
{ $$= new Item_func_conv_charset3($3,$7,$5); }
| DEFAULT '(' simple_ident ')'
{ $$= new Item_default_value($3); }
| VALUES '(' simple_ident ')'
...
...
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