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
0ba8ca2a
Commit
0ba8ca2a
authored
Oct 02, 2005
by
brian@zim.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.0
into zim.(none):/home/brian/mysql/fix-5.0
parents
b2f52819
54a95899
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
245 additions
and
240 deletions
+245
-240
sql/examples/ha_example.cc
sql/examples/ha_example.cc
+5
-1
sql/examples/ha_tina.cc
sql/examples/ha_tina.cc
+4
-0
sql/ha_archive.cc
sql/ha_archive.cc
+23
-8
sql/ha_archive.h
sql/ha_archive.h
+1
-1
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+15
-4
sql/ha_berkeley.h
sql/ha_berkeley.h
+1
-1
sql/ha_blackhole.cc
sql/ha_blackhole.cc
+4
-0
sql/ha_federated.cc
sql/ha_federated.cc
+44
-27
sql/ha_heap.cc
sql/ha_heap.cc
+4
-0
sql/ha_innodb.cc
sql/ha_innodb.cc
+16
-5
sql/ha_innodb.h
sql/ha_innodb.h
+1
-1
sql/ha_myisam.cc
sql/ha_myisam.cc
+4
-0
sql/ha_myisammrg.cc
sql/ha_myisammrg.cc
+4
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+14
-5
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+1
-1
sql/handler.cc
sql/handler.cc
+67
-166
sql/handler.h
sql/handler.h
+22
-9
sql/log.cc
sql/log.cc
+8
-3
sql/mysql_priv.h
sql/mysql_priv.h
+0
-1
sql/sql_show.cc
sql/sql_show.cc
+7
-7
No files found.
sql/examples/ha_example.cc
View file @
0ba8ca2a
...
...
@@ -74,7 +74,11 @@
handlerton
example_hton
=
{
"CSV"
,
"EXAMPLE"
,
SHOW_OPTION_YES
,
"Example storage engine"
,
DB_TYPE_EXAMPLE_DB
,
NULL
,
/* We do need to write one! */
0
,
/* slot */
0
,
/* savepoint size. */
NULL
,
/* close_connection */
...
...
sql/examples/ha_tina.cc
View file @
0ba8ca2a
...
...
@@ -56,6 +56,10 @@ static int tina_init= 0;
handlerton
tina_hton
=
{
"CSV"
,
SHOW_OPTION_YES
,
"CSV storage engine"
,
DB_TYPE_CSV_DB
,
NULL
,
/* One needs to be written! */
0
,
/* slot */
0
,
/* savepoint size. */
NULL
,
/* close_connection */
...
...
sql/ha_archive.cc
View file @
0ba8ca2a
...
...
@@ -116,7 +116,7 @@
*/
/* If the archive storage engine has been inited */
static
bool
archive_inited
=
0
;
static
bool
archive_inited
=
FALSE
;
/* Variables for archive share methods */
pthread_mutex_t
archive_mutex
;
static
HASH
archive_open_tables
;
...
...
@@ -138,6 +138,10 @@ static HASH archive_open_tables;
/* dummy handlerton - only to have something to return from archive_db_init */
handlerton
archive_hton
=
{
"archive"
,
SHOW_OPTION_YES
,
"Archive storage engine"
,
DB_TYPE_ARCHIVE_DB
,
archive_db_init
,
0
,
/* slot */
0
,
/* savepoint size. */
NULL
,
/* close_connection */
...
...
@@ -176,18 +180,29 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
void
RETURN
&archive_hton
OK
0
Error
FALSE
OK
TRUE
Error
*/
handlerton
*
archive_db_init
()
bool
archive_db_init
()
{
archive_inited
=
1
;
VOID
(
pthread_mutex_init
(
&
archive_mutex
,
MY_MUTEX_INIT_FAST
));
DBUG_ENTER
(
"archive_db_init"
);
if
(
pthread_mutex_init
(
&
archive_mutex
,
MY_MUTEX_INIT_FAST
))
goto
error
;
if
(
hash_init
(
&
archive_open_tables
,
system_charset_info
,
32
,
0
,
0
,
(
hash_get_key
)
archive_get_key
,
0
,
0
))
return
0
;
return
&
archive_hton
;
{
VOID
(
pthread_mutex_destroy
(
&
archive_mutex
));
}
else
{
archive_inited
=
TRUE
;
DBUG_RETURN
(
FALSE
);
}
error:
have_archive_db
=
SHOW_OPTION_DISABLED
;
// If we couldn't use handler
archive_hton
.
state
=
SHOW_OPTION_DISABLED
;
DBUG_RETURN
(
TRUE
);
}
/*
...
...
sql/ha_archive.h
View file @
0ba8ca2a
...
...
@@ -105,6 +105,6 @@ public:
enum
thr_lock_type
lock_type
);
};
handlerton
*
archive_db_init
(
void
);
bool
archive_db_init
(
void
);
bool
archive_db_end
(
void
);
sql/ha_berkeley.cc
View file @
0ba8ca2a
...
...
@@ -109,6 +109,10 @@ static int berkeley_rollback(THD *thd, bool all);
handlerton
berkeley_hton
=
{
"BerkeleyDB"
,
SHOW_OPTION_YES
,
"Supports transactions and page-level locking"
,
DB_TYPE_BERKELEY_DB
,
berkeley_init
,
0
,
/* slot */
0
,
/* savepoint size */
berkeley_close_connection
,
...
...
@@ -135,10 +139,13 @@ typedef struct st_berkeley_trx_data {
/* General functions */
handlerton
*
berkeley_init
(
void
)
bool
berkeley_init
(
void
)
{
DBUG_ENTER
(
"berkeley_init"
);
if
(
have_berkeley_db
!=
SHOW_OPTION_YES
)
goto
error
;
if
(
!
berkeley_tmpdir
)
berkeley_tmpdir
=
mysql_tmpdir
;
if
(
!
berkeley_home
)
...
...
@@ -164,7 +171,7 @@ handlerton *berkeley_init(void)
berkeley_log_file_size
=
max
(
berkeley_log_file_size
,
10
*
1024
*
1024L
);
if
(
db_env_create
(
&
db_env
,
0
))
DBUG_RETURN
(
0
)
;
goto
error
;
db_env
->
set_errcall
(
db_env
,
berkeley_print_error
);
db_env
->
set_errpfx
(
db_env
,
"bdb"
);
db_env
->
set_noticecall
(
db_env
,
berkeley_noticecall
);
...
...
@@ -194,13 +201,17 @@ handlerton *berkeley_init(void)
{
db_env
->
close
(
db_env
,
0
);
db_env
=
0
;
DBUG_RETURN
(
0
)
;
goto
error
;
}
(
void
)
hash_init
(
&
bdb_open_tables
,
system_charset_info
,
32
,
0
,
0
,
(
hash_get_key
)
bdb_get_key
,
0
,
0
);
pthread_mutex_init
(
&
bdb_mutex
,
MY_MUTEX_INIT_FAST
);
DBUG_RETURN
(
&
berkeley_hton
);
DBUG_RETURN
(
FALSE
);
error:
have_berkeley_db
=
SHOW_OPTION_DISABLED
;
// If we couldn't use handler
berkeley_hton
.
state
=
SHOW_OPTION_DISABLED
;
DBUG_RETURN
(
TRUE
);
}
...
...
sql/ha_berkeley.h
View file @
0ba8ca2a
...
...
@@ -161,7 +161,7 @@ extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
extern
long
berkeley_lock_scan_time
;
extern
TYPELIB
berkeley_lock_typelib
;
handlerton
*
berkeley_init
(
void
);
bool
berkeley_init
(
void
);
bool
berkeley_end
(
void
);
bool
berkeley_flush_logs
(
void
);
int
berkeley_show_logs
(
Protocol
*
protocol
);
sql/ha_blackhole.cc
View file @
0ba8ca2a
...
...
@@ -28,6 +28,10 @@
handlerton
blackhole_hton
=
{
"BLACKHOLE"
,
SHOW_OPTION_YES
,
"/dev/null storage engine (anything you write to it disappears)"
,
DB_TYPE_BLACKHOLE_DB
,
NULL
,
0
,
/* slot */
0
,
/* savepoint size. */
NULL
,
/* close_connection */
...
...
sql/ha_federated.cc
View file @
0ba8ca2a
...
...
@@ -363,6 +363,33 @@ pthread_mutex_t federated_mutex; // This is the mutex we use to
static
int
federated_init
=
FALSE
;
// Variable for checking the
// init state of hash
/* Federated storage engine handlerton */
handlerton
federated_hton
=
{
"FEDERATED"
,
SHOW_OPTION_YES
,
"Federated MySQL storage engine"
,
DB_TYPE_FEDERATED_DB
,
federated_db_init
,
0
,
/* slot */
0
,
/* savepoint size. */
NULL
,
/* close_connection */
NULL
,
/* savepoint */
NULL
,
/* rollback to savepoint */
NULL
,
/* release savepoint */
NULL
,
/* commit */
NULL
,
/* rollback */
NULL
,
/* prepare */
NULL
,
/* recover */
NULL
,
/* commit_by_xid */
NULL
,
/* rollback_by_xid */
NULL
,
/* create_cursor_read_view */
NULL
,
/* set_cursor_read_view */
NULL
,
/* close_cursor_read_view */
HTON_ALTER_NOT_SUPPORTED
};
/* Function we use in the creation of our hash to get key. */
static
byte
*
federated_get_key
(
FEDERATED_SHARE
*
share
,
uint
*
length
,
...
...
@@ -386,10 +413,23 @@ static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
bool
federated_db_init
()
{
federated_init
=
1
;
VOID
(
pthread_mutex_init
(
&
federated_mutex
,
MY_MUTEX_INIT_FAST
));
return
(
hash_init
(
&
federated_open_tables
,
system_charset_info
,
32
,
0
,
0
,
(
hash_get_key
)
federated_get_key
,
0
,
0
));
DBUG_ENTER
(
"federated_db_init"
);
if
(
pthread_mutex_init
(
&
federated_mutex
,
MY_MUTEX_INIT_FAST
))
goto
error
;
if
(
hash_init
(
&
federated_open_tables
,
system_charset_info
,
32
,
0
,
0
,
(
hash_get_key
)
federated_get_key
,
0
,
0
))
{
VOID
(
pthread_mutex_destroy
(
&
federated_mutex
));
}
else
{
federated_init
=
TRUE
;
DBUG_RETURN
(
FALSE
);
}
error:
have_federated_db
=
SHOW_OPTION_DISABLED
;
// If we couldn't use handler
federated_hton
.
state
=
SHOW_OPTION_DISABLED
;
DBUG_RETURN
(
TRUE
);
}
...
...
@@ -694,29 +734,6 @@ error:
}
/* Federated storage engine handlerton */
handlerton
federated_hton
=
{
"FEDERATED"
,
0
,
/* slot */
0
,
/* savepoint size. */
NULL
,
/* close_connection */
NULL
,
/* savepoint */
NULL
,
/* rollback to savepoint */
NULL
,
/* release savepoint */
NULL
,
/* commit */
NULL
,
/* rollback */
NULL
,
/* prepare */
NULL
,
/* recover */
NULL
,
/* commit_by_xid */
NULL
,
/* rollback_by_xid */
NULL
,
/* create_cursor_read_view */
NULL
,
/* set_cursor_read_view */
NULL
,
/* close_cursor_read_view */
HTON_ALTER_NOT_SUPPORTED
};
/*****************************************************************************
** FEDERATED tables
*****************************************************************************/
...
...
sql/ha_heap.cc
View file @
0ba8ca2a
...
...
@@ -25,6 +25,10 @@
handlerton
heap_hton
=
{
"MEMORY"
,
SHOW_OPTION_YES
,
"Hash based, stored in memory, useful for temporary tables"
,
DB_TYPE_HEAP
,
NULL
,
0
,
/* slot */
0
,
/* savepoint size. */
NULL
,
/* close_connection */
...
...
sql/ha_innodb.cc
View file @
0ba8ca2a
...
...
@@ -208,6 +208,10 @@ static int innobase_release_savepoint(THD* thd, void *savepoint);
handlerton
innobase_hton
=
{
"InnoDB"
,
SHOW_OPTION_YES
,
"Supports transactions, row-level locking, and foreign keys"
,
DB_TYPE_INNODB
,
innobase_init
,
0
,
/* slot */
sizeof
(
trx_named_savept_t
),
/* savepoint size. TODO: use it */
innobase_close_connection
,
...
...
@@ -1188,7 +1192,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
/*************************************************************************
Opens an InnoDB database. */
handlerton
*
bool
innobase_init
(
void
)
/*===============*/
/* out: &innobase_hton, or NULL on error */
...
...
@@ -1200,6 +1204,9 @@ innobase_init(void)
DBUG_ENTER
(
"innobase_init"
);
if
(
have_innodb
!=
SHOW_OPTION_YES
)
goto
error
;
ut_a
(
DATA_MYSQL_TRUE_VARCHAR
==
(
ulint
)
MYSQL_TYPE_VARCHAR
);
os_innodb_umask
=
(
ulint
)
my_umask
;
...
...
@@ -1267,7 +1274,7 @@ innobase_init(void)
"InnoDB: syntax error in innodb_data_file_path"
);
my_free
(
internal_innobase_data_file_path
,
MYF
(
MY_ALLOW_ZERO_PTR
));
DBUG_RETURN
(
0
)
;
goto
error
;
}
/* -------------- Log files ---------------------------*/
...
...
@@ -1298,7 +1305,7 @@ innobase_init(void)
my_free
(
internal_innobase_data_file_path
,
MYF
(
MY_ALLOW_ZERO_PTR
));
DBUG_RETURN
(
0
)
;
goto
error
;
}
/* --------------------------------------------------*/
...
...
@@ -1386,7 +1393,7 @@ innobase_init(void)
if
(
err
!=
DB_SUCCESS
)
{
my_free
(
internal_innobase_data_file_path
,
MYF
(
MY_ALLOW_ZERO_PTR
));
DBUG_RETURN
(
0
)
;
goto
error
;
}
(
void
)
hash_init
(
&
innobase_open_tables
,
system_charset_info
,
32
,
0
,
0
,
...
...
@@ -1413,7 +1420,11 @@ innobase_init(void)
glob_mi.pos = trx_sys_mysql_master_log_pos;
}
*/
DBUG_RETURN
(
&
innobase_hton
);
DBUG_RETURN
(
FALSE
);
error:
have_innodb
=
SHOW_OPTION_DISABLED
;
// If we couldn't use handler
innobase_hton
.
state
=
SHOW_OPTION_DISABLED
;
DBUG_RETURN
(
TRUE
);
}
/***********************************************************************
...
...
sql/ha_innodb.h
View file @
0ba8ca2a
...
...
@@ -241,7 +241,7 @@ extern ulong srv_commit_concurrency;
extern
TYPELIB
innobase_lock_typelib
;
handlerton
*
innobase_init
(
void
);
bool
innobase_init
(
void
);
bool
innobase_end
(
void
);
bool
innobase_flush_logs
(
void
);
uint
innobase_get_free_space
(
void
);
...
...
sql/ha_myisam.cc
View file @
0ba8ca2a
...
...
@@ -54,6 +54,10 @@ TYPELIB myisam_stats_method_typelib= {
handlerton
myisam_hton
=
{
"MyISAM"
,
SHOW_OPTION_YES
,
"Default engine as of MySQL 3.23 with great performance"
,
DB_TYPE_MYISAM
,
NULL
,
0
,
/* slot */
0
,
/* savepoint size. */
NULL
,
/* close_connection */
...
...
sql/ha_myisammrg.cc
View file @
0ba8ca2a
...
...
@@ -36,6 +36,10 @@
handlerton
myisammrg_hton
=
{
"MRG_MYISAM"
,
SHOW_OPTION_YES
,
"Collection of identical MyISAM tables"
,
DB_TYPE_MRG_MYISAM
,
NULL
,
0
,
/* slot */
0
,
/* savepoint size. */
NULL
,
/* close_connection */
...
...
sql/ha_ndbcluster.cc
View file @
0ba8ca2a
...
...
@@ -51,6 +51,10 @@ static int ndbcluster_rollback(THD *thd, bool all);
handlerton
ndbcluster_hton
=
{
"ndbcluster"
,
SHOW_OPTION_YES
,
"Clustered, fault-tolerant, memory-based tables"
,
DB_TYPE_NDBCLUSTER
,
ndbcluster_init
,
0
,
/* slot */
0
,
/* savepoint size */
ndbcluster_close_connection
,
...
...
@@ -4735,11 +4739,14 @@ static int connect_callback()
return
0
;
}
handlerton
*
ndbcluster_init
()
bool
ndbcluster_init
()
{
int
res
;
DBUG_ENTER
(
"ndbcluster_init"
);
if
(
have_ndbcluster
!=
SHOW_OPTION_YES
)
goto
ndbcluster_init_error
;
// Set connectstring if specified
if
(
opt_ndbcluster_connectstring
!=
0
)
DBUG_PRINT
(
"connectstring"
,
(
"%s"
,
opt_ndbcluster_connectstring
));
...
...
@@ -4820,16 +4827,18 @@ ndbcluster_init()
}
ndbcluster_inited
=
1
;
DBUG_RETURN
(
&
ndbcluster_hton
);
DBUG_RETURN
(
FALSE
);
ndbcluster_init_error:
ndbcluster_init_error:
if
(
g_ndb
)
delete
g_ndb
;
g_ndb
=
NULL
;
if
(
g_ndb_cluster_connection
)
delete
g_ndb_cluster_connection
;
g_ndb_cluster_connection
=
NULL
;
DBUG_RETURN
(
NULL
);
have_ndbcluster
=
SHOW_OPTION_DISABLED
;
// If we couldn't use handler
ndbcluster_hton
.
state
=
SHOW_OPTION_DISABLED
;
DBUG_RETURN
(
TRUE
);
}
...
...
sql/ha_ndbcluster.h
View file @
0ba8ca2a
...
...
@@ -716,7 +716,7 @@ private:
extern
struct
show_var_st
ndb_status_variables
[];
handlerton
*
ndbcluster_init
(
void
);
bool
ndbcluster_init
(
void
);
bool
ndbcluster_end
(
void
);
int
ndbcluster_discover
(
THD
*
thd
,
const
char
*
dbname
,
const
char
*
name
,
...
...
sql/handler.cc
View file @
0ba8ca2a
...
...
@@ -63,6 +63,7 @@ extern handlerton federated_hton;
extern
handlerton
myisam_hton
;
extern
handlerton
myisammrg_hton
;
extern
handlerton
heap_hton
;
extern
handlerton
binlog_hton
;
/* static functions defined in this file */
...
...
@@ -80,41 +81,38 @@ ulong total_ha_2pc;
ulong
savepoint_alloc_size
;
/*
This
structure will go away in the future
.
This
array is used for processing compiled in engines
.
*/
struct
show_table_type_st
sys_table_types
[]
=
{
{
"MyISAM"
,
&
have_yes
,
"Default engine as of MySQL 3.23 with great performance"
,
DB_TYPE_MYISAM
,
NULL
},
{
"MEMORY"
,
&
have_yes
,
"Hash based, stored in memory, useful for temporary tables"
,
DB_TYPE_HEAP
,
NULL
},
{
"MRG_MYISAM"
,
&
have_yes
,
"Collection of identical MyISAM tables"
,
DB_TYPE_MRG_MYISAM
,
NULL
},
{
"ISAM"
,
&
have_isam
,
"Obsolete storage engine, now replaced by MyISAM"
,
DB_TYPE_ISAM
,
NULL
},
{
"MRG_ISAM"
,
&
have_isam
,
"Obsolete storage engine, now replaced by MERGE"
,
DB_TYPE_MRG_ISAM
,
NULL
},
{
"InnoDB"
,
&
have_innodb
,
"Supports transactions, row-level locking, and foreign keys"
,
DB_TYPE_INNODB
,
NULL
},
{
"BERKELEYDB"
,
&
have_berkeley_db
,
"Supports transactions and page-level locking"
,
DB_TYPE_BERKELEY_DB
,
NULL
},
{
"NDBCLUSTER"
,
&
have_ndbcluster
,
"Clustered, fault-tolerant, memory-based tables"
,
DB_TYPE_NDBCLUSTER
,
NULL
},
{
"EXAMPLE"
,
&
have_example_db
,
"Example storage engine"
,
DB_TYPE_EXAMPLE_DB
,
NULL
},
{
"ARCHIVE"
,
&
have_archive_db
,
"Archive storage engine"
,
DB_TYPE_ARCHIVE_DB
,
NULL
},
{
"CSV"
,
&
have_csv_db
,
"CSV storage engine"
,
DB_TYPE_CSV_DB
,
NULL
},
{
"FEDERATED"
,
&
have_federated_db
,
"Federated MySQL storage engine"
,
DB_TYPE_FEDERATED_DB
,
NULL
},
{
"BLACKHOLE"
,
&
have_blackhole_db
,
"/dev/null storage engine (anything you write to it disappears)"
,
DB_TYPE_BLACKHOLE_DB
,
NULL
},
{
NullS
,
NULL
,
NullS
,
DB_TYPE_UNKNOWN
,
NULL
}
handlerton
*
sys_table_types
[]
=
{
&
myisam_hton
,
&
heap_hton
,
#ifdef HAVE_INNOBASE_DB
&
innobase_hton
,
#endif
#ifdef HAVE_BERKELEY_DB
&
berkeley_hton
,
#endif
#ifdef HAVE_BLACKHOLE_DB
&
blackhole_hton
,
#endif
#ifdef HAVE_EXAMPLE_DB
&
example_hton
,
#endif
#ifdef HAVE_ARCHIVE_DB
&
archive_hton
,
#endif
#ifdef HAVE_CSV_DB
&
tina_hton
,
#endif
#ifdef HAVE_NDBCLUSTER_DB
&
ndbcluster_hton
,
#endif
#ifdef HAVE_FEDERATED_DB
&
federated_hton
,
#endif
&
myisammrg_hton
,
NULL
};
struct
show_table_alias_st
sys_table_aliases
[]
=
...
...
@@ -144,17 +142,17 @@ enum db_type ha_resolve_by_name(const char *name, uint namelen)
{
THD
*
thd
=
current_thd
;
show_table_alias_st
*
table_alias
;
show_table_type_st
*
types
;
handlerton
*
*
types
;
const
char
*
ptr
=
name
;
if
(
thd
&&
!
my_strcasecmp
(
&
my_charset_latin1
,
ptr
,
"DEFAULT"
))
return
(
enum
db_type
)
thd
->
variables
.
table_type
;
retest:
for
(
types
=
sys_table_types
;
types
->
type
;
types
++
)
for
(
types
=
sys_table_types
;
*
types
;
types
++
)
{
if
(
!
my_strcasecmp
(
&
my_charset_latin1
,
ptr
,
types
->
typ
e
))
return
(
enum
db_type
)
types
->
db_type
;
if
(
!
my_strcasecmp
(
&
my_charset_latin1
,
ptr
,
(
*
types
)
->
nam
e
))
return
(
enum
db_type
)
(
*
types
)
->
db_type
;
}
/*
...
...
@@ -173,11 +171,11 @@ retest:
}
const
char
*
ha_get_storage_engine
(
enum
db_type
db_type
)
{
show_table_type_st
*
types
;
for
(
types
=
sys_table_types
;
types
->
type
;
types
++
)
handlerton
*
*
types
;
for
(
types
=
sys_table_types
;
*
types
;
types
++
)
{
if
(
db_type
==
types
->
db_type
)
return
types
->
typ
e
;
if
(
db_type
==
(
*
types
)
->
db_type
)
return
(
*
types
)
->
nam
e
;
}
return
"none"
;
...
...
@@ -203,18 +201,18 @@ bool ha_check_storage_engine_flag(enum db_type db_type, uint32 flag)
my_bool
ha_storage_engine_is_enabled
(
enum
db_type
database_type
)
{
show_table_type_st
*
types
;
for
(
types
=
sys_table_types
;
types
->
type
;
types
++
)
handlerton
*
*
types
;
for
(
types
=
sys_table_types
;
*
types
;
types
++
)
{
if
((
database_type
==
types
->
db_type
)
&&
(
*
types
->
valu
e
==
SHOW_OPTION_YES
))
if
((
database_type
==
(
*
types
)
->
db_type
)
&&
(
(
*
types
)
->
stat
e
==
SHOW_OPTION_YES
))
return
TRUE
;
}
return
FALSE
;
}
/* Use other database handler if databasehandler is not incompiled
*/
/* Use other database handler if databasehandler is not compiled in
*/
enum
db_type
ha_checktype
(
THD
*
thd
,
enum
db_type
database_type
,
bool
no_substitute
,
bool
report_error
)
...
...
@@ -412,7 +410,7 @@ int ha_init()
{
int
error
=
0
;
handlerton
**
ht
=
handlertons
;
show_table_type_st
*
types
;
handlerton
*
*
types
;
show_table_alias_st
*
table_alias
;
total_ha
=
savepoint_alloc_size
=
0
;
...
...
@@ -422,132 +420,35 @@ int ha_init()
/*
This will go away soon.
*/
for
(
types
=
sys_table_types
;
types
->
type
;
types
++
)
for
(
types
=
sys_table_types
;
*
types
;
types
++
)
{
switch
(
types
->
db_type
)
{
case
DB_TYPE_HEAP
:
types
->
ht
=
&
heap_hton
;
break
;
case
DB_TYPE_MYISAM
:
types
->
ht
=
&
myisam_hton
;
break
;
case
DB_TYPE_MRG_MYISAM
:
types
->
ht
=
&
myisammrg_hton
;
break
;
#ifdef HAVE_BERKELEY_DB
case
DB_TYPE_BERKELEY_DB
:
if
(
have_berkeley_db
==
SHOW_OPTION_YES
)
{
if
(
!
(
*
ht
=
berkeley_init
()))
{
have_berkeley_db
=
SHOW_OPTION_DISABLED
;
// If we couldn't use handler
error
=
1
;
}
else
{
types
->
ht
=
&
berkeley_hton
;
ha_was_inited_ok
(
ht
++
);
}
}
break
;
#endif
#ifdef HAVE_INNOBASE_DB
case
DB_TYPE_INNODB
:
if
(
have_innodb
==
SHOW_OPTION_YES
)
{
if
(
!
(
*
ht
=
innobase_init
()))
{
have_innodb
=
SHOW_OPTION_DISABLED
;
// If we couldn't use handler
error
=
1
;
}
else
{
ha_was_inited_ok
(
ht
++
);
types
->
ht
=
&
innobase_hton
;
}
}
break
;
#endif
#ifdef HAVE_NDBCLUSTER_DB
case
DB_TYPE_NDBCLUSTER
:
if
(
have_ndbcluster
==
SHOW_OPTION_YES
)
{
if
(
!
(
*
ht
=
ndbcluster_init
()))
{
have_ndbcluster
=
SHOW_OPTION_DISABLED
;
error
=
1
;
}
else
{
ha_was_inited_ok
(
ht
++
);
types
->
ht
=
&
ndbcluster_hton
;
}
}
break
;
#endif
#ifdef HAVE_EXAMPLE_DB
case
DB_TYPE_EXAMPLE_DB
:
types
->
ht
=
&
example_hton
;
break
;
#endif
#ifdef HAVE_ARCHIVE_DB
case
DB_TYPE_ARCHIVE_DB
:
if
(
have_archive_db
==
SHOW_OPTION_YES
)
{
if
(
!
(
*
ht
=
archive_db_init
()))
{
have_archive_db
=
SHOW_OPTION_DISABLED
;
error
=
1
;
}
else
{
ha_was_inited_ok
(
ht
++
);
types
->
ht
=
&
archive_hton
;
}
}
break
;
#endif
#ifdef HAVE_CSV_DB
case
DB_TYPE_CSV_DB
:
types
->
ht
=
&
tina_hton
;
break
;
#endif
#ifdef HAVE_FEDERATED_DB
case
DB_TYPE_FEDERATED_DB
:
if
(
have_federated_db
==
SHOW_OPTION_YES
)
{
if
(
federated_db_init
())
{
have_federated_db
=
SHOW_OPTION_DISABLED
;
error
=
1
;
}
else
{
types
->
ht
=
&
federated_hton
;
}
}
break
;
#endif
#ifdef HAVE_BLACKHOLE_DB
case
DB_TYPE_BLACKHOLE_DB
:
types
->
ht
=
&
blackhole_hton
;
break
;
#endif
default:
types
->
ht
=
NULL
;
/*
FUTURE -
We need to collapse sys_table_types and handlertons variables into
one variable.
*/
*
ht
=
*
types
;
ht
++
;
if
((
*
types
)
->
init
)
{
if
(
!
(
*
types
)
->
init
())
ha_was_inited_ok
(
types
);
}
}
if
(
opt_bin_log
)
{
if
(
!
(
*
ht
=
binlog_init
()))
// Always succeed
if
(
0
)
// Should fail until binlog is a bit more se like
{
mysql_bin_log
.
close
(
LOG_CLOSE_INDEX
);
// Never used
opt_bin_log
=
0
;
// Never used
error
=
1
;
// Never used
}
else
ha_was_inited_ok
(
ht
++
);
{
*
types
=
&
binlog_hton
;
ha_was_inited_ok
(
types
);
}
}
DBUG_ASSERT
(
total_ha
<
MAX_HA
);
/*
...
...
@@ -2542,7 +2443,7 @@ TYPELIB *ha_known_exts(void)
{
if
(
!
known_extensions
.
type_names
||
mysys_usage_id
!=
known_extensions_id
)
{
show_table_type_st
*
types
;
handlerton
*
*
types
;
List
<
char
>
found_exts
;
List_iterator_fast
<
char
>
it
(
found_exts
);
const
char
**
ext
,
*
old_ext
;
...
...
@@ -2550,11 +2451,11 @@ TYPELIB *ha_known_exts(void)
known_extensions_id
=
mysys_usage_id
;
found_exts
.
push_back
((
char
*
)
triggers_file_ext
);
found_exts
.
push_back
((
char
*
)
trigname_file_ext
);
for
(
types
=
sys_table_types
;
types
->
type
;
types
++
)
for
(
types
=
sys_table_types
;
*
types
;
types
++
)
{
if
(
*
types
->
valu
e
==
SHOW_OPTION_YES
)
if
(
(
*
types
)
->
stat
e
==
SHOW_OPTION_YES
)
{
handler
*
file
=
get_new_handler
(
0
,(
enum
db_type
)
types
->
db_type
);
handler
*
file
=
get_new_handler
(
0
,(
enum
db_type
)
(
*
types
)
->
db_type
);
for
(
ext
=
file
->
bas_ext
();
*
ext
;
ext
++
)
{
while
((
old_ext
=
it
++
))
...
...
sql/handler.h
View file @
0ba8ca2a
...
...
@@ -304,6 +304,27 @@ typedef struct
storage engine name as it should be printed to a user
*/
const
char
*
name
;
/*
Historical marker for if the engine is available of not
*/
SHOW_COMP_OPTION
state
;
/*
A comment used by SHOW to describe an engine.
*/
const
char
*
comment
;
/*
Historical number used for frm file to determine the correct storage engine.
This is going away and new engines will just use "name" for this.
*/
enum
db_type
db_type
;
/*
Method that initizlizes a storage engine
*/
bool
(
*
init
)();
/*
each storage engine has it's own memory area (actually a pointer)
in the thd, for storing per-connection information.
...
...
@@ -363,14 +384,6 @@ typedef struct
uint32
flags
;
/* global handler flags */
}
handlerton
;
struct
show_table_type_st
{
const
char
*
type
;
SHOW_COMP_OPTION
*
value
;
const
char
*
comment
;
enum
db_type
db_type
;
handlerton
*
ht
;
};
struct
show_table_alias_st
{
const
char
*
alias
;
const
char
*
type
;
...
...
@@ -837,7 +850,7 @@ public:
/* Some extern variables used with handlers */
extern
struct
show_table_type_st
sys_table_types
[];
extern
handlerton
*
sys_table_types
[];
extern
const
char
*
ha_row_type
[];
extern
TYPELIB
tx_isolation_typelib
;
extern
TYPELIB
myisam_stats_method_typelib
;
...
...
sql/log.cc
View file @
0ba8ca2a
...
...
@@ -38,6 +38,7 @@ ulong sync_binlog_counter= 0;
static
bool
test_if_number
(
const
char
*
str
,
long
*
res
,
bool
allow_wildcards
);
static
bool
binlog_init
();
static
int
binlog_close_connection
(
THD
*
thd
);
static
int
binlog_savepoint_set
(
THD
*
thd
,
void
*
sv
);
static
int
binlog_savepoint_rollback
(
THD
*
thd
,
void
*
sv
);
...
...
@@ -45,8 +46,12 @@ static int binlog_commit(THD *thd, bool all);
static
int
binlog_rollback
(
THD
*
thd
,
bool
all
);
static
int
binlog_prepare
(
THD
*
thd
,
bool
all
);
static
handlerton
binlog_hton
=
{
handlerton
binlog_hton
=
{
"binlog"
,
SHOW_OPTION_YES
,
"This is a meta storage engine to represent the binlog in a transaction"
,
DB_TYPE_UNKNOWN
,
/* IGNORE for now */
binlog_init
,
0
,
sizeof
(
my_off_t
),
/* savepoint size = binlog offset */
binlog_close_connection
,
...
...
@@ -71,9 +76,9 @@ static handlerton binlog_hton = {
should be moved here.
*/
handlerton
*
binlog_init
()
bool
binlog_init
()
{
return
&
binlog_hton
;
return
false
;
}
static
int
binlog_close_connection
(
THD
*
thd
)
...
...
sql/mysql_priv.h
View file @
0ba8ca2a
...
...
@@ -1069,7 +1069,6 @@ bool fn_format_relative_to_data_home(my_string to, const char *name,
const
char
*
dir
,
const
char
*
extension
);
File
open_binlog
(
IO_CACHE
*
log
,
const
char
*
log_file_name
,
const
char
**
errmsg
);
handlerton
*
binlog_init
();
/* mysqld.cc */
extern
void
yyerror
(
const
char
*
);
...
...
sql/sql_show.cc
View file @
0ba8ca2a
...
...
@@ -67,18 +67,18 @@ bool mysqld_show_storage_engines(THD *thd)
const
char
*
default_type_name
=
ha_get_storage_engine
((
enum
db_type
)
thd
->
variables
.
table_type
);
show_table_type_st
*
types
;
for
(
types
=
sys_table_types
;
types
->
type
;
types
++
)
handlerton
*
*
types
;
for
(
types
=
sys_table_types
;
*
types
;
types
++
)
{
protocol
->
prepare_for_resend
();
protocol
->
store
(
types
->
typ
e
,
system_charset_info
);
const
char
*
option_name
=
show_comp_option_name
[(
int
)
*
types
->
valu
e
];
protocol
->
store
(
(
*
types
)
->
nam
e
,
system_charset_info
);
const
char
*
option_name
=
show_comp_option_name
[(
int
)
(
*
types
)
->
stat
e
];
if
(
*
types
->
valu
e
==
SHOW_OPTION_YES
&&
!
my_strcasecmp
(
system_charset_info
,
default_type_name
,
types
->
typ
e
))
if
(
(
*
types
)
->
stat
e
==
SHOW_OPTION_YES
&&
!
my_strcasecmp
(
system_charset_info
,
default_type_name
,
(
*
types
)
->
nam
e
))
option_name
=
"DEFAULT"
;
protocol
->
store
(
option_name
,
system_charset_info
);
protocol
->
store
(
types
->
comment
,
system_charset_info
);
protocol
->
store
(
(
*
types
)
->
comment
,
system_charset_info
);
if
(
protocol
->
write
())
DBUG_RETURN
(
TRUE
);
}
...
...
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