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
323a8ddc
Commit
323a8ddc
authored
Feb 11, 2010
by
Martin Hansson
Browse files
Options
Browse Files
Download
Plain Diff
Merge of Bug#49534
parents
630fa243
8e07b583
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
30 deletions
+82
-30
mysql-test/extra/rpl_tests/rpl_loaddata.test
mysql-test/extra/rpl_tests/rpl_loaddata.test
+13
-0
mysql-test/r/join.result
mysql-test/r/join.result
+17
-0
mysql-test/t/join.test
mysql-test/t/join.test
+12
-0
sql/field.cc
sql/field.cc
+5
-6
sql/sql_select.cc
sql/sql_select.cc
+29
-22
sql/sql_select.h
sql/sql_select.h
+6
-2
No files found.
mysql-test/extra/rpl_tests/rpl_loaddata.test
View file @
323a8ddc
...
...
@@ -219,6 +219,19 @@ connect (conn2,localhost,root,,*NO-ONE*);
--
echo
### assertion: works without stating the default database
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
$UPPER_STMT_HEAD
LOCAL
INFILE
'$MYSQLTEST_VARDIR/std_data/loaddata5.dat'
INTO
TABLE
$db1
.
t1
# We cannot disconnect right away because when inserting
# concurrently in a MyISAM table, the server is sending an OK
# to the client before updating the table state (where the
# number of records is kept). See: BUG#37521 and BUG#29334.
# So we need to wait, otherwise we would be having sporadic
# failures as reported here: BUG#50451.
# 12 = 3 rows per each LOAD DATA executed x 4
--
let
$count
=
12
--
let
$table
=
$db1
.
t1
--
source
include
/
wait_until_rows_count
.
inc
--
echo
### disconnect and switch back to master connection
--
disconnect
conn2
--
connection
master
...
...
mysql-test/r/join.result
View file @
323a8ddc
...
...
@@ -1128,3 +1128,20 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP VIEW v1;
DROP TABLE t1, t2;
CREATE TABLE t1(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
CREATE TABLE t2(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('1',null),(null,null);
INSERT INTO t2 VALUES ('1',null),(null,null);
CREATE TABLE mm1(a CHAR(9),b INT,KEY(b),KEY(a))
ENGINE=MERGE UNION=(t1,t2);
SELECT t1.a FROM mm1,t1;
a
NULL
1
NULL
1
NULL
1
NULL
1
DROP TABLE t1, t2, mm1;
mysql-test/t/join.test
View file @
323a8ddc
...
...
@@ -804,3 +804,15 @@ DEALLOCATE PREPARE stmt;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
#
# Bug#45195 valgrind warnings about uninitialized values in store_record_in_cache()
#
CREATE
TABLE
t1
(
a
CHAR
(
9
),
b
INT
,
KEY
(
b
),
KEY
(
a
))
ENGINE
=
MYISAM
;
CREATE
TABLE
t2
(
a
CHAR
(
9
),
b
INT
,
KEY
(
b
),
KEY
(
a
))
ENGINE
=
MYISAM
;
INSERT
INTO
t1
VALUES
(
'1'
,
null
),(
null
,
null
);
INSERT
INTO
t2
VALUES
(
'1'
,
null
),(
null
,
null
);
CREATE
TABLE
mm1
(
a
CHAR
(
9
),
b
INT
,
KEY
(
b
),
KEY
(
a
))
ENGINE
=
MERGE
UNION
=
(
t1
,
t2
);
SELECT
t1
.
a
FROM
mm1
,
t1
;
DROP
TABLE
t1
,
t2
,
mm1
;
sql/field.cc
View file @
323a8ddc
...
...
@@ -1705,11 +1705,10 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
uint
store_length
;
copy
->
str
=
ptr
;
copy
->
length
=
pack_length
();
copy
->
blob_field
=
0
;
copy
->
field
=
this
;
if
(
flags
&
BLOB_FLAG
)
{
copy
->
blob_field
=
(
Field_blob
*
)
this
;
copy
->
strip
=
0
;
copy
->
type
=
CACHE_BLOB
;
copy
->
length
-=
table
->
s
->
blob_ptr_size
;
return
copy
->
length
;
}
...
...
@@ -1717,15 +1716,15 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
(
type
()
==
MYSQL_TYPE_STRING
&&
copy
->
length
>=
4
&&
copy
->
length
<
256
))
{
copy
->
strip
=
1
;
/* Remove end space */
copy
->
type
=
CACHE_STRIPPED
;
store_length
=
2
;
}
else
{
copy
->
strip
=
0
;
copy
->
type
=
0
;
store_length
=
0
;
}
return
copy
->
length
+
store_length
;
return
copy
->
length
+
store_length
;
}
...
...
sql/sql_select.cc
View file @
323a8ddc
...
...
@@ -14149,7 +14149,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
{
used_fields
--
;
length
+=
field
->
fill_cache_field
(
copy
);
if
(
copy
->
blob_field
)
if
(
copy
->
type
==
CACHE_BLOB
)
(
*
blob_ptr
++
)
=
copy
;
if
(
field
->
real_maybe_null
())
null_fields
++
;
...
...
@@ -14164,8 +14164,8 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
{
/* must copy null bits */
copy
->
str
=
tables
[
i
].
table
->
null_flags
;
copy
->
length
=
tables
[
i
].
table
->
s
->
null_bytes
;
copy
->
strip
=
0
;
copy
->
blob_
field
=
0
;
copy
->
type
=
0
;
copy
->
field
=
0
;
length
+=
copy
->
length
;
copy
++
;
cache
->
fields
++
;
...
...
@@ -14175,8 +14175,8 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
{
copy
->
str
=
(
uchar
*
)
&
tables
[
i
].
table
->
null_row
;
copy
->
length
=
sizeof
(
tables
[
i
].
table
->
null_row
);
copy
->
strip
=
0
;
copy
->
blob_
field
=
0
;
copy
->
type
=
0
;
copy
->
field
=
0
;
length
+=
copy
->
length
;
copy
++
;
cache
->
fields
++
;
...
...
@@ -14201,9 +14201,10 @@ used_blob_length(CACHE_FIELD **ptr)
uint
length
,
blob_length
;
for
(
length
=
0
;
*
ptr
;
ptr
++
)
{
(
*
ptr
)
->
blob_length
=
blob_length
=
(
*
ptr
)
->
blob_field
->
get_length
();
Field_blob
*
field_blob
=
(
Field_blob
*
)
(
*
ptr
)
->
field
;
(
*
ptr
)
->
blob_length
=
blob_length
=
field_blob
->
get_length
();
length
+=
blob_length
;
(
*
ptr
)
->
blob_field
->
get_ptr
(
&
(
*
ptr
)
->
str
);
field_blob
->
get_ptr
(
&
(
*
ptr
)
->
str
);
}
return
length
;
}
...
...
@@ -14232,30 +14233,35 @@ store_record_in_cache(JOIN_CACHE *cache)
cache
->
records
++
;
for
(
copy
=
cache
->
field
;
copy
<
end_field
;
copy
++
)
{
if
(
copy
->
blob_field
)
if
(
copy
->
type
==
CACHE_BLOB
)
{
Field_blob
*
blob_field
=
(
Field_blob
*
)
copy
->
field
;
if
(
last_record
)
{
copy
->
blob_field
->
get_image
(
pos
,
copy
->
length
+
sizeof
(
char
*
),
copy
->
blob_field
->
charset
());
blob_field
->
get_image
(
pos
,
copy
->
length
+
sizeof
(
char
*
),
blob_field
->
charset
());
pos
+=
copy
->
length
+
sizeof
(
char
*
);
}
else
{
copy
->
blob_field
->
get_image
(
pos
,
copy
->
length
,
// blob length
copy
->
blob_field
->
charset
());
blob_field
->
get_image
(
pos
,
copy
->
length
,
// blob length
blob_field
->
charset
());
memcpy
(
pos
+
copy
->
length
,
copy
->
str
,
copy
->
blob_length
);
// Blob data
pos
+=
copy
->
length
+
copy
->
blob_length
;
}
}
else
{
if
(
copy
->
strip
)
if
(
copy
->
type
==
CACHE_STRIPPED
)
{
uchar
*
str
,
*
end
;
for
(
str
=
copy
->
str
,
end
=
str
+
copy
->
length
;
end
>
str
&&
end
[
-
1
]
==
' '
;
end
--
)
;
Field
*
field
=
copy
->
field
;
if
(
field
&&
field
->
maybe_null
()
&&
field
->
is_null
())
end
=
str
=
copy
->
str
;
else
for
(
str
=
copy
->
str
,
end
=
str
+
copy
->
length
;
end
>
str
&&
end
[
-
1
]
==
' '
;
end
--
)
;
length
=
(
uint
)
(
end
-
str
);
memcpy
(
pos
+
2
,
str
,
length
);
int2store
(
pos
,
length
);
...
...
@@ -14304,23 +14310,24 @@ read_cached_record(JOIN_TAB *tab)
copy
<
end_field
;
copy
++
)
{
if
(
copy
->
blob_field
)
if
(
copy
->
type
==
CACHE_BLOB
)
{
Field_blob
*
blob_field
=
(
Field_blob
*
)
copy
->
field
;
if
(
last_record
)
{
copy
->
blob_field
->
set_image
(
pos
,
copy
->
length
+
sizeof
(
char
*
),
copy
->
blob_field
->
charset
());
blob_field
->
set_image
(
pos
,
copy
->
length
+
sizeof
(
char
*
),
blob_field
->
charset
());
pos
+=
copy
->
length
+
sizeof
(
char
*
);
}
else
{
copy
->
blob_field
->
set_ptr
(
pos
,
pos
+
copy
->
length
);
pos
+=
copy
->
length
+
copy
->
blob_field
->
get_length
();
blob_field
->
set_ptr
(
pos
,
pos
+
copy
->
length
);
pos
+=
copy
->
length
+
blob_field
->
get_length
();
}
}
else
{
if
(
copy
->
strip
)
if
(
copy
->
type
==
CACHE_STRIPPED
)
{
length
=
uint2korr
(
pos
);
memcpy
(
copy
->
str
,
pos
+
2
,
length
);
...
...
sql/sql_select.h
View file @
323a8ddc
...
...
@@ -95,6 +95,10 @@ typedef struct st_table_ref
}
TABLE_REF
;
#define CACHE_BLOB 1
/* blob field */
#define CACHE_STRIPPED 2
/* field stripped of trailing spaces */
/**
CACHE_FIELD and JOIN_CACHE is used on full join to cache records in outer
table
...
...
@@ -103,8 +107,8 @@ typedef struct st_table_ref
typedef
struct
st_cache_field
{
uchar
*
str
;
uint
length
,
blob_length
;
Field
_blob
*
blob_
field
;
bool
strip
;
Field
*
field
;
uint
type
;
/**< category of the of the copied field (CACHE_BLOB et al.) */
}
CACHE_FIELD
;
...
...
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