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
4e599c74
Commit
4e599c74
authored
Jan 30, 2019
by
Kentoku
Committed by
Sergei Golubchik
Jan 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-18313 Supports 'wrapper mariadb' for connection information
parent
470c1b8d
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1616 additions
and
932 deletions
+1616
-932
storage/spider/CMakeLists.txt
storage/spider/CMakeLists.txt
+1
-1
storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc
...sql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc
+11
-0
storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc
...mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc
+24
-0
storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result
.../spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result
+78
-0
storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf
...age/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf
+3
-0
storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test
...ge/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test
+69
-0
storage/spider/spd_db_handlersocket.cc
storage/spider/spd_db_handlersocket.cc
+4
-3
storage/spider/spd_db_include.cc
storage/spider/spd_db_include.cc
+51
-0
storage/spider/spd_db_include.h
storage/spider/spd_db_include.h
+16
-7
storage/spider/spd_db_mysql.cc
storage/spider/spd_db_mysql.cc
+1181
-886
storage/spider/spd_db_mysql.h
storage/spider/spd_db_mysql.h
+165
-31
storage/spider/spd_db_oracle.cc
storage/spider/spd_db_oracle.cc
+5
-4
storage/spider/spd_table.cc
storage/spider/spd_table.cc
+8
-0
No files found.
storage/spider/CMakeLists.txt
View file @
4e599c74
...
@@ -18,7 +18,7 @@ SET(SPIDER_SOURCES
...
@@ -18,7 +18,7 @@ SET(SPIDER_SOURCES
spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc
spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc
spd_copy_tables.cc spd_i_s.cc spd_malloc.cc ha_spider.cc spd_udf.def
spd_copy_tables.cc spd_i_s.cc spd_malloc.cc ha_spider.cc spd_udf.def
spd_db_mysql.cc spd_db_handlersocket.cc spd_db_oracle.cc
spd_db_mysql.cc spd_db_handlersocket.cc spd_db_oracle.cc
spd_group_by_handler.cc
spd_group_by_handler.cc
spd_db_include.cc
hs_client/config.cpp hs_client/escape.cpp hs_client/fatal.cpp
hs_client/config.cpp hs_client/escape.cpp hs_client/fatal.cpp
hs_client/hstcpcli.cpp hs_client/socket.cpp hs_client/string_util.cpp
hs_client/hstcpcli.cpp hs_client/socket.cpp hs_client/string_util.cpp
)
)
...
...
storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc
0 → 100644
View file @
4e599c74
--
let
$MASTER_1_COMMENT_2_1
=
$MASTER_1_COMMENT_2_1_BACKUP
--
let
$CHILD2_1_DROP_TABLES
=
$CHILD2_1_DROP_TABLES_BACKUP
--
let
$CHILD2_1_CREATE_TABLES
=
$CHILD2_1_CREATE_TABLES_BACKUP
--
let
$CHILD2_1_SELECT_TABLES
=
$CHILD2_1_SELECT_TABLES_BACKUP
--
disable_warnings
--
disable_query_log
--
disable_result_log
--
source
../
t
/
test_deinit
.
inc
--
enable_result_log
--
enable_query_log
--
enable_warnings
storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc
0 → 100644
View file @
4e599c74
--
disable_warnings
--
disable_query_log
--
disable_result_log
--
source
../
t
/
test_init
.
inc
--
enable_result_log
--
enable_query_log
--
enable_warnings
--
let
$MASTER_1_COMMENT_2_1_BACKUP
=
$MASTER_1_COMMENT_2_1
let
$MASTER_1_COMMENT_2_1
=
COMMENT
=
'table "tbl_a", srv "s_2_1", wrapper "mariadb"'
;
--
let
$CHILD2_1_DROP_TABLES_BACKUP
=
$CHILD2_1_DROP_TABLES
let
$CHILD2_1_DROP_TABLES
=
DROP
TABLE
IF
EXISTS
tbl_a
;
--
let
$CHILD2_1_CREATE_TABLES_BACKUP
=
$CHILD2_1_CREATE_TABLES
let
$CHILD2_1_CREATE_TABLES
=
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
PRIMARY
KEY
(
pkey
)
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
;
--
let
$CHILD2_1_SELECT_TABLES_BACKUP
=
$CHILD2_1_SELECT_TABLES
let
$CHILD2_1_SELECT_TABLES
=
SELECT
pkey
FROM
tbl_a
ORDER
BY
pkey
;
let
$CHILD2_1_SELECT_ARGUMENT1
=
SELECT
argument
FROM
mysql
.
general_log
WHERE
argument
LIKE
'%select %'
;
storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result
0 → 100644
View file @
4e599c74
for master_1
for child2
child2_1
child2_2
child2_3
for child3
this test is for MDEV-18313
drop and create databases
connection master_1;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
create table and insert
connection child2_1;
CHILD2_1_CREATE_TABLES
TRUNCATE TABLE mysql.general_log;
connection master_1;
CREATE TABLE tbl_a (
pkey int NOT NULL,
PRIMARY KEY (pkey)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT * FROM tbl_a ORDER BY pkey;
pkey
0
1
2
3
4
5
6
7
8
9
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`pkey` `pkey` from `auto_test_remote`.`tbl_a` t0 order by `pkey`
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT pkey FROM tbl_a ORDER BY pkey;
pkey
0
1
2
3
4
5
6
7
8
9
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
end of test
storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf
0 → 100644
View file @
4e599c74
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf
storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test
0 → 100644
View file @
4e599c74
--
source
../
include
/
wrapper_mariadb_init
.
inc
--
echo
--
echo
this
test
is
for
MDEV
-
18313
--
echo
--
echo
drop
and
create
databases
--
connection
master_1
--
disable_warnings
CREATE
DATABASE
auto_test_local
;
USE
auto_test_local
;
--
connection
child2_1
SET
@
old_log_output
=
@@
global
.
log_output
;
SET
GLOBAL
log_output
=
'TABLE,FILE'
;
CREATE
DATABASE
auto_test_remote
;
USE
auto_test_remote
;
--
enable_warnings
--
echo
--
echo
create
table
and
insert
--
connection
child2_1
--
disable_query_log
echo
CHILD2_1_CREATE_TABLES
;
eval
$CHILD2_1_CREATE_TABLES
;
--
enable_query_log
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
master_1
--
disable_query_log
echo
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
PRIMARY
KEY
(
pkey
)
)
MASTER_1_ENGINE
MASTER_1_CHARSET
MASTER_1_COMMENT_2_1
;
eval
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
PRIMARY
KEY
(
pkey
)
)
$MASTER_1_ENGINE
$MASTER_1_CHARSET
$MASTER_1_COMMENT_2_1
;
--
enable_query_log
INSERT
INTO
tbl_a
(
pkey
)
VALUES
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
--
echo
--
echo
select
test
--
connection
child2_1
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
master_1
SELECT
*
FROM
tbl_a
ORDER
BY
pkey
;
--
connection
child2_1
eval
$CHILD2_1_SELECT_ARGUMENT1
;
eval
$CHILD2_1_SELECT_TABLES
;
--
echo
--
echo
deinit
--
disable_warnings
--
connection
master_1
DROP
DATABASE
IF
EXISTS
auto_test_local
;
--
connection
child2_1
DROP
DATABASE
IF
EXISTS
auto_test_remote
;
SET
GLOBAL
log_output
=
@
old_log_output
;
--
enable_warnings
--
source
../
include
/
wrapper_mariadb_deinit
.
inc
--
echo
--
echo
end
of
test
storage/spider/spd_db_handlersocket.cc
View file @
4e599c74
...
@@ -500,7 +500,7 @@ SPIDER_DB_ROW *spider_db_handlersocket_row::clone()
...
@@ -500,7 +500,7 @@ SPIDER_DB_ROW *spider_db_handlersocket_row::clone()
uint
i
;
uint
i
;
DBUG_ENTER
(
"spider_db_handlersocket_row::clone"
);
DBUG_ENTER
(
"spider_db_handlersocket_row::clone"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
if
(
!
(
clone_row
=
new
spider_db_handlersocket_row
()))
if
(
!
(
clone_row
=
new
spider_db_handlersocket_row
(
dbton_id
)))
{
{
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
}
}
...
@@ -603,7 +603,7 @@ bool spider_db_handlersocket_result_buffer::check_size(
...
@@ -603,7 +603,7 @@ bool spider_db_handlersocket_result_buffer::check_size(
spider_db_handlersocket_result
::
spider_db_handlersocket_result
(
spider_db_handlersocket_result
::
spider_db_handlersocket_result
(
SPIDER_DB_CONN
*
in_db_conn
SPIDER_DB_CONN
*
in_db_conn
)
:
spider_db_result
(
in_db_conn
,
spider_dbton_handlersocket
.
dbton_id
)
)
:
spider_db_result
(
in_db_conn
),
row
(
in_db_conn
->
dbton_id
)
{
{
DBUG_ENTER
(
"spider_db_handlersocket_result::spider_db_handlersocket_result"
);
DBUG_ENTER
(
"spider_db_handlersocket_result::spider_db_handlersocket_result"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
...
@@ -3953,7 +3953,8 @@ int spider_db_handlersocket_util::append_having(
...
@@ -3953,7 +3953,8 @@ int spider_db_handlersocket_util::append_having(
spider_handlersocket_share
::
spider_handlersocket_share
(
spider_handlersocket_share
::
spider_handlersocket_share
(
st_spider_share
*
share
st_spider_share
*
share
)
:
spider_db_share
(
)
:
spider_db_share
(
share
share
,
spider_dbton_handlersocket
.
dbton_id
),
),
table_names_str
(
NULL
),
table_names_str
(
NULL
),
db_names_str
(
NULL
),
db_names_str
(
NULL
),
...
...
storage/spider/spd_db_include.cc
0 → 100644
View file @
4e599c74
/* Copyright (C) 2018-2019 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#endif
#include "sql_common.h"
#include <mysql.h>
#include <errmsg.h>
#include "spd_err.h"
#include "spd_db_include.h"
#include "spd_include.h"
spider_db_result
::
spider_db_result
(
SPIDER_DB_CONN
*
in_db_conn
)
:
db_conn
(
in_db_conn
),
dbton_id
(
in_db_conn
->
dbton_id
)
{
DBUG_ENTER
(
"spider_db_result::spider_db_result"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_VOID_RETURN
;
}
spider_db_conn
::
spider_db_conn
(
SPIDER_CONN
*
in_conn
)
:
conn
(
in_conn
),
dbton_id
(
in_conn
->
dbton_id
)
{
DBUG_ENTER
(
"spider_db_conn::spider_db_conn"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_VOID_RETURN
;
}
storage/spider/spd_db_include.h
View file @
4e599c74
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#define SPIDER_DBTON_SIZE 15
#define SPIDER_DBTON_SIZE 15
#define SPIDER_DB_WRAPPER_MYSQL "mysql"
#define SPIDER_DB_WRAPPER_MYSQL "mysql"
#define SPIDER_DB_WRAPPER_MARIADB "mariadb"
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100204
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100204
#define PLUGIN_VAR_CAN_MEMALLOC
#define PLUGIN_VAR_CAN_MEMALLOC
...
@@ -795,6 +796,7 @@ struct st_spider_db_request_key
...
@@ -795,6 +796,7 @@ struct st_spider_db_request_key
class
spider_db_util
class
spider_db_util
{
{
public:
public:
uint
dbton_id
;
spider_db_util
()
{}
spider_db_util
()
{}
virtual
~
spider_db_util
()
{}
virtual
~
spider_db_util
()
{}
virtual
int
append_name
(
virtual
int
append_name
(
...
@@ -961,8 +963,7 @@ class spider_db_result
...
@@ -961,8 +963,7 @@ class spider_db_result
SPIDER_DB_CONN
*
db_conn
;
SPIDER_DB_CONN
*
db_conn
;
public:
public:
uint
dbton_id
;
uint
dbton_id
;
spider_db_result
(
SPIDER_DB_CONN
*
in_db_conn
,
uint
in_dbton_id
)
:
spider_db_result
(
SPIDER_DB_CONN
*
in_db_conn
);
db_conn
(
in_db_conn
),
dbton_id
(
in_dbton_id
)
{}
virtual
~
spider_db_result
()
{}
virtual
~
spider_db_result
()
{}
virtual
bool
has_result
()
=
0
;
virtual
bool
has_result
()
=
0
;
virtual
void
free_result
()
=
0
;
virtual
void
free_result
()
=
0
;
...
@@ -1028,9 +1029,10 @@ class spider_db_conn
...
@@ -1028,9 +1029,10 @@ class spider_db_conn
protected:
protected:
SPIDER_CONN
*
conn
;
SPIDER_CONN
*
conn
;
public:
public:
uint
dbton_id
;
spider_db_conn
(
spider_db_conn
(
SPIDER_CONN
*
conn
SPIDER_CONN
*
in_
conn
)
:
conn
(
conn
)
{}
)
;
virtual
~
spider_db_conn
()
{}
virtual
~
spider_db_conn
()
{}
virtual
int
init
()
=
0
;
virtual
int
init
()
=
0
;
virtual
bool
is_connected
()
=
0
;
virtual
bool
is_connected
()
=
0
;
...
@@ -1229,8 +1231,12 @@ class spider_db_share
...
@@ -1229,8 +1231,12 @@ class spider_db_share
const
char
*
mem_calc_file_name
;
const
char
*
mem_calc_file_name
;
ulong
mem_calc_line_no
;
ulong
mem_calc_line_no
;
public:
public:
uint
dbton_id
;
st_spider_share
*
spider_share
;
st_spider_share
*
spider_share
;
spider_db_share
(
st_spider_share
*
share
)
:
spider_share
(
share
)
{}
spider_db_share
(
st_spider_share
*
share
,
uint
dbton_id
)
:
dbton_id
(
dbton_id
),
spider_share
(
share
)
{}
virtual
~
spider_db_share
()
{}
virtual
~
spider_db_share
()
{}
virtual
int
init
()
=
0
;
virtual
int
init
()
=
0
;
virtual
uint
get_column_name_length
(
virtual
uint
get_column_name_length
(
...
@@ -1264,6 +1270,7 @@ class spider_db_handler
...
@@ -1264,6 +1270,7 @@ class spider_db_handler
const
char
*
mem_calc_file_name
;
const
char
*
mem_calc_file_name
;
ulong
mem_calc_line_no
;
ulong
mem_calc_line_no
;
public:
public:
uint
dbton_id
;
ha_spider
*
spider
;
ha_spider
*
spider
;
spider_db_share
*
db_share
;
spider_db_share
*
db_share
;
int
first_link_idx
;
int
first_link_idx
;
...
@@ -1271,7 +1278,8 @@ class spider_db_handler
...
@@ -1271,7 +1278,8 @@ class spider_db_handler
SPIDER_LINK_IDX_CHAIN
*
link_idx_chain
;
SPIDER_LINK_IDX_CHAIN
*
link_idx_chain
;
#endif
#endif
spider_db_handler
(
ha_spider
*
spider
,
spider_db_share
*
db_share
)
:
spider_db_handler
(
ha_spider
*
spider
,
spider_db_share
*
db_share
)
:
spider
(
spider
),
db_share
(
db_share
),
first_link_idx
(
-
1
)
{}
dbton_id
(
db_share
->
dbton_id
),
spider
(
spider
),
db_share
(
db_share
),
first_link_idx
(
-
1
)
{}
virtual
~
spider_db_handler
()
{}
virtual
~
spider_db_handler
()
{}
virtual
int
init
()
=
0
;
virtual
int
init
()
=
0
;
virtual
int
append_index_hint
(
virtual
int
append_index_hint
(
...
@@ -1750,9 +1758,10 @@ class spider_db_handler
...
@@ -1750,9 +1758,10 @@ class spider_db_handler
class
spider_db_copy_table
class
spider_db_copy_table
{
{
public:
public:
uint
dbton_id
;
spider_db_share
*
db_share
;
spider_db_share
*
db_share
;
spider_db_copy_table
(
spider_db_share
*
db_share
)
:
spider_db_copy_table
(
spider_db_share
*
db_share
)
:
db_share
(
db_share
)
{}
db
ton_id
(
db_share
->
dbton_id
),
db
_share
(
db_share
)
{}
virtual
~
spider_db_copy_table
()
{}
virtual
~
spider_db_copy_table
()
{}
virtual
int
init
()
=
0
;
virtual
int
init
()
=
0
;
virtual
void
set_sql_charset
(
virtual
void
set_sql_charset
(
...
...
storage/spider/spd_db_mysql.cc
View file @
4e599c74
This diff is collapsed.
Click to expand it.
storage/spider/spd_db_mysql.h
View file @
4e599c74
...
@@ -13,11 +13,11 @@
...
@@ -13,11 +13,11 @@
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
class
spider_db_m
ysql
_util
:
public
spider_db_util
class
spider_db_m
base
_util
:
public
spider_db_util
{
{
public:
public:
spider_db_m
ysql
_util
();
spider_db_m
base
_util
();
~
spider_db_mysql
_util
();
virtual
~
spider_db_mbase
_util
();
int
append_name
(
int
append_name
(
spider_string
*
str
,
spider_string
*
str
,
const
char
*
name
,
const
char
*
name
,
...
@@ -174,7 +174,21 @@ class spider_db_mysql_util: public spider_db_util
...
@@ -174,7 +174,21 @@ class spider_db_mysql_util: public spider_db_util
#endif
#endif
};
};
class
spider_db_mysql_row
:
public
spider_db_row
class
spider_db_mysql_util
:
public
spider_db_mbase_util
{
public:
spider_db_mysql_util
();
~
spider_db_mysql_util
();
};
class
spider_db_mariadb_util
:
public
spider_db_mbase_util
{
public:
spider_db_mariadb_util
();
~
spider_db_mariadb_util
();
};
class
spider_db_mbase_row
:
public
spider_db_row
{
{
public:
public:
MYSQL_ROW
row
;
MYSQL_ROW
row
;
...
@@ -184,8 +198,10 @@ class spider_db_mysql_row: public spider_db_row
...
@@ -184,8 +198,10 @@ class spider_db_mysql_row: public spider_db_row
uint
field_count
;
uint
field_count
;
uint
record_size
;
uint
record_size
;
bool
cloned
;
bool
cloned
;
spider_db_mysql_row
();
spider_db_mbase_row
(
~
spider_db_mysql_row
();
uint
dbton_id
);
virtual
~
spider_db_mbase_row
();
int
store_to_field
(
int
store_to_field
(
Field
*
field
,
Field
*
field
,
CHARSET_INFO
*
access_charset
CHARSET_INFO
*
access_charset
...
@@ -214,15 +230,31 @@ class spider_db_mysql_row: public spider_db_row
...
@@ -214,15 +230,31 @@ class spider_db_mysql_row: public spider_db_row
uint
get_byte_size
();
uint
get_byte_size
();
};
};
class
spider_db_mysql_result
:
public
spider_db_result
class
spider_db_mysql_row
:
public
spider_db_mbase_row
{
public:
spider_db_mysql_row
();
~
spider_db_mysql_row
();
};
class
spider_db_mariadb_row
:
public
spider_db_mbase_row
{
public:
spider_db_mariadb_row
();
~
spider_db_mariadb_row
();
};
class
spider_db_mbase_result
:
public
spider_db_result
{
{
public:
public:
MYSQL_RES
*
db_result
;
MYSQL_RES
*
db_result
;
spider_db_m
ysql
_row
row
;
spider_db_m
base
_row
row
;
MYSQL_ROW_OFFSET
first_row
;
MYSQL_ROW_OFFSET
first_row
;
int
store_error_num
;
int
store_error_num
;
spider_db_mysql_result
(
SPIDER_DB_CONN
*
in_db_conn
);
spider_db_mbase_result
(
~
spider_db_mysql_result
();
SPIDER_DB_CONN
*
in_db_conn
);
virtual
~
spider_db_mbase_result
();
bool
has_result
();
bool
has_result
();
void
free_result
();
void
free_result
();
SPIDER_DB_ROW
*
current_row
();
SPIDER_DB_ROW
*
current_row
();
...
@@ -289,9 +321,29 @@ class spider_db_mysql_result: public spider_db_result
...
@@ -289,9 +321,29 @@ class spider_db_mysql_result: public spider_db_result
#endif
#endif
};
};
class
spider_db_mysql
:
public
spider_db_conn
class
spider_db_mysql_result
:
public
spider_db_mbase_result
{
public:
spider_db_mysql_result
(
SPIDER_DB_CONN
*
in_db_conn
);
~
spider_db_mysql_result
();
};
class
spider_db_mariadb_result
:
public
spider_db_mbase_result
{
public:
spider_db_mariadb_result
(
SPIDER_DB_CONN
*
in_db_conn
);
~
spider_db_mariadb_result
();
};
class
spider_db_mbase
:
public
spider_db_conn
{
{
int
stored_error
;
protected:
int
stored_error
;
spider_db_mbase_util
*
spider_db_mbase_utility
;
public:
public:
MYSQL
*
db_conn
;
MYSQL
*
db_conn
;
HASH
lock_table_hash
;
HASH
lock_table_hash
;
...
@@ -306,10 +358,11 @@ class spider_db_mysql: public spider_db_conn
...
@@ -306,10 +358,11 @@ class spider_db_mysql: public spider_db_conn
const
char
*
handler_open_array_func_name
;
const
char
*
handler_open_array_func_name
;
const
char
*
handler_open_array_file_name
;
const
char
*
handler_open_array_file_name
;
ulong
handler_open_array_line_no
;
ulong
handler_open_array_line_no
;
spider_db_mysql
(
spider_db_mbase
(
SPIDER_CONN
*
conn
SPIDER_CONN
*
conn
,
spider_db_mbase_util
*
spider_db_mbase_utility
);
);
~
spider_db_mysql
();
virtual
~
spider_db_mbase
();
int
init
();
int
init
();
bool
is_connected
();
bool
is_connected
();
void
bg_connect
();
void
bg_connect
();
...
@@ -524,8 +577,28 @@ class spider_db_mysql: public spider_db_conn
...
@@ -524,8 +577,28 @@ class spider_db_mysql: public spider_db_conn
);
);
};
};
class
spider_mysql_share
:
public
spider_db_share
class
spider_db_mysql
:
public
spider_db_mbase
{
public:
spider_db_mysql
(
SPIDER_CONN
*
conn
);
~
spider_db_mysql
();
};
class
spider_db_mariadb
:
public
spider_db_mbase
{
public:
spider_db_mariadb
(
SPIDER_CONN
*
conn
);
~
spider_db_mariadb
();
};
class
spider_mbase_share
:
public
spider_db_share
{
{
protected:
spider_db_mbase_util
*
spider_db_mbase_utility
;
public:
public:
spider_string
*
table_select
;
spider_string
*
table_select
;
int
table_select_pos
;
int
table_select_pos
;
...
@@ -547,10 +620,12 @@ class spider_mysql_share: public spider_db_share
...
@@ -547,10 +620,12 @@ class spider_mysql_share: public spider_db_share
bool
same_db_table_name
;
bool
same_db_table_name
;
int
first_all_link_idx
;
int
first_all_link_idx
;
spider_mysql_share
(
spider_mbase_share
(
st_spider_share
*
share
st_spider_share
*
share
,
uint
dbton_id
,
spider_db_mbase_util
*
spider_db_mbase_utility
);
);
~
spider_mysql
_share
();
virtual
~
spider_mbase
_share
();
int
init
();
int
init
();
uint
get_column_name_length
(
uint
get_column_name_length
(
uint
field_index
uint
field_index
...
@@ -585,7 +660,7 @@ class spider_mysql_share: public spider_db_share
...
@@ -585,7 +660,7 @@ class spider_mysql_share: public spider_db_share
spider_string
*
str
spider_string
*
str
);
);
#endif
#endif
pr
ivate
:
pr
otected
:
int
create_table_names_str
();
int
create_table_names_str
();
void
free_table_names_str
();
void
free_table_names_str
();
int
create_column_name_str
();
int
create_column_name_str
();
...
@@ -603,8 +678,28 @@ class spider_mysql_share: public spider_db_share
...
@@ -603,8 +678,28 @@ class spider_mysql_share: public spider_db_share
);
);
};
};
class
spider_mysql_handler
:
public
spider_db_handler
class
spider_mysql_share
:
public
spider_mbase_share
{
public:
spider_mysql_share
(
st_spider_share
*
share
);
~
spider_mysql_share
();
};
class
spider_mariadb_share
:
public
spider_mbase_share
{
{
public:
spider_mariadb_share
(
st_spider_share
*
share
);
~
spider_mariadb_share
();
};
class
spider_mbase_handler
:
public
spider_db_handler
{
protected:
spider_db_mbase_util
*
spider_db_mbase_utility
;
spider_string
sql
;
spider_string
sql
;
spider_string
sql_part
;
spider_string
sql_part
;
spider_string
sql_part2
;
spider_string
sql_part2
;
...
@@ -614,7 +709,7 @@ class spider_mysql_handler: public spider_db_handler
...
@@ -614,7 +709,7 @@ class spider_mysql_handler: public spider_db_handler
int
limit_pos
;
int
limit_pos
;
public:
public:
int
table_name_pos
;
int
table_name_pos
;
pr
ivate
:
pr
otected
:
int
ha_read_pos
;
int
ha_read_pos
;
int
ha_next_pos
;
int
ha_next_pos
;
int
ha_where_pos
;
int
ha_where_pos
;
...
@@ -647,14 +742,15 @@ class spider_mysql_handler: public spider_db_handler
...
@@ -647,14 +742,15 @@ class spider_mysql_handler: public spider_db_handler
SPIDER_INT_HLD
*
union_table_name_pos_first
;
SPIDER_INT_HLD
*
union_table_name_pos_first
;
SPIDER_INT_HLD
*
union_table_name_pos_current
;
SPIDER_INT_HLD
*
union_table_name_pos_current
;
public:
public:
spider_m
ysql
_share
*
mysql_share
;
spider_m
base
_share
*
mysql_share
;
SPIDER_LINK_FOR_HASH
*
link_for_hash
;
SPIDER_LINK_FOR_HASH
*
link_for_hash
;
uchar
*
minimum_select_bitmap
;
uchar
*
minimum_select_bitmap
;
spider_m
ysql
_handler
(
spider_m
base
_handler
(
ha_spider
*
spider
,
ha_spider
*
spider
,
spider_mysql_share
*
share
spider_mbase_share
*
share
,
spider_db_mbase_util
*
spider_db_mbase_utility
);
);
~
spider_mysql
_handler
();
virtual
~
spider_mbase
_handler
();
int
init
();
int
init
();
int
append_index_hint
(
int
append_index_hint
(
spider_string
*
str
,
spider_string
*
str
,
...
@@ -1498,16 +1594,36 @@ class spider_mysql_handler: public spider_db_handler
...
@@ -1498,16 +1594,36 @@ class spider_mysql_handler: public spider_db_handler
#endif
#endif
};
};
class
spider_mysql_copy_table
:
public
spider_db_copy_table
class
spider_mysql_handler
:
public
spider_mbase_handler
{
public:
spider_mysql_handler
(
ha_spider
*
spider
,
spider_mbase_share
*
share
);
~
spider_mysql_handler
();
};
class
spider_mariadb_handler
:
public
spider_mbase_handler
{
{
public:
public:
spider_mysql_share
*
mysql_share
;
spider_mariadb_handler
(
ha_spider
*
spider
,
spider_mbase_share
*
share
);
~
spider_mariadb_handler
();
};
class
spider_mbase_copy_table
:
public
spider_db_copy_table
{
public:
spider_mbase_share
*
mysql_share
;
spider_string
sql
;
spider_string
sql
;
uint
pos
;
uint
pos
;
spider_m
ysql
_copy_table
(
spider_m
base
_copy_table
(
spider_m
ysql
_share
*
db_share
spider_m
base
_share
*
db_share
);
);
~
spider_mysql
_copy_table
();
virtual
~
spider_mbase
_copy_table
();
int
init
();
int
init
();
void
set_sql_charset
(
void
set_sql_charset
(
CHARSET_INFO
*
cs
CHARSET_INFO
*
cs
...
@@ -1578,3 +1694,21 @@ class spider_mysql_copy_table: public spider_db_copy_table
...
@@ -1578,3 +1694,21 @@ class spider_mysql_copy_table: public spider_db_copy_table
spider_db_copy_table
*
source_ct
spider_db_copy_table
*
source_ct
);
);
};
};
class
spider_mysql_copy_table
:
public
spider_mbase_copy_table
{
public:
spider_mysql_copy_table
(
spider_mbase_share
*
db_share
);
~
spider_mysql_copy_table
();
};
class
spider_mariadb_copy_table
:
public
spider_mbase_copy_table
{
public:
spider_mariadb_copy_table
(
spider_mbase_share
*
db_share
);
~
spider_mariadb_copy_table
();
};
storage/spider/spd_db_oracle.cc
View file @
4e599c74
...
@@ -512,7 +512,7 @@ SPIDER_DB_ROW *spider_db_oracle_row::clone()
...
@@ -512,7 +512,7 @@ SPIDER_DB_ROW *spider_db_oracle_row::clone()
spider_db_oracle_row
*
clone_row
;
spider_db_oracle_row
*
clone_row
;
DBUG_ENTER
(
"spider_db_oracle_row::clone"
);
DBUG_ENTER
(
"spider_db_oracle_row::clone"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
if
(
!
(
clone_row
=
new
spider_db_oracle_row
()))
if
(
!
(
clone_row
=
new
spider_db_oracle_row
(
dbton_id
)))
{
{
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
}
}
...
@@ -772,9 +772,9 @@ int spider_db_oracle_row::fetch()
...
@@ -772,9 +772,9 @@ int spider_db_oracle_row::fetch()
}
}
spider_db_oracle_result
::
spider_db_oracle_result
(
SPIDER_DB_CONN
*
in_db_conn
)
:
spider_db_oracle_result
::
spider_db_oracle_result
(
SPIDER_DB_CONN
*
in_db_conn
)
:
spider_db_result
(
in_db_conn
,
spider_dbton_oracle
.
dbton_id
),
spider_db_result
(
in_db_conn
),
db_conn
(
NULL
),
stmtp
(
NULL
),
field_count
(
0
),
access_charset
(
NULL
),
db_conn
(
NULL
),
stmtp
(
NULL
),
field_count
(
0
),
access_charset
(
NULL
),
fetched
(
FALSE
)
fetched
(
FALSE
)
,
row
(
in_db_conn
->
dbton_id
)
{
{
DBUG_ENTER
(
"spider_db_oracle_result::spider_db_oracle_result"
);
DBUG_ENTER
(
"spider_db_oracle_result::spider_db_oracle_result"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
...
@@ -4365,7 +4365,8 @@ int spider_db_oracle_util::append_having(
...
@@ -4365,7 +4365,8 @@ int spider_db_oracle_util::append_having(
spider_oracle_share
::
spider_oracle_share
(
spider_oracle_share
::
spider_oracle_share
(
st_spider_share
*
share
st_spider_share
*
share
)
:
spider_db_share
(
)
:
spider_db_share
(
share
share
,
spider_dbton_oracle
.
dbton_id
),
),
table_select
(
NULL
),
table_select
(
NULL
),
table_select_pos
(
0
),
table_select_pos
(
0
),
...
...
storage/spider/spd_table.cc
View file @
4e599c74
...
@@ -128,6 +128,7 @@ extern long spider_conn_mutex_id;
...
@@ -128,6 +128,7 @@ extern long spider_conn_mutex_id;
handlerton
*
spider_hton_ptr
;
handlerton
*
spider_hton_ptr
;
SPIDER_DBTON
spider_dbton
[
SPIDER_DBTON_SIZE
];
SPIDER_DBTON
spider_dbton
[
SPIDER_DBTON_SIZE
];
extern
SPIDER_DBTON
spider_dbton_mysql
;
extern
SPIDER_DBTON
spider_dbton_mysql
;
extern
SPIDER_DBTON
spider_dbton_mariadb
;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
extern
SPIDER_DBTON
spider_dbton_handlersocket
;
extern
SPIDER_DBTON
spider_dbton_handlersocket
;
#endif
#endif
...
@@ -7362,15 +7363,22 @@ int spider_db_init(
...
@@ -7362,15 +7363,22 @@ int spider_db_init(
#endif
#endif
spider_dbton_mysql
.
dbton_id
=
dbton_id
;
spider_dbton_mysql
.
dbton_id
=
dbton_id
;
spider_dbton_mysql
.
db_util
->
dbton_id
=
dbton_id
;
spider_dbton
[
dbton_id
]
=
spider_dbton_mysql
;
spider_dbton
[
dbton_id
]
=
spider_dbton_mysql
;
++
dbton_id
;
++
dbton_id
;
spider_dbton_mariadb
.
dbton_id
=
dbton_id
;
spider_dbton_mariadb
.
db_util
->
dbton_id
=
dbton_id
;
spider_dbton
[
dbton_id
]
=
spider_dbton_mariadb
;
++
dbton_id
;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
spider_dbton_handlersocket
.
dbton_id
=
dbton_id
;
spider_dbton_handlersocket
.
dbton_id
=
dbton_id
;
spider_dbton_handlersocket
.
db_util
->
dbton_id
=
dbton_id
;
spider_dbton
[
dbton_id
]
=
spider_dbton_handlersocket
;
spider_dbton
[
dbton_id
]
=
spider_dbton_handlersocket
;
++
dbton_id
;
++
dbton_id
;
#endif
#endif
#ifdef HAVE_ORACLE_OCI
#ifdef HAVE_ORACLE_OCI
spider_dbton_oracle
.
dbton_id
=
dbton_id
;
spider_dbton_oracle
.
dbton_id
=
dbton_id
;
spider_dbton_oracle
.
db_util
->
dbton_id
=
dbton_id
;
spider_dbton
[
dbton_id
]
=
spider_dbton_oracle
;
spider_dbton
[
dbton_id
]
=
spider_dbton_oracle
;
++
dbton_id
;
++
dbton_id
;
#endif
#endif
...
...
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