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
8ae6219c
Commit
8ae6219c
authored
Oct 20, 2004
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix so that ndb handler can cope with char(0), mapped to char(1) for now
parent
a1bd5432
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
2 deletions
+54
-2
mysql-test/r/ndb_basic.result
mysql-test/r/ndb_basic.result
+19
-0
mysql-test/t/ndb_basic.test
mysql-test/t/ndb_basic.test
+13
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+22
-2
No files found.
mysql-test/r/ndb_basic.result
View file @
8ae6219c
...
@@ -395,3 +395,22 @@ b attr1
...
@@ -395,3 +395,22 @@ b attr1
9413 9412
9413 9412
drop table test.t1, t2;
drop table test.t1, t2;
drop database mysqltest;
drop database mysqltest;
use test;
create table t1 (a int primary key, b char(0));
insert into t1 values (1,"");
insert into t1 values (2,NULL);
select * from t1 order by a;
a b
1
2 NULL
select * from t1 order by b;
a b
2 NULL
1
select * from t1 where b IS NULL;
a b
2 NULL
select * from t1 where b IS NOT NULL;
a b
1
drop table t1;
mysql-test/t/ndb_basic.test
View file @
8ae6219c
...
@@ -358,3 +358,16 @@ select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
...
@@ -358,3 +358,16 @@ select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
drop
table
test
.
t1
,
t2
;
drop
table
test
.
t1
,
t2
;
drop
database
mysqltest
;
drop
database
mysqltest
;
#
# test support of char(0)
#
use
test
;
create
table
t1
(
a
int
primary
key
,
b
char
(
0
));
insert
into
t1
values
(
1
,
""
);
insert
into
t1
values
(
2
,
NULL
);
select
*
from
t1
order
by
a
;
select
*
from
t1
order
by
b
;
select
*
from
t1
where
b
IS
NULL
;
select
*
from
t1
where
b
IS
NOT
NULL
;
drop
table
t1
;
sql/ha_ndbcluster.cc
View file @
8ae6219c
...
@@ -89,6 +89,12 @@ static int ndb_get_table_statistics(Ndb*, const char *,
...
@@ -89,6 +89,12 @@ static int ndb_get_table_statistics(Ndb*, const char *,
Uint64
*
rows
,
Uint64
*
commits
);
Uint64
*
rows
,
Uint64
*
commits
);
/*
Dummy buffer to read zero pack_length fields
which are mapped to 1 char
*/
static
byte
dummy_buf
[
1
];
/*
/*
Error handling functions
Error handling functions
*/
*/
...
@@ -443,6 +449,13 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
...
@@ -443,6 +449,13 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
if
(
ndb_supported_type
(
field
->
type
()))
if
(
ndb_supported_type
(
field
->
type
()))
{
{
// ndb currently does not support size 0
const
byte
*
empty_field
=
""
;
if
(
pack_len
==
0
)
{
pack_len
=
1
;
field_ptr
=
empty_field
;
}
if
(
!
(
field
->
flags
&
BLOB_FLAG
))
if
(
!
(
field
->
flags
&
BLOB_FLAG
))
{
{
if
(
field
->
is_null
())
if
(
field
->
is_null
())
...
@@ -586,7 +599,11 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
...
@@ -586,7 +599,11 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
DBUG_ASSERT
(
field
->
ptr
!=
NULL
);
DBUG_ASSERT
(
field
->
ptr
!=
NULL
);
if
(
!
(
field
->
flags
&
BLOB_FLAG
))
if
(
!
(
field
->
flags
&
BLOB_FLAG
))
{
{
byte
*
field_buf
=
buf
+
(
field
->
ptr
-
table
->
record
[
0
]);
byte
*
field_buf
;
if
(
field
->
pack_length
()
!=
0
)
field_buf
=
buf
+
(
field
->
ptr
-
table
->
record
[
0
]);
else
field_buf
=
dummy_buf
;
m_value
[
fieldnr
].
rec
=
ndb_op
->
getValue
(
fieldnr
,
m_value
[
fieldnr
].
rec
=
ndb_op
->
getValue
(
fieldnr
,
field_buf
);
field_buf
);
DBUG_RETURN
(
m_value
[
fieldnr
].
rec
==
NULL
);
DBUG_RETURN
(
m_value
[
fieldnr
].
rec
==
NULL
);
...
@@ -3164,6 +3181,9 @@ static int create_ndb_column(NDBCOL &col,
...
@@ -3164,6 +3181,9 @@ static int create_ndb_column(NDBCOL &col,
col
.
setType
(
NDBCOL
::
Char
);
col
.
setType
(
NDBCOL
::
Char
);
col
.
setCharset
(
cs
);
col
.
setCharset
(
cs
);
}
}
if
(
field
->
pack_length
()
==
0
)
col
.
setLength
(
1
);
// currently ndb does not support size 0
else
col
.
setLength
(
field
->
pack_length
());
col
.
setLength
(
field
->
pack_length
());
break
;
break
;
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_VAR_STRING
:
...
...
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