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
6e48347d
Commit
6e48347d
authored
Mar 25, 2016
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ob-10.0' into 10.0
parents
cbe35113
8c9fd074
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
13 deletions
+57
-13
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+16
-12
storage/connect/ha_connect.h
storage/connect/ha_connect.h
+1
-1
storage/connect/mysql-test/connect/r/part_table.result
storage/connect/mysql-test/connect/r/part_table.result
+25
-0
storage/connect/mysql-test/connect/t/part_table.test
storage/connect/mysql-test/connect/t/part_table.test
+15
-0
No files found.
storage/connect/ha_connect.cc
View file @
6e48347d
...
...
@@ -757,7 +757,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
sdvalout
=
NULL
;
xmod
=
MODE_ANY
;
istable
=
false
;
*
partname
=
0
;
memset
(
partname
,
0
,
sizeof
(
partname
))
;
bzero
((
char
*
)
&
xinfo
,
sizeof
(
XINFO
));
valid_info
=
false
;
valid_query_id
=
0
;
...
...
@@ -1150,7 +1150,7 @@ char *ha_connect::GetRealString(const char *s)
{
char
*
sv
;
if
(
IsPartitioned
()
&&
s
)
{
if
(
IsPartitioned
()
&&
s
&&
partname
&&
*
partname
)
{
sv
=
(
char
*
)
PlugSubAlloc
(
xp
->
g
,
NULL
,
0
);
sprintf
(
sv
,
s
,
partname
);
PlugSubAlloc
(
xp
->
g
,
NULL
,
strlen
(
sv
)
+
1
);
...
...
@@ -1173,7 +1173,9 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
:
table
->
s
->
connect_string
;
if
(
cnc
.
length
)
opval
=
GetRealString
(
strz
(
xp
->
g
,
cnc
));
opval
=
strz
(
xp
->
g
,
cnc
);
else
opval
=
GetListOption
(
xp
->
g
,
opname
,
options
->
oplist
);
}
else
if
(
!
stricmp
(
opname
,
"Query_String"
))
opval
=
thd_query_string
(
table
->
in_use
)
->
str
;
...
...
@@ -3121,13 +3123,14 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
#if defined(WITH_PARTITION_STORAGE_ENGINE)
if
(
table
->
part_info
)
{
if
(
GetStringOption
(
"Filename"
)
||
GetStringOption
(
"Tabname"
)
||
GetStringOption
(
"Connect"
))
{
str
cpy
(
partname
,
decode
(
g
,
strrchr
(
name
,
'#'
)
+
1
)
);
||
GetStringOption
(
"Connect"
))
{
str
ncpy
(
partname
,
decode
(
g
,
strrchr
(
name
,
'#'
)
+
1
),
sizeof
(
partname
)
-
1
);
// strcpy(partname, table->part_info->curr_part_elem->partition_name);
part_id
=
&
table
->
part_info
->
full_part_field_set
;
//
part_id= &table->part_info->full_part_field_set;
}
else
// Inward table
strcpy
(
partname
,
strrchr
(
name
,
slash
)
+
1
);
part_id
=
&
table
->
part_info
->
full_part_field_set
;
// Temporary
strncpy
(
partname
,
strrchr
(
name
,
slash
)
+
1
,
sizeof
(
partname
)
-
1
);
part_id
=
&
table
->
part_info
->
full_part_field_set
;
// Temporary
}
// endif part_info
#endif // WITH_PARTITION_STORAGE_ENGINE
}
else
...
...
@@ -6142,7 +6145,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
strcpy
(
dbpath
,
name
);
p
=
strrchr
(
dbpath
,
slash
);
str
cpy
(
partname
,
++
p
);
str
ncpy
(
partname
,
++
p
,
sizeof
(
partname
)
-
1
);
strcat
(
strcat
(
strcpy
(
buf
,
p
),
"."
),
lwt
);
*
p
=
0
;
}
else
{
...
...
@@ -6193,7 +6196,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
#if defined(WITH_PARTITION_STORAGE_ENGINE)
if
(
part_info
&&
!
inward
)
str
cpy
(
partname
,
decode
(
g
,
strrchr
(
name
,
'#'
)
+
1
)
);
str
ncpy
(
partname
,
decode
(
g
,
strrchr
(
name
,
'#'
)
+
1
),
sizeof
(
partname
)
-
1
);
// strcpy(partname, part_info->curr_part_elem->partition_name);
#endif // WITH_PARTITION_STORAGE_ENGINE
...
...
@@ -6234,8 +6237,9 @@ int ha_connect::create(const char *name, TABLE *table_arg,
#if defined(WITH_PARTITION_STORAGE_ENGINE)
if
(
part_info
)
strcpy
(
partname
,
decode
(
g
,
strrchr
(
name
,
(
inward
?
slash
:
'#'
))
+
1
));
strncpy
(
partname
,
decode
(
g
,
strrchr
(
name
,
(
inward
?
slash
:
'#'
))
+
1
),
sizeof
(
partname
)
-
1
);
#endif // WITH_PARTITION_STORAGE_ENGINE
if
((
rc
=
optimize
(
table
->
in_use
,
NULL
)))
{
...
...
storage/connect/ha_connect.h
View file @
6e48347d
...
...
@@ -554,7 +554,7 @@ int index_prev(uchar *buf);
PVAL
sdvalin4
;
// Used to convert date values
PVAL
sdvalout
;
// Used to convert date values
bool
istable
;
// True for table handler
char
partname
[
6
4
];
// The partition name
char
partname
[
6
5
];
// The partition name
MODE
xmod
;
// Table mode
XINFO
xinfo
;
// The table info structure
bool
valid_info
;
// True if xinfo is valid
...
...
storage/connect/mysql-test/connect/r/part_table.result
View file @
6e48347d
...
...
@@ -191,6 +191,31 @@ id msg
35 thirty five
81 big
DROP TABLE t1;
CREATE TABLE t1 (
id INT KEY NOT NULL,
msg VARCHAR(32))
ENGINE=CONNECT TABLE_TYPE=MYSQL
OPTION_LIST='connect=mysql://root@localhost/test/xt%s'
PARTITION BY RANGE COLUMNS(id) (
PARTITION `1` VALUES LESS THAN(10),
PARTITION `2` VALUES LESS THAN(50),
PARTITION `3` VALUES LESS THAN(MAXVALUE));
Warnings:
Warning 1105 Data repartition in 1 is unchecked
Warning 1105 Data repartition in 2 is unchecked
Warning 1105 Data repartition in 3 is unchecked
SELECT * FROM t1;
id msg
4 four
7 sept
1 one
8 eight
40 forty
10 ten
11 eleven
35 thirty five
81 big
DROP TABLE t1;
DROP TABLE xt1;
DROP TABLE xt2;
DROP TABLE xt3;
...
...
storage/connect/mysql-test/connect/t/part_table.test
View file @
6e48347d
...
...
@@ -82,6 +82,21 @@ SELECT * FROM t1;
DELETE
FROM
t1
WHERE
id
in
(
60
,
72
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
#
# Using a connection string
#
CREATE
TABLE
t1
(
id
INT
KEY
NOT
NULL
,
msg
VARCHAR
(
32
))
ENGINE
=
CONNECT
TABLE_TYPE
=
MYSQL
OPTION_LIST
=
'connect=mysql://root@localhost/test/xt%s'
PARTITION
BY
RANGE
COLUMNS
(
id
)
(
PARTITION
`1`
VALUES
LESS
THAN
(
10
),
PARTITION
`2`
VALUES
LESS
THAN
(
50
),
PARTITION
`3`
VALUES
LESS
THAN
(
MAXVALUE
));
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
xt1
;
DROP
TABLE
xt2
;
DROP
TABLE
xt3
;
...
...
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