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
0522b110
Commit
0522b110
authored
Oct 18, 2006
by
mskold/marty@mysql.com/linux.site
Browse files
Options
Browse Files
Download
Plain Diff
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into mysql.com:/windows/Linux_space/MySQL/mysql-5.0-ndb
parents
fff4559e
b381ed95
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
211 additions
and
45 deletions
+211
-45
mysql-test/r/ndb_charset.result
mysql-test/r/ndb_charset.result
+4
-4
mysql-test/r/ndb_condition_pushdown.result
mysql-test/r/ndb_condition_pushdown.result
+22
-0
mysql-test/r/ndb_index_unique.result
mysql-test/r/ndb_index_unique.result
+6
-6
mysql-test/r/ndb_multi.result
mysql-test/r/ndb_multi.result
+32
-0
mysql-test/r/ndb_update.result
mysql-test/r/ndb_update.result
+1
-1
mysql-test/t/ndb_condition_pushdown.test
mysql-test/t/ndb_condition_pushdown.test
+10
-0
mysql-test/t/ndb_multi.test
mysql-test/t/ndb_multi.test
+22
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+43
-16
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+56
-13
sql/handler.cc
sql/handler.cc
+15
-5
No files found.
mysql-test/r/ndb_charset.result
View file @
0522b110
...
@@ -112,9 +112,9 @@ unique key(a)
...
@@ -112,9 +112,9 @@ unique key(a)
) engine=ndb;
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(2, 'aaa');
ERROR 23000: Duplicate entry '
2' for key 1
ERROR 23000: Duplicate entry '
' for key 0
insert into t1 values(3, 'AAA');
insert into t1 values(3, 'AAA');
ERROR 23000: Duplicate entry '
3' for key 1
ERROR 23000: Duplicate entry '
' for key 0
select * from t1 order by p;
select * from t1 order by p;
p a
p a
1 aAa
1 aAa
...
@@ -138,9 +138,9 @@ unique key(a)
...
@@ -138,9 +138,9 @@ unique key(a)
) engine=ndb;
) engine=ndb;
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
insert into t1 values(99,'b');
insert into t1 values(99,'b');
ERROR 23000: Duplicate entry '
99' for key 1
ERROR 23000: Duplicate entry '
' for key 0
insert into t1 values(99,'a ');
insert into t1 values(99,'a ');
ERROR 23000: Duplicate entry '
99' for key 1
ERROR 23000: Duplicate entry '
' for key 0
select a,length(a) from t1 order by a;
select a,length(a) from t1 order by a;
a length(a)
a length(a)
A 1
A 1
...
...
mysql-test/r/ndb_condition_pushdown.result
View file @
0522b110
...
@@ -1782,6 +1782,28 @@ select * from t5 where b like '%jo%' order by a;
...
@@ -1782,6 +1782,28 @@ select * from t5 where b like '%jo%' order by a;
a b
a b
1 jonas
1 jonas
3 johan
3 johan
set engine_condition_pushdown = off;
select auto from t1 where date_time like '1902-02-02 %' order by auto;
auto
2
select auto from t1 where date_time not like '1902-02-02 %' order by auto;
auto
3
4
set engine_condition_pushdown = on;
explain select auto from t1 where date_time like '1902-02-02 %';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
select auto from t1 where date_time like '1902-02-02 %' order by auto;
auto
2
explain select auto from t1 where date_time not like '1902-02-02 %';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
select auto from t1 where date_time not like '1902-02-02 %' order by auto;
auto
3
4
drop table t1;
drop table t1;
create table t1 (a int, b varchar(3), primary key using hash(a))
create table t1 (a int, b varchar(3), primary key using hash(a))
engine=ndb;
engine=ndb;
...
...
mysql-test/r/ndb_index_unique.result
View file @
0522b110
...
@@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
...
@@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
a b c
a b c
3 4 6
3 4 6
insert into t1 values(8, 2, 3);
insert into t1 values(8, 2, 3);
ERROR 23000: Duplicate entry '
8' for key 1
ERROR 23000: Duplicate entry '
' for key 0
select * from t1 order by a;
select * from t1 order by a;
a b c
a b c
1 2 3
1 2 3
...
@@ -89,7 +89,7 @@ a b c
...
@@ -89,7 +89,7 @@ a b c
1 1 1
1 1 1
4 4 NULL
4 4 NULL
insert into t1 values(5,1,1);
insert into t1 values(5,1,1);
ERROR 23000: Duplicate entry '
5' for key 1
ERROR 23000: Duplicate entry '
' for key 0
drop table t1;
drop table t1;
CREATE TABLE t2 (
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
a int unsigned NOT NULL PRIMARY KEY,
...
@@ -112,7 +112,7 @@ select * from t2 where b = 4 order by a;
...
@@ -112,7 +112,7 @@ select * from t2 where b = 4 order by a;
a b c
a b c
3 4 6
3 4 6
insert into t2 values(8, 2, 3);
insert into t2 values(8, 2, 3);
ERROR 23000: Duplicate entry '
8' for key 1
ERROR 23000: Duplicate entry '
' for key 0
select * from t2 order by a;
select * from t2 order by a;
a b c
a b c
1 2 3
1 2 3
...
@@ -177,7 +177,7 @@ pk a
...
@@ -177,7 +177,7 @@ pk a
3 NULL
3 NULL
4 4
4 4
insert into t1 values (5,0);
insert into t1 values (5,0);
ERROR 23000: Duplicate entry '
5' for key 1
ERROR 23000: Duplicate entry '
' for key 0
select * from t1 order by pk;
select * from t1 order by pk;
pk a
pk a
-1 NULL
-1 NULL
...
@@ -210,7 +210,7 @@ pk a b c
...
@@ -210,7 +210,7 @@ pk a b c
0 NULL 18 NULL
0 NULL 18 NULL
1 3 19 abc
1 3 19 abc
insert into t2 values(2,3,19,'abc');
insert into t2 values(2,3,19,'abc');
ERROR 23000: Duplicate entry '
2' for key 1
ERROR 23000: Duplicate entry '
' for key 0
select * from t2 order by pk;
select * from t2 order by pk;
pk a b c
pk a b c
-1 1 17 NULL
-1 1 17 NULL
...
@@ -630,7 +630,7 @@ create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
...
@@ -630,7 +630,7 @@ create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
engine=ndb charset=utf8;
engine=ndb charset=utf8;
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
ERROR 23000: Duplicate entry '
2' for key 1
ERROR 23000: Duplicate entry '
' for key 0
select a, sha1(b) from t1;
select a, sha1(b) from t1;
a sha1(b)
a sha1(b)
1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d
1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d
...
...
mysql-test/r/ndb_multi.result
View file @
0522b110
...
@@ -69,3 +69,35 @@ t3
...
@@ -69,3 +69,35 @@ t3
t4
t4
drop table t1, t2, t3, t4;
drop table t1, t2, t3, t4;
drop table t1, t3, t4;
drop table t1, t3, t4;
create table t1(c1 int key)ENGINE=MyISAM;
insert into t1 values(1),(3),(5);
select * from t1 order by c1;
c1
1
3
5
create table t1(c1 int key)ENGINE=MyISAM;
insert into t1 values(100),(344),(533);
select * from t1 order by c1;
c1
100
344
533
alter table t1 engine=ndb;
show tables;
Tables_in_test
t1
Warnings:
Warning 1050 Local table test.t1 shadows ndb table
select * from t1 order by c1;
c1
100
344
533
drop table t1;
select * from t1 order by c1;
c1
1
3
5
drop table t1;
mysql-test/r/ndb_update.result
View file @
0522b110
...
@@ -18,7 +18,7 @@ pk1 b c
...
@@ -18,7 +18,7 @@ pk1 b c
2 2 2
2 2 2
4 1 1
4 1 1
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
ERROR 23000: Duplicate entry '
1' for key 1
ERROR 23000: Duplicate entry '
' for key 0
select * from t1 order by pk1;
select * from t1 order by pk1;
pk1 b c
pk1 b c
0 0 0
0 0 0
...
...
mysql-test/t/ndb_condition_pushdown.test
View file @
0522b110
...
@@ -1649,6 +1649,16 @@ set engine_condition_pushdown = on;
...
@@ -1649,6 +1649,16 @@ set engine_condition_pushdown = on;
explain
select
*
from
t5
where
b
like
'%jo%'
;
explain
select
*
from
t5
where
b
like
'%jo%'
;
select
*
from
t5
where
b
like
'%jo%'
order
by
a
;
select
*
from
t5
where
b
like
'%jo%'
order
by
a
;
# bug#21056 ndb pushdown equal/setValue error on datetime
set
engine_condition_pushdown
=
off
;
select
auto
from
t1
where
date_time
like
'1902-02-02 %'
order
by
auto
;
select
auto
from
t1
where
date_time
not
like
'1902-02-02 %'
order
by
auto
;
set
engine_condition_pushdown
=
on
;
explain
select
auto
from
t1
where
date_time
like
'1902-02-02 %'
;
select
auto
from
t1
where
date_time
like
'1902-02-02 %'
order
by
auto
;
explain
select
auto
from
t1
where
date_time
not
like
'1902-02-02 %'
;
select
auto
from
t1
where
date_time
not
like
'1902-02-02 %'
order
by
auto
;
# bug#17421 -1
# bug#17421 -1
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
a
int
,
b
varchar
(
3
),
primary
key
using
hash
(
a
))
create
table
t1
(
a
int
,
b
varchar
(
3
),
primary
key
using
hash
(
a
))
...
...
mysql-test/t/ndb_multi.test
View file @
0522b110
...
@@ -69,4 +69,26 @@ drop table t1, t2, t3, t4;
...
@@ -69,4 +69,26 @@ drop table t1, t2, t3, t4;
connection
server2
;
connection
server2
;
drop
table
t1
,
t3
,
t4
;
drop
table
t1
,
t3
,
t4
;
# bug#21378
connection
server1
;
create
table
t1
(
c1
int
key
)
ENGINE
=
MyISAM
;
insert
into
t1
values
(
1
),(
3
),(
5
);
select
*
from
t1
order
by
c1
;
connection
server2
;
create
table
t1
(
c1
int
key
)
ENGINE
=
MyISAM
;
insert
into
t1
values
(
100
),(
344
),(
533
);
select
*
from
t1
order
by
c1
;
connection
server1
;
alter
table
t1
engine
=
ndb
;
connection
server2
;
show
tables
;
select
*
from
t1
order
by
c1
;
drop
table
t1
;
connection
server1
;
select
*
from
t1
order
by
c1
;
drop
table
t1
;
# End of 4.1 tests
# End of 4.1 tests
sql/ha_ndbcluster.cc
View file @
0522b110
...
@@ -553,7 +553,14 @@ int ha_ndbcluster::ndb_err(NdbTransaction *trans)
...
@@ -553,7 +553,14 @@ int ha_ndbcluster::ndb_err(NdbTransaction *trans)
if
(
res
==
HA_ERR_FOUND_DUPP_KEY
)
if
(
res
==
HA_ERR_FOUND_DUPP_KEY
)
{
{
if
(
m_rows_to_insert
==
1
)
if
(
m_rows_to_insert
==
1
)
m_dupkey
=
table
->
s
->
primary_key
;
{
/*
We can only distinguish between primary and non-primary
violations here, so we need to return MAX_KEY for non-primary
to signal that key is unknown
*/
m_dupkey
=
err
.
code
==
630
?
table
->
s
->
primary_key
:
MAX_KEY
;
}
else
else
{
{
/* We are batching inserts, offending key is not available */
/* We are batching inserts, offending key is not available */
...
@@ -5079,16 +5086,15 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path,
...
@@ -5079,16 +5086,15 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path,
List
<
char
>
delete_list
;
List
<
char
>
delete_list
;
while
((
file_name
=
it
++
))
while
((
file_name
=
it
++
))
{
{
bool
file_on_disk
=
false
;
DBUG_PRINT
(
"info"
,
(
"%s"
,
file_name
));
DBUG_PRINT
(
"info"
,
(
"%s"
,
file_name
));
if
(
hash_search
(
&
ndb_tables
,
file_name
,
strlen
(
file_name
)))
if
(
hash_search
(
&
ndb_tables
,
file_name
,
strlen
(
file_name
)))
{
{
DBUG_PRINT
(
"info"
,
(
"%s existed in NDB _and_ on disk "
,
file_name
));
DBUG_PRINT
(
"info"
,
(
"%s existed in NDB _and_ on disk "
,
file_name
));
// File existed in NDB and as frm file, put in ok_tables list
file_on_disk
=
true
;
my_hash_insert
(
&
ok_tables
,
(
byte
*
)
file_name
);
continue
;
}
}
//
File is not in NDB, c
heck for .ndb file with this name
//
C
heck for .ndb file with this name
(
void
)
strxnmov
(
name
,
FN_REFLEN
,
(
void
)
strxnmov
(
name
,
FN_REFLEN
,
mysql_data_home
,
"/"
,
db
,
"/"
,
file_name
,
ha_ndb_ext
,
NullS
);
mysql_data_home
,
"/"
,
db
,
"/"
,
file_name
,
ha_ndb_ext
,
NullS
);
DBUG_PRINT
(
"info"
,
(
"Check access for %s"
,
name
));
DBUG_PRINT
(
"info"
,
(
"Check access for %s"
,
name
));
...
@@ -5096,9 +5102,25 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path,
...
@@ -5096,9 +5102,25 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path,
{
{
DBUG_PRINT
(
"info"
,
(
"%s did not exist on disk"
,
name
));
DBUG_PRINT
(
"info"
,
(
"%s did not exist on disk"
,
name
));
// .ndb file did not exist on disk, another table type
// .ndb file did not exist on disk, another table type
if
(
file_on_disk
)
{
// Ignore this ndb table
gptr
record
=
hash_search
(
&
ndb_tables
,
file_name
,
strlen
(
file_name
));
DBUG_ASSERT
(
record
);
hash_delete
(
&
ndb_tables
,
record
);
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_TABLE_EXISTS_ERROR
,
"Local table %s.%s shadows ndb table"
,
db
,
file_name
);
}
continue
;
}
if
(
file_on_disk
)
{
// File existed in NDB and as frm file, put in ok_tables list
my_hash_insert
(
&
ok_tables
,
(
byte
*
)
file_name
);
continue
;
continue
;
}
}
DBUG_PRINT
(
"info"
,
(
"%s existed on disk"
,
name
));
DBUG_PRINT
(
"info"
,
(
"%s existed on disk"
,
name
));
// The .ndb file exists on disk, but it's not in list of tables in ndb
// The .ndb file exists on disk, but it's not in list of tables in ndb
// Verify that handler agrees table is gone.
// Verify that handler agrees table is gone.
...
@@ -6903,11 +6925,13 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -6903,11 +6925,13 @@ void ndb_serialize_cond(const Item *item, void *arg)
DBUG_PRINT
(
"info"
,
(
"FIELD_ITEM"
));
DBUG_PRINT
(
"info"
,
(
"FIELD_ITEM"
));
DBUG_PRINT
(
"info"
,
(
"table %s"
,
tab
->
getName
()));
DBUG_PRINT
(
"info"
,
(
"table %s"
,
tab
->
getName
()));
DBUG_PRINT
(
"info"
,
(
"column %s"
,
field
->
field_name
));
DBUG_PRINT
(
"info"
,
(
"column %s"
,
field
->
field_name
));
DBUG_PRINT
(
"info"
,
(
"type %d"
,
field
->
type
()));
DBUG_PRINT
(
"info"
,
(
"result type %d"
,
field
->
result_type
()));
DBUG_PRINT
(
"info"
,
(
"result type %d"
,
field
->
result_type
()));
// Check that we are expecting a field and with the correct
// Check that we are expecting a field and with the correct
// result type
// result type
if
(
context
->
expecting
(
Item
::
FIELD_ITEM
)
&&
if
(
context
->
expecting
(
Item
::
FIELD_ITEM
)
&&
context
->
expecting_field_type
(
field
->
type
())
&&
(
context
->
expecting_field_result
(
field
->
result_type
())
||
(
context
->
expecting_field_result
(
field
->
result_type
())
||
// Date and year can be written as string or int
// Date and year can be written as string or int
((
type
==
MYSQL_TYPE_TIME
||
((
type
==
MYSQL_TYPE_TIME
||
...
@@ -6930,7 +6954,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -6930,7 +6954,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
curr_cond
->
ndb_item
=
new
Ndb_item
(
field
,
col
->
getColumnNo
());
curr_cond
->
ndb_item
=
new
Ndb_item
(
field
,
col
->
getColumnNo
());
context
->
dont_expect
(
Item
::
FIELD_ITEM
);
context
->
dont_expect
(
Item
::
FIELD_ITEM
);
context
->
expect_no_field_result
();
context
->
expect_no_field_result
();
if
(
context
->
expect_mask
)
if
(
!
context
->
expecting_nothing
()
)
{
{
// We have not seen second argument yet
// We have not seen second argument yet
if
(
type
==
MYSQL_TYPE_TIME
||
if
(
type
==
MYSQL_TYPE_TIME
||
...
@@ -7127,6 +7151,9 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7127,6 +7151,9 @@ void ndb_serialize_cond(const Item *item, void *arg)
func_item
);
func_item
);
context
->
expect
(
Item
::
STRING_ITEM
);
context
->
expect
(
Item
::
STRING_ITEM
);
context
->
expect
(
Item
::
FIELD_ITEM
);
context
->
expect
(
Item
::
FIELD_ITEM
);
context
->
expect_only_field_type
(
MYSQL_TYPE_STRING
);
context
->
expect_field_type
(
MYSQL_TYPE_VAR_STRING
);
context
->
expect_field_type
(
MYSQL_TYPE_VARCHAR
);
context
->
expect_field_result
(
STRING_RESULT
);
context
->
expect_field_result
(
STRING_RESULT
);
context
->
expect
(
Item
::
FUNC_ITEM
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
break
;
...
@@ -7232,7 +7259,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7232,7 +7259,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
NDB_ITEM_QUALIFICATION
q
;
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
STRING_ITEM
;
q
.
value_type
=
Item
::
STRING_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
if
(
context
->
expect_field_result_mask
)
if
(
!
context
->
expecting_no_field_result
()
)
{
{
// We have not seen the field argument yet
// We have not seen the field argument yet
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
...
@@ -7262,7 +7289,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7262,7 +7289,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
NDB_ITEM_QUALIFICATION
q
;
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
REAL_ITEM
;
q
.
value_type
=
Item
::
REAL_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
if
(
context
->
expect_field_result_mask
)
if
(
!
context
->
expecting_no_field_result
()
)
{
{
// We have not seen the field argument yet
// We have not seen the field argument yet
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
...
@@ -7285,7 +7312,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7285,7 +7312,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
NDB_ITEM_QUALIFICATION
q
;
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
INT_ITEM
;
q
.
value_type
=
Item
::
INT_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
if
(
context
->
expect_field_result_mask
)
if
(
!
context
->
expecting_no_field_result
()
)
{
{
// We have not seen the field argument yet
// We have not seen the field argument yet
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
...
@@ -7308,7 +7335,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7308,7 +7335,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
NDB_ITEM_QUALIFICATION
q
;
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
DECIMAL_ITEM
;
q
.
value_type
=
Item
::
DECIMAL_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
if
(
context
->
expect_field_result_mask
)
if
(
!
context
->
expecting_no_field_result
()
)
{
{
// We have not seen the field argument yet
// We have not seen the field argument yet
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
...
@@ -7358,7 +7385,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7358,7 +7385,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
NDB_ITEM_QUALIFICATION
q
;
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
STRING_ITEM
;
q
.
value_type
=
Item
::
STRING_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
if
(
context
->
expect_field_result_mask
)
if
(
!
context
->
expecting_no_field_result
()
)
{
{
// We have not seen the field argument yet
// We have not seen the field argument yet
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
...
@@ -7391,7 +7418,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7391,7 +7418,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
NDB_ITEM_QUALIFICATION
q
;
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
INT_ITEM
;
q
.
value_type
=
Item
::
INT_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
if
(
context
->
expect_field_result_mask
)
if
(
!
context
->
expecting_no_field_result
()
)
{
{
// We have not seen the field argument yet
// We have not seen the field argument yet
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
...
@@ -7418,7 +7445,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7418,7 +7445,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
NDB_ITEM_QUALIFICATION
q
;
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
REAL_ITEM
;
q
.
value_type
=
Item
::
REAL_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
if
(
context
->
expect_field_result_mask
)
if
(
!
context
->
expecting_no_field_result
()
)
{
{
// We have not seen the field argument yet
// We have not seen the field argument yet
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
...
@@ -7441,7 +7468,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7441,7 +7468,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
NDB_ITEM_QUALIFICATION
q
;
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
VARBIN_ITEM
;
q
.
value_type
=
Item
::
VARBIN_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
if
(
context
->
expect_field_result_mask
)
if
(
!
context
->
expecting_no_field_result
()
)
{
{
// We have not seen the field argument yet
// We have not seen the field argument yet
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
...
@@ -7466,7 +7493,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
...
@@ -7466,7 +7493,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
NDB_ITEM_QUALIFICATION
q
;
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
DECIMAL_ITEM
;
q
.
value_type
=
Item
::
DECIMAL_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
if
(
context
->
expect_field_result_mask
)
if
(
!
context
->
expecting_no_field_result
()
)
{
{
// We have not seen the field argument yet
// We have not seen the field argument yet
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
...
...
sql/ha_ndbcluster.h
View file @
0522b110
...
@@ -362,53 +362,95 @@ class Ndb_cond_traverse_context
...
@@ -362,53 +362,95 @@ class Ndb_cond_traverse_context
Ndb_cond_traverse_context
(
TABLE
*
tab
,
void
*
ndb_tab
,
Ndb_cond_stack
*
stack
)
Ndb_cond_traverse_context
(
TABLE
*
tab
,
void
*
ndb_tab
,
Ndb_cond_stack
*
stack
)
:
table
(
tab
),
ndb_table
(
ndb_tab
),
:
table
(
tab
),
ndb_table
(
ndb_tab
),
supported
(
TRUE
),
stack_ptr
(
stack
),
cond_ptr
(
NULL
),
supported
(
TRUE
),
stack_ptr
(
stack
),
cond_ptr
(
NULL
),
expect_mask
(
0
),
expect_field_result_mask
(
0
),
skip
(
0
),
collation
(
NULL
),
skip
(
0
),
collation
(
NULL
),
rewrite_stack
(
NULL
)
rewrite_stack
(
NULL
)
{
{
// Allocate type checking bitmaps
bitmap_init
(
&
expect_mask
,
0
,
512
,
FALSE
);
bitmap_init
(
&
expect_field_type_mask
,
0
,
512
,
FALSE
);
bitmap_init
(
&
expect_field_result_mask
,
0
,
512
,
FALSE
);
if
(
stack
)
if
(
stack
)
cond_ptr
=
stack
->
ndb_cond
;
cond_ptr
=
stack
->
ndb_cond
;
};
};
~
Ndb_cond_traverse_context
()
~
Ndb_cond_traverse_context
()
{
{
bitmap_free
(
&
expect_mask
);
bitmap_free
(
&
expect_field_type_mask
);
bitmap_free
(
&
expect_field_result_mask
);
if
(
rewrite_stack
)
delete
rewrite_stack
;
if
(
rewrite_stack
)
delete
rewrite_stack
;
}
}
void
expect
(
Item
::
Type
type
)
void
expect
(
Item
::
Type
type
)
{
{
expect_mask
|=
(
1
<<
type
);
bitmap_set_bit
(
&
expect_mask
,
(
uint
)
type
);
if
(
type
==
Item
::
FIELD_ITEM
)
expect_all_field_types
();
};
};
void
dont_expect
(
Item
::
Type
type
)
void
dont_expect
(
Item
::
Type
type
)
{
{
expect_mask
&=
~
(
1
<<
type
);
bitmap_clear_bit
(
&
expect_mask
,
(
uint
)
type
);
};
};
bool
expecting
(
Item
::
Type
type
)
bool
expecting
(
Item
::
Type
type
)
{
{
return
(
expect_mask
&
(
1
<<
type
)
);
return
bitmap_is_set
(
&
expect_mask
,
(
uint
)
type
);
};
};
void
expect_nothing
()
void
expect_nothing
()
{
{
expect_mask
=
0
;
bitmap_clear_all
(
&
expect_mask
)
;
};
};
bool
expecting_nothing
()
{
return
bitmap_is_clear_all
(
&
expect_mask
);
}
void
expect_only
(
Item
::
Type
type
)
void
expect_only
(
Item
::
Type
type
)
{
{
expect_
mask
=
0
;
expect_
nothing
()
;
expect
(
type
);
expect
(
type
);
};
};
void
expect_field_type
(
enum_field_types
type
)
{
bitmap_set_bit
(
&
expect_field_type_mask
,
(
uint
)
type
);
};
void
expect_all_field_types
()
{
bitmap_set_all
(
&
expect_field_type_mask
);
};
bool
expecting_field_type
(
enum_field_types
type
)
{
return
bitmap_is_set
(
&
expect_field_type_mask
,
(
uint
)
type
);
};
void
expect_no_field_type
()
{
bitmap_clear_all
(
&
expect_field_type_mask
);
};
bool
expecting_no_field_type
()
{
return
bitmap_is_clear_all
(
&
expect_field_type_mask
);
}
void
expect_only_field_type
(
enum_field_types
result
)
{
expect_no_field_type
();
expect_field_type
(
result
);
};
void
expect_field_result
(
Item_result
result
)
void
expect_field_result
(
Item_result
result
)
{
{
expect_field_result_mask
|=
(
1
<<
result
);
bitmap_set_bit
(
&
expect_field_result_mask
,
(
uint
)
result
);
};
};
bool
expecting_field_result
(
Item_result
result
)
bool
expecting_field_result
(
Item_result
result
)
{
{
return
(
expect_field_result_mask
&
(
1
<<
result
)
);
return
bitmap_is_set
(
&
expect_field_result_mask
,
(
uint
)
result
);
};
};
void
expect_no_field_result
()
void
expect_no_field_result
()
{
{
expect_field_result_mask
=
0
;
bitmap_clear_all
(
&
expect_field_result_mask
)
;
};
};
bool
expecting_no_field_result
()
{
return
bitmap_is_clear_all
(
&
expect_field_result_mask
);
}
void
expect_only_field_result
(
Item_result
result
)
void
expect_only_field_result
(
Item_result
result
)
{
{
expect_
field_result_mask
=
0
;
expect_
no_field_result
()
;
expect_field_result
(
result
);
expect_field_result
(
result
);
};
};
void
expect_collation
(
CHARSET_INFO
*
col
)
void
expect_collation
(
CHARSET_INFO
*
col
)
...
@@ -428,8 +470,9 @@ class Ndb_cond_traverse_context
...
@@ -428,8 +470,9 @@ class Ndb_cond_traverse_context
bool
supported
;
bool
supported
;
Ndb_cond_stack
*
stack_ptr
;
Ndb_cond_stack
*
stack_ptr
;
Ndb_cond
*
cond_ptr
;
Ndb_cond
*
cond_ptr
;
uint
expect_mask
;
MY_BITMAP
expect_mask
;
uint
expect_field_result_mask
;
MY_BITMAP
expect_field_type_mask
;
MY_BITMAP
expect_field_result_mask
;
uint
skip
;
uint
skip
;
CHARSET_INFO
*
collation
;
CHARSET_INFO
*
collation
;
Ndb_rewrite_context
*
rewrite_stack
;
Ndb_rewrite_context
*
rewrite_stack
;
...
...
sql/handler.cc
View file @
0522b110
...
@@ -1774,12 +1774,22 @@ void handler::print_error(int error, myf errflag)
...
@@ -1774,12 +1774,22 @@ void handler::print_error(int error, myf errflag)
/* Write the dupplicated key in the error message */
/* Write the dupplicated key in the error message */
char
key
[
MAX_KEY_LENGTH
];
char
key
[
MAX_KEY_LENGTH
];
String
str
(
key
,
sizeof
(
key
),
system_charset_info
);
String
str
(
key
,
sizeof
(
key
),
system_charset_info
);
key_unpack
(
&
str
,
table
,(
uint
)
key_nr
);
uint
max_length
=
MYSQL_ERRMSG_SIZE
-
(
uint
)
strlen
(
ER
(
ER_DUP_ENTRY
));
if
(
key_nr
==
MAX_KEY
)
if
(
str
.
length
()
>=
max_length
)
{
/* Key is unknown */
str
.
length
(
0
);
key_nr
=
-
1
;
}
else
{
{
str
.
length
(
max_length
-
4
);
key_unpack
(
&
str
,
table
,(
uint
)
key_nr
);
str
.
append
(
STRING_WITH_LEN
(
"..."
));
uint
max_length
=
MYSQL_ERRMSG_SIZE
-
(
uint
)
strlen
(
ER
(
ER_DUP_ENTRY
));
if
(
str
.
length
()
>=
max_length
)
{
str
.
length
(
max_length
-
4
);
str
.
append
(
STRING_WITH_LEN
(
"..."
));
}
}
}
my_error
(
ER_DUP_ENTRY
,
MYF
(
0
),
str
.
c_ptr
(),
key_nr
+
1
);
my_error
(
ER_DUP_ENTRY
,
MYF
(
0
),
str
.
c_ptr
(),
key_nr
+
1
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
...
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