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
7720348b
Commit
7720348b
authored
Nov 11, 2002
by
serg@serg.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed DBUG_ENTER/RETURN tags
parent
b0f5c6d6
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
489 additions
and
973 deletions
+489
-973
sql/ha_myisam.cc
sql/ha_myisam.cc
+79
-166
sql/ha_myisammrg.cc
sql/ha_myisammrg.cc
+26
-77
sql/handler.cc
sql/handler.cc
+36
-95
sql/opt_range.cc
sql/opt_range.cc
+116
-234
sql/sql_select.cc
sql/sql_select.cc
+232
-401
No files found.
sql/ha_myisam.cc
View file @
7720348b
This diff is collapsed.
Click to expand it.
sql/ha_myisammrg.cc
View file @
7720348b
...
@@ -38,14 +38,12 @@ const char **ha_myisammrg::bas_ext() const
...
@@ -38,14 +38,12 @@ const char **ha_myisammrg::bas_ext() const
int
ha_myisammrg
::
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
)
int
ha_myisammrg
::
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
)
{
{
char
name_buff
[
FN_REFLEN
];
char
name_buff
[
FN_REFLEN
];
DBUG_ENTER
(
"ha_myisammrg::open"
);
DBUG_PRINT
(
"info"
,
(
"ha_myisammrg::open"
));
DBUG_PRINT
(
"info"
,
(
"ha_myisammrg::open"
));
if
(
!
(
file
=
myrg_open
(
fn_format
(
name_buff
,
name
,
""
,
""
,
2
|
4
),
mode
,
if
(
!
(
file
=
myrg_open
(
fn_format
(
name_buff
,
name
,
""
,
""
,
2
|
4
),
mode
,
test_if_locked
)))
test_if_locked
)))
{
{
DBUG_PRINT
(
"info"
,
(
"ha_myisammrg::open exit %d"
,
my_errno
));
DBUG_PRINT
(
"info"
,
(
"ha_myisammrg::open exit %d"
,
my_errno
));
DBUG_RETURN
((
my_errno
?
my_errno
:
-
1
)
);
return
(
my_errno
?
my_errno
:
-
1
);
}
}
DBUG_PRINT
(
"info"
,
(
"ha_myisammrg::open myrg_extrafunc..."
))
DBUG_PRINT
(
"info"
,
(
"ha_myisammrg::open myrg_extrafunc..."
))
myrg_extrafunc
(
file
,
query_cache_invalidate_by_MyISAM_filename_ref
);
myrg_extrafunc
(
file
,
query_cache_invalidate_by_MyISAM_filename_ref
);
...
@@ -67,165 +65,132 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
...
@@ -67,165 +65,132 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
if
(
table
->
crashed
)
if
(
table
->
crashed
)
goto
err
;
goto
err
;
#endif
#endif
DBUG_RETURN
((
0
)
);
return
(
0
);
err:
err:
myrg_close
(
file
);
myrg_close
(
file
);
file
=
0
;
file
=
0
;
DBUG_RETURN
((
my_errno
=
HA_ERR_WRONG_TABLE_DEF
)
);
return
(
my_errno
=
HA_ERR_WRONG_TABLE_DEF
);
}
}
int
ha_myisammrg
::
close
(
void
)
int
ha_myisammrg
::
close
(
void
)
{
{
DBUG_ENTER
(
"ha_myisammrg::close"
);
return
myrg_close
(
file
);
DBUG_RETURN
(
myrg_close
(
file
));
}
}
int
ha_myisammrg
::
write_row
(
byte
*
buf
)
int
ha_myisammrg
::
write_row
(
byte
*
buf
)
{
{
DBUG_ENTER
(
"ha_myisammrg::write_row"
);
statistic_increment
(
ha_write_count
,
&
LOCK_status
);
statistic_increment
(
ha_write_count
,
&
LOCK_status
);
if
(
table
->
time_stamp
)
if
(
table
->
time_stamp
)
update_timestamp
(
buf
+
table
->
time_stamp
-
1
);
update_timestamp
(
buf
+
table
->
time_stamp
-
1
);
if
(
table
->
next_number_field
&&
buf
==
table
->
record
[
0
])
if
(
table
->
next_number_field
&&
buf
==
table
->
record
[
0
])
update_auto_increment
();
update_auto_increment
();
DBUG_RETURN
(
myrg_write
(
file
,
buf
)
);
return
myrg_write
(
file
,
buf
);
}
}
int
ha_myisammrg
::
update_row
(
const
byte
*
old_data
,
byte
*
new_data
)
int
ha_myisammrg
::
update_row
(
const
byte
*
old_data
,
byte
*
new_data
)
{
{
DBUG_ENTER
(
"ha_myisammrg::update_row"
);
statistic_increment
(
ha_update_count
,
&
LOCK_status
);
statistic_increment
(
ha_update_count
,
&
LOCK_status
);
if
(
table
->
time_stamp
)
if
(
table
->
time_stamp
)
update_timestamp
(
new_data
+
table
->
time_stamp
-
1
);
update_timestamp
(
new_data
+
table
->
time_stamp
-
1
);
DBUG_RETURN
(
myrg_update
(
file
,
old_data
,
new_data
)
);
return
myrg_update
(
file
,
old_data
,
new_data
);
}
}
int
ha_myisammrg
::
delete_row
(
const
byte
*
buf
)
int
ha_myisammrg
::
delete_row
(
const
byte
*
buf
)
{
{
DBUG_ENTER
(
"ha_myisammrg::delete_row"
);
statistic_increment
(
ha_delete_count
,
&
LOCK_status
);
statistic_increment
(
ha_delete_count
,
&
LOCK_status
);
DBUG_RETURN
(
myrg_delete
(
file
,
buf
)
);
return
myrg_delete
(
file
,
buf
);
}
}
int
ha_myisammrg
::
index_read
(
byte
*
buf
,
const
byte
*
key
,
int
ha_myisammrg
::
index_read
(
byte
*
buf
,
const
byte
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
)
uint
key_len
,
enum
ha_rkey_function
find_flag
)
{
{
DBUG_ENTER
(
"ha_myisammrg::index_read"
);
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
int
error
=
myrg_rkey
(
file
,
buf
,
active_index
,
key
,
key_len
,
find_flag
);
int
error
=
myrg_rkey
(
file
,
buf
,
active_index
,
key
,
key_len
,
find_flag
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
int
ha_myisammrg
::
index_read_idx
(
byte
*
buf
,
uint
index
,
const
byte
*
key
,
int
ha_myisammrg
::
index_read_idx
(
byte
*
buf
,
uint
index
,
const
byte
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
)
uint
key_len
,
enum
ha_rkey_function
find_flag
)
{
{
DBUG_ENTER
(
"ha_myisammrg::index_read_idx"
);
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
int
error
=
myrg_rkey
(
file
,
buf
,
index
,
key
,
key_len
,
find_flag
);
int
error
=
myrg_rkey
(
file
,
buf
,
index
,
key
,
key_len
,
find_flag
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
int
ha_myisammrg
::
index_read_last
(
byte
*
buf
,
const
byte
*
key
,
uint
key_len
)
int
ha_myisammrg
::
index_read_last
(
byte
*
buf
,
const
byte
*
key
,
uint
key_len
)
{
{
DBUG_ENTER
(
"ha_myisammrg::index_read_last"
);
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
int
error
=
myrg_rkey
(
file
,
buf
,
active_index
,
key
,
key_len
,
int
error
=
myrg_rkey
(
file
,
buf
,
active_index
,
key
,
key_len
,
HA_READ_PREFIX_LAST
);
HA_READ_PREFIX_LAST
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
int
ha_myisammrg
::
index_next
(
byte
*
buf
)
int
ha_myisammrg
::
index_next
(
byte
*
buf
)
{
{
DBUG_ENTER
(
"ha_myisammrg::index_next"
);
statistic_increment
(
ha_read_next_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_next_count
,
&
LOCK_status
);
int
error
=
myrg_rnext
(
file
,
buf
,
active_index
);
int
error
=
myrg_rnext
(
file
,
buf
,
active_index
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
int
ha_myisammrg
::
index_prev
(
byte
*
buf
)
int
ha_myisammrg
::
index_prev
(
byte
*
buf
)
{
{
DBUG_ENTER
(
"ha_myisammrg::index_prev"
);
statistic_increment
(
ha_read_prev_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_prev_count
,
&
LOCK_status
);
int
error
=
myrg_rprev
(
file
,
buf
,
active_index
);
int
error
=
myrg_rprev
(
file
,
buf
,
active_index
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
int
ha_myisammrg
::
index_first
(
byte
*
buf
)
int
ha_myisammrg
::
index_first
(
byte
*
buf
)
{
{
DBUG_ENTER
(
"ha_myisammrg::index_first"
);
statistic_increment
(
ha_read_first_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_first_count
,
&
LOCK_status
);
int
error
=
myrg_rfirst
(
file
,
buf
,
active_index
);
int
error
=
myrg_rfirst
(
file
,
buf
,
active_index
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
int
ha_myisammrg
::
index_last
(
byte
*
buf
)
int
ha_myisammrg
::
index_last
(
byte
*
buf
)
{
{
DBUG_ENTER
(
"ha_myisammrg::index_last"
);
statistic_increment
(
ha_read_last_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_last_count
,
&
LOCK_status
);
int
error
=
myrg_rlast
(
file
,
buf
,
active_index
);
int
error
=
myrg_rlast
(
file
,
buf
,
active_index
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
int
ha_myisammrg
::
rnd_init
(
bool
scan
)
int
ha_myisammrg
::
rnd_init
(
bool
scan
)
{
{
DBUG_ENTER
(
"ha_myisammrg::rnd_init"
);
return
myrg_extra
(
file
,
HA_EXTRA_RESET
,
0
);
DBUG_RETURN
(
myrg_extra
(
file
,
HA_EXTRA_RESET
,
0
));
}
}
int
ha_myisammrg
::
rnd_next
(
byte
*
buf
)
int
ha_myisammrg
::
rnd_next
(
byte
*
buf
)
{
{
DBUG_ENTER
(
"ha_myisammrg::rnd_next"
);
statistic_increment
(
ha_read_rnd_next_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_rnd_next_count
,
&
LOCK_status
);
int
error
=
myrg_rrnd
(
file
,
buf
,
HA_OFFSET_ERROR
);
int
error
=
myrg_rrnd
(
file
,
buf
,
HA_OFFSET_ERROR
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
int
ha_myisammrg
::
rnd_pos
(
byte
*
buf
,
byte
*
pos
)
int
ha_myisammrg
::
rnd_pos
(
byte
*
buf
,
byte
*
pos
)
{
{
DBUG_ENTER
(
"ha_myisammrg::rnd_pos"
);
statistic_increment
(
ha_read_rnd_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_rnd_count
,
&
LOCK_status
);
int
error
=
myrg_rrnd
(
file
,
buf
,
ha_get_ptr
(
pos
,
ref_length
));
int
error
=
myrg_rrnd
(
file
,
buf
,
ha_get_ptr
(
pos
,
ref_length
));
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
void
ha_myisammrg
::
position
(
const
byte
*
record
)
void
ha_myisammrg
::
position
(
const
byte
*
record
)
{
{
ulonglong
position
=
myrg_position
(
file
);
ulonglong
position
=
myrg_position
(
file
);
DBUG_ENTER
(
"ha_myisammrg::position"
);
ha_store_ptr
(
ref
,
ref_length
,
(
my_off_t
)
position
);
ha_store_ptr
(
ref
,
ref_length
,
(
my_off_t
)
position
);
DBUG_VOID_RETURN
;
}
}
void
ha_myisammrg
::
info
(
uint
flag
)
void
ha_myisammrg
::
info
(
uint
flag
)
{
{
MYMERGE_INFO
info
;
MYMERGE_INFO
info
;
DBUG_ENTER
(
"ha_myisammrg::info"
);
(
void
)
myrg_status
(
file
,
&
info
,
flag
);
(
void
)
myrg_status
(
file
,
&
info
,
flag
);
/*
/*
The following fails if one has not compiled MySQL with -DBIG_TABLES
The following fails if one has not compiled MySQL with -DBIG_TABLES
...
@@ -251,20 +216,17 @@ void ha_myisammrg::info(uint flag)
...
@@ -251,20 +216,17 @@ void ha_myisammrg::info(uint flag)
#else
#else
ref_length
=
4
;
// Can't be > than my_off_t
ref_length
=
4
;
// Can't be > than my_off_t
#endif
#endif
DBUG_VOID_RETURN
;
}
}
int
ha_myisammrg
::
extra
(
enum
ha_extra_function
operation
)
int
ha_myisammrg
::
extra
(
enum
ha_extra_function
operation
)
{
{
DBUG_ENTER
(
"ha_myisammrg::extra"
);
/* As this is just a mapping, we don't have to force the underlying
/* As this is just a mapping, we don't have to force the underlying
tables to be closed */
tables to be closed */
if
(
operation
==
HA_EXTRA_FORCE_REOPEN
||
if
(
operation
==
HA_EXTRA_FORCE_REOPEN
||
operation
==
HA_EXTRA_PREPARE_FOR_DELETE
)
operation
==
HA_EXTRA_PREPARE_FOR_DELETE
)
DBUG_RETURN
(
0
)
;
return
0
;
DBUG_RETURN
(
myrg_extra
(
file
,
operation
,
0
)
);
return
myrg_extra
(
file
,
operation
,
0
);
}
}
...
@@ -272,35 +234,27 @@ int ha_myisammrg::extra(enum ha_extra_function operation)
...
@@ -272,35 +234,27 @@ int ha_myisammrg::extra(enum ha_extra_function operation)
int
ha_myisammrg
::
extra_opt
(
enum
ha_extra_function
operation
,
ulong
cache_size
)
int
ha_myisammrg
::
extra_opt
(
enum
ha_extra_function
operation
,
ulong
cache_size
)
{
{
DBUG_ENTER
(
"ha_myisammrg::extra_opt"
);
if
((
specialflag
&
SPECIAL_SAFE_MODE
)
&
if
((
specialflag
&
SPECIAL_SAFE_MODE
)
&
(
operation
==
HA_EXTRA_WRITE_CACHE
||
(
operation
==
HA_EXTRA_WRITE_CACHE
||
operation
==
HA_EXTRA_BULK_INSERT_BEGIN
))
operation
==
HA_EXTRA_BULK_INSERT_BEGIN
))
DBUG_RETURN
(
0
)
;
return
0
;
DBUG_RETURN
(
myrg_extra
(
file
,
operation
,
(
void
*
)
&
cache_size
)
);
return
myrg_extra
(
file
,
operation
,
(
void
*
)
&
cache_size
);
}
}
int
ha_myisammrg
::
reset
(
void
)
int
ha_myisammrg
::
reset
(
void
)
{
{
DBUG_ENTER
(
"ha_myisammrg::reset"
);
return
myrg_extra
(
file
,
HA_EXTRA_RESET
,
0
);
DBUG_RETURN
(
myrg_extra
(
file
,
HA_EXTRA_RESET
,
0
));
}
}
int
ha_myisammrg
::
external_lock
(
THD
*
thd
,
int
lock_type
)
int
ha_myisammrg
::
external_lock
(
THD
*
thd
,
int
lock_type
)
{
{
DBUG_ENTER
(
"ha_myisammrg::external_lock"
);
return
myrg_lock_database
(
file
,
lock_type
);
DBUG_RETURN
(
myrg_lock_database
(
file
,
lock_type
));
}
}
uint
ha_myisammrg
::
lock_count
(
void
)
const
uint
ha_myisammrg
::
lock_count
(
void
)
const
{
{
DBUG_ENTER
(
"ha_myisammrg::lock_count"
);
return
file
->
tables
;
DBUG_RETURN
(
file
->
tables
);
}
}
...
@@ -309,7 +263,6 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
...
@@ -309,7 +263,6 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
enum
thr_lock_type
lock_type
)
enum
thr_lock_type
lock_type
)
{
{
MYRG_TABLE
*
open_table
;
MYRG_TABLE
*
open_table
;
DBUG_ENTER
(
"**ha_myisammrg::store_lock"
);
for
(
open_table
=
file
->
open_tables
;
for
(
open_table
=
file
->
open_tables
;
open_table
!=
file
->
end_table
;
open_table
!=
file
->
end_table
;
...
@@ -319,14 +272,13 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
...
@@ -319,14 +272,13 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
if
(
lock_type
!=
TL_IGNORE
&&
open_table
->
table
->
lock
.
type
==
TL_UNLOCK
)
if
(
lock_type
!=
TL_IGNORE
&&
open_table
->
table
->
lock
.
type
==
TL_UNLOCK
)
open_table
->
table
->
lock
.
type
=
lock_type
;
open_table
->
table
->
lock
.
type
=
lock_type
;
}
}
DBUG_RETURN
(
to
)
;
return
to
;
}
}
void
ha_myisammrg
::
update_create_info
(
HA_CREATE_INFO
*
create_info
)
void
ha_myisammrg
::
update_create_info
(
HA_CREATE_INFO
*
create_info
)
{
{
DBUG_ENTER
(
"ha_myisammrg::update_create_info"
);
// [phi] auto_increment stuff is missing (but currently not needed)
// [phi] auto_increment stuff is missing (but currently not needed)
DBUG_ENTER
(
"ha_myisammrg::update_create_info"
);
if
(
!
(
create_info
->
used_fields
&
HA_CREATE_USED_UNION
))
if
(
!
(
create_info
->
used_fields
&
HA_CREATE_USED_UNION
))
{
{
MYRG_TABLE
*
open_table
;
MYRG_TABLE
*
open_table
;
...
@@ -407,8 +359,6 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
...
@@ -407,8 +359,6 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
void
ha_myisammrg
::
append_create_info
(
String
*
packet
)
void
ha_myisammrg
::
append_create_info
(
String
*
packet
)
{
{
char
buff
[
FN_REFLEN
];
char
buff
[
FN_REFLEN
];
DBUG_ENTER
(
"ha_myisammrg::append_create_info"
);
if
(
file
->
merge_insert_method
!=
MERGE_INSERT_DISABLED
)
if
(
file
->
merge_insert_method
!=
MERGE_INSERT_DISABLED
)
{
{
packet
->
append
(
" INSERT_METHOD="
,
15
);
packet
->
append
(
" INSERT_METHOD="
,
15
);
...
@@ -428,5 +378,4 @@ void ha_myisammrg::append_create_info(String *packet)
...
@@ -428,5 +378,4 @@ void ha_myisammrg::append_create_info(String *packet)
packet
->
append
(
buff
,(
uint
)
strlen
(
buff
));
packet
->
append
(
buff
,(
uint
)
strlen
(
buff
));
}
}
packet
->
append
(
')'
);
packet
->
append
(
')'
);
DBUG_VOID_RETURN
;
}
}
sql/handler.cc
View file @
7720348b
...
@@ -72,16 +72,14 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
...
@@ -72,16 +72,14 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
enum
db_type
ha_checktype
(
enum
db_type
database_type
)
enum
db_type
ha_checktype
(
enum
db_type
database_type
)
{
{
DBUG_ENTER
(
"ha_checktype"
);
switch
(
database_type
)
{
switch
(
database_type
)
{
#ifdef HAVE_BERKELEY_DB
#ifdef HAVE_BERKELEY_DB
case
DB_TYPE_BERKELEY_DB
:
case
DB_TYPE_BERKELEY_DB
:
DBUG_RETURN
((
berkeley_skip
?
DB_TYPE_MYISAM
:
database_type
)
);
return
(
berkeley_skip
?
DB_TYPE_MYISAM
:
database_type
);
#endif
#endif
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
case
DB_TYPE_INNODB
:
case
DB_TYPE_INNODB
:
DBUG_RETURN
((
innodb_skip
?
DB_TYPE_MYISAM
:
database_type
)
);
return
(
innodb_skip
?
DB_TYPE_MYISAM
:
database_type
);
#endif
#endif
#ifndef NO_HASH
#ifndef NO_HASH
case
DB_TYPE_HASH
:
case
DB_TYPE_HASH
:
...
@@ -93,57 +91,52 @@ enum db_type ha_checktype(enum db_type database_type)
...
@@ -93,57 +91,52 @@ enum db_type ha_checktype(enum db_type database_type)
case
DB_TYPE_HEAP
:
case
DB_TYPE_HEAP
:
case
DB_TYPE_MYISAM
:
case
DB_TYPE_MYISAM
:
case
DB_TYPE_MRG_MYISAM
:
case
DB_TYPE_MRG_MYISAM
:
DBUG_RETURN
((
database_type
)
);
/* Database exists on system */
return
(
database_type
);
/* Database exists on system */
default:
default:
break
;
break
;
}
}
DBUG_RETURN
((
DB_TYPE_MYISAM
)
);
/* Use this as default */
return
(
DB_TYPE_MYISAM
);
/* Use this as default */
}
/* ha_checktype */
}
/* ha_checktype */
handler
*
get_new_handler
(
TABLE
*
table
,
enum
db_type
db_type
)
handler
*
get_new_handler
(
TABLE
*
table
,
enum
db_type
db_type
)
{
{
DBUG_ENTER
(
"*get_new_handler"
);
switch
(
db_type
)
{
switch
(
db_type
)
{
#ifndef NO_HASH
#ifndef NO_HASH
DBUG_RETURN
(
new
ha_hash
(
table
)
);
return
new
ha_hash
(
table
);
#endif
#endif
#ifdef HAVE_ISAM
#ifdef HAVE_ISAM
case
DB_TYPE_MRG_ISAM
:
case
DB_TYPE_MRG_ISAM
:
DBUG_RETURN
(
new
ha_isammrg
(
table
)
);
return
new
ha_isammrg
(
table
);
case
DB_TYPE_ISAM
:
case
DB_TYPE_ISAM
:
DBUG_RETURN
(
new
ha_isam
(
table
)
);
return
new
ha_isam
(
table
);
#endif
#endif
#ifdef HAVE_BERKELEY_DB
#ifdef HAVE_BERKELEY_DB
case
DB_TYPE_BERKELEY_DB
:
case
DB_TYPE_BERKELEY_DB
:
DBUG_RETURN
(
new
ha_berkeley
(
table
)
);
return
new
ha_berkeley
(
table
);
#endif
#endif
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
case
DB_TYPE_INNODB
:
case
DB_TYPE_INNODB
:
DBUG_RETURN
(
new
ha_innobase
(
table
)
);
return
new
ha_innobase
(
table
);
#endif
#endif
case
DB_TYPE_HEAP
:
case
DB_TYPE_HEAP
:
DBUG_RETURN
(
new
ha_heap
(
table
)
);
return
new
ha_heap
(
table
);
case
DB_TYPE_MYISAM
:
case
DB_TYPE_MYISAM
:
default:
// should never happen
default:
// should never happen
DBUG_RETURN
(
new
ha_myisam
(
table
)
);
return
new
ha_myisam
(
table
);
case
DB_TYPE_MRG_MYISAM
:
case
DB_TYPE_MRG_MYISAM
:
DBUG_RETURN
(
new
ha_myisammrg
(
table
)
);
return
new
ha_myisammrg
(
table
);
}
}
DBUG_RETURN
(
NULL
);
// impossible
}
}
int
ha_init
()
int
ha_init
()
{
{
DBUG_ENTER
(
"ha_init"
);
#ifdef HAVE_BERKELEY_DB
#ifdef HAVE_BERKELEY_DB
if
(
!
berkeley_skip
)
if
(
!
berkeley_skip
)
{
{
int
error
;
int
error
;
if
((
error
=
berkeley_init
()))
if
((
error
=
berkeley_init
()))
DBUG_RETURN
(
error
)
;
return
error
;
if
(
!
berkeley_skip
)
// If we couldn't use handler
if
(
!
berkeley_skip
)
// If we couldn't use handler
opt_using_transactions
=
1
;
opt_using_transactions
=
1
;
else
else
...
@@ -154,14 +147,14 @@ int ha_init()
...
@@ -154,14 +147,14 @@ int ha_init()
if
(
!
innodb_skip
)
if
(
!
innodb_skip
)
{
{
if
(
innobase_init
())
if
(
innobase_init
())
DBUG_RETURN
(
-
1
)
;
return
-
1
;
if
(
!
innodb_skip
)
// If we couldn't use handler
if
(
!
innodb_skip
)
// If we couldn't use handler
opt_using_transactions
=
1
;
opt_using_transactions
=
1
;
else
else
have_innodb
=
SHOW_OPTION_DISABLED
;
have_innodb
=
SHOW_OPTION_DISABLED
;
}
}
#endif
#endif
DBUG_RETURN
(
0
)
;
return
0
;
}
}
/* close, flush or restart databases */
/* close, flush or restart databases */
...
@@ -170,8 +163,6 @@ int ha_init()
...
@@ -170,8 +163,6 @@ int ha_init()
int
ha_panic
(
enum
ha_panic_function
flag
)
int
ha_panic
(
enum
ha_panic_function
flag
)
{
{
int
error
=
0
;
int
error
=
0
;
DBUG_ENTER
(
"ha_panic"
);
#ifndef NO_HASH
#ifndef NO_HASH
error
|=
h_panic
(
flag
);
/* fix hash */
error
|=
h_panic
(
flag
);
/* fix hash */
#endif
#endif
...
@@ -190,29 +181,23 @@ int ha_panic(enum ha_panic_function flag)
...
@@ -190,29 +181,23 @@ int ha_panic(enum ha_panic_function flag)
if
(
!
innodb_skip
)
if
(
!
innodb_skip
)
error
|=
innobase_end
();
error
|=
innobase_end
();
#endif
#endif
DBUG_RETURN
(
error
)
;
return
error
;
}
/* ha_panic */
}
/* ha_panic */
void
ha_drop_database
(
char
*
path
)
void
ha_drop_database
(
char
*
path
)
{
{
DBUG_ENTER
(
"ha_drop_database"
);
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
if
(
!
innodb_skip
)
if
(
!
innodb_skip
)
innobase_drop_database
(
path
);
innobase_drop_database
(
path
);
#endif
#endif
DBUG_VOID_RETURN
;
}
}
void
ha_close_connection
(
THD
*
thd
)
void
ha_close_connection
(
THD
*
thd
)
{
{
DBUG_ENTER
(
"ha_close_connection"
);
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
if
(
!
innodb_skip
)
if
(
!
innodb_skip
)
innobase_close_connection
(
thd
);
innobase_close_connection
(
thd
);
#endif
#endif
DBUG_VOID_RETURN
;
}
}
/*
/*
...
@@ -262,8 +247,6 @@ int ha_report_binlog_offset_and_commit(THD *thd,
...
@@ -262,8 +247,6 @@ int ha_report_binlog_offset_and_commit(THD *thd,
my_off_t
end_offset
)
my_off_t
end_offset
)
{
{
int
error
=
0
;
int
error
=
0
;
DBUG_ENTER
(
"ha_report_binlog_offset_and_commit"
);
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
THD_TRANS
*
trans
;
THD_TRANS
*
trans
;
trans
=
&
thd
->
transaction
.
all
;
trans
=
&
thd
->
transaction
.
all
;
...
@@ -280,7 +263,7 @@ int ha_report_binlog_offset_and_commit(THD *thd,
...
@@ -280,7 +263,7 @@ int ha_report_binlog_offset_and_commit(THD *thd,
trans
->
innodb_active_trans
=
0
;
trans
->
innodb_active_trans
=
0
;
}
}
#endif
#endif
DBUG_RETURN
(
error
)
;
return
error
;
}
}
int
ha_commit_trans
(
THD
*
thd
,
THD_TRANS
*
trans
)
int
ha_commit_trans
(
THD
*
thd
,
THD_TRANS
*
trans
)
...
@@ -398,8 +381,6 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
...
@@ -398,8 +381,6 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
bool
ha_flush_logs
()
bool
ha_flush_logs
()
{
{
bool
result
=
0
;
bool
result
=
0
;
DBUG_ENTER
(
"ha_flush_logs"
);
#ifdef HAVE_BERKELEY_DB
#ifdef HAVE_BERKELEY_DB
if
(
!
berkeley_skip
&&
berkeley_flush_logs
())
if
(
!
berkeley_skip
&&
berkeley_flush_logs
())
result
=
1
;
result
=
1
;
...
@@ -408,7 +389,7 @@ bool ha_flush_logs()
...
@@ -408,7 +389,7 @@ bool ha_flush_logs()
if
(
!
innodb_skip
&&
innobase_flush_logs
())
if
(
!
innodb_skip
&&
innobase_flush_logs
())
result
=
1
;
result
=
1
;
#endif
#endif
DBUG_RETURN
(
result
)
;
return
result
;
}
}
/*
/*
...
@@ -419,19 +400,15 @@ bool ha_flush_logs()
...
@@ -419,19 +400,15 @@ bool ha_flush_logs()
int
ha_delete_table
(
enum
db_type
table_type
,
const
char
*
path
)
int
ha_delete_table
(
enum
db_type
table_type
,
const
char
*
path
)
{
{
handler
*
file
=
get_new_handler
((
TABLE
*
)
0
,
table_type
);
handler
*
file
=
get_new_handler
((
TABLE
*
)
0
,
table_type
);
DBUG_ENTER
(
"ha_delete_table"
);
if
(
!
file
)
if
(
!
file
)
DBUG_RETURN
(
ENOENT
)
;
return
ENOENT
;
int
error
=
file
->
delete_table
(
path
);
int
error
=
file
->
delete_table
(
path
);
delete
file
;
delete
file
;
DBUG_RETURN
(
error
)
;
return
error
;
}
}
void
ha_store_ptr
(
byte
*
buff
,
uint
pack_length
,
my_off_t
pos
)
void
ha_store_ptr
(
byte
*
buff
,
uint
pack_length
,
my_off_t
pos
)
{
{
DBUG_ENTER
(
"ha_store_ptr"
);
switch
(
pack_length
)
{
switch
(
pack_length
)
{
#if SIZEOF_OFF_T > 4
#if SIZEOF_OFF_T > 4
case
8
:
mi_int8store
(
buff
,
pos
);
break
;
case
8
:
mi_int8store
(
buff
,
pos
);
break
;
...
@@ -444,14 +421,12 @@ void ha_store_ptr(byte *buff, uint pack_length, my_off_t pos)
...
@@ -444,14 +421,12 @@ void ha_store_ptr(byte *buff, uint pack_length, my_off_t pos)
case
2
:
mi_int2store
(
buff
,(
uint
)
pos
);
break
;
case
2
:
mi_int2store
(
buff
,(
uint
)
pos
);
break
;
case
1
:
buff
[
0
]
=
(
uchar
)
pos
;
break
;
case
1
:
buff
[
0
]
=
(
uchar
)
pos
;
break
;
}
}
DBUG_VOID_RETURN
;
return
;
}
}
my_off_t
ha_get_ptr
(
byte
*
ptr
,
uint
pack_length
)
my_off_t
ha_get_ptr
(
byte
*
ptr
,
uint
pack_length
)
{
{
my_off_t
pos
;
my_off_t
pos
;
DBUG_ENTER
(
"ha_get_ptr"
);
switch
(
pack_length
)
{
switch
(
pack_length
)
{
#if SIZEOF_OFF_T > 4
#if SIZEOF_OFF_T > 4
case
8
:
case
8
:
...
@@ -483,7 +458,7 @@ my_off_t ha_get_ptr(byte *ptr, uint pack_length)
...
@@ -483,7 +458,7 @@ my_off_t ha_get_ptr(byte *ptr, uint pack_length)
pos
=
0
;
// Impossible
pos
=
0
;
// Impossible
break
;
break
;
}
}
DBUG_RETURN
(
pos
)
;
return
pos
;
}
}
/****************************************************************************
/****************************************************************************
...
@@ -537,44 +512,32 @@ int handler::ha_open(const char *name, int mode, int test_if_locked)
...
@@ -537,44 +512,32 @@ int handler::ha_open(const char *name, int mode, int test_if_locked)
int
handler
::
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
int
handler
::
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
{
DBUG_ENTER
(
"handler::check"
);
return
HA_ADMIN_NOT_IMPLEMENTED
;
DBUG_RETURN
(
HA_ADMIN_NOT_IMPLEMENTED
);
}
}
int
handler
::
backup
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
int
handler
::
backup
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
{
DBUG_ENTER
(
"handler::backup"
);
return
HA_ADMIN_NOT_IMPLEMENTED
;
DBUG_RETURN
(
HA_ADMIN_NOT_IMPLEMENTED
);
}
}
int
handler
::
restore
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
int
handler
::
restore
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
{
DBUG_ENTER
(
"handler::restore"
);
return
HA_ADMIN_NOT_IMPLEMENTED
;
DBUG_RETURN
(
HA_ADMIN_NOT_IMPLEMENTED
);
}
}
int
handler
::
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
int
handler
::
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
{
DBUG_ENTER
(
"handler::repair"
);
return
HA_ADMIN_NOT_IMPLEMENTED
;
DBUG_RETURN
(
HA_ADMIN_NOT_IMPLEMENTED
);
}
}
int
handler
::
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
int
handler
::
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
{
DBUG_ENTER
(
"handler::optimize"
);
return
HA_ADMIN_NOT_IMPLEMENTED
;
DBUG_RETURN
(
HA_ADMIN_NOT_IMPLEMENTED
);
}
}
int
handler
::
analyze
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
int
handler
::
analyze
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
{
DBUG_ENTER
(
"handler::analyze"
);
return
HA_ADMIN_NOT_IMPLEMENTED
;
DBUG_RETURN
(
HA_ADMIN_NOT_IMPLEMENTED
);
}
}
/*
/*
...
@@ -619,9 +582,7 @@ int handler::read_first_row(byte * buf, uint primary_key)
...
@@ -619,9 +582,7 @@ int handler::read_first_row(byte * buf, uint primary_key)
int
handler
::
restart_rnd_next
(
byte
*
buf
,
byte
*
pos
)
int
handler
::
restart_rnd_next
(
byte
*
buf
,
byte
*
pos
)
{
{
DBUG_ENTER
(
"handler::restart_rnd_next"
);
return
HA_ERR_WRONG_COMMAND
;
DBUG_RETURN
(
HA_ERR_WRONG_COMMAND
);
}
}
...
@@ -630,8 +591,6 @@ int handler::restart_rnd_next(byte *buf, byte *pos)
...
@@ -630,8 +591,6 @@ int handler::restart_rnd_next(byte *buf, byte *pos)
void
handler
::
update_timestamp
(
byte
*
record
)
void
handler
::
update_timestamp
(
byte
*
record
)
{
{
long
skr
=
(
long
)
current_thd
->
query_start
();
long
skr
=
(
long
)
current_thd
->
query_start
();
DBUG_ENTER
(
"handler::update_timestamp"
);
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
if
(
table
->
db_low_byte_first
)
{
{
...
@@ -640,7 +599,7 @@ void handler::update_timestamp(byte *record)
...
@@ -640,7 +599,7 @@ void handler::update_timestamp(byte *record)
else
else
#endif
#endif
longstore
(
record
,
skr
);
longstore
(
record
,
skr
);
DBUG_VOID_RETURN
;
return
;
}
}
/*
/*
...
@@ -674,7 +633,6 @@ longlong handler::get_auto_increment()
...
@@ -674,7 +633,6 @@ longlong handler::get_auto_increment()
{
{
longlong
nr
;
longlong
nr
;
int
error
;
int
error
;
DBUG_ENTER
(
"handler::get_auto_increment"
);
(
void
)
extra
(
HA_EXTRA_KEYREAD
);
(
void
)
extra
(
HA_EXTRA_KEYREAD
);
index_init
(
table
->
next_number_index
);
index_init
(
table
->
next_number_index
);
...
@@ -698,7 +656,7 @@ longlong handler::get_auto_increment()
...
@@ -698,7 +656,7 @@ longlong handler::get_auto_increment()
val_int_offset
(
table
->
rec_buff_length
)
+
1
;
val_int_offset
(
table
->
rec_buff_length
)
+
1
;
index_end
();
index_end
();
(
void
)
extra
(
HA_EXTRA_NO_KEYREAD
);
(
void
)
extra
(
HA_EXTRA_NO_KEYREAD
);
DBUG_RETURN
(
nr
)
;
return
nr
;
}
}
/* Print error that we got from handler function */
/* Print error that we got from handler function */
...
@@ -820,8 +778,6 @@ uint handler::get_dup_key(int error)
...
@@ -820,8 +778,6 @@ uint handler::get_dup_key(int error)
int
handler
::
delete_table
(
const
char
*
name
)
int
handler
::
delete_table
(
const
char
*
name
)
{
{
int
error
=
0
;
int
error
=
0
;
DBUG_ENTER
(
"handler::delete_table"
);
for
(
const
char
**
ext
=
bas_ext
();
*
ext
;
ext
++
)
for
(
const
char
**
ext
=
bas_ext
();
*
ext
;
ext
++
)
{
{
if
(
delete_file
(
name
,
*
ext
,
2
))
if
(
delete_file
(
name
,
*
ext
,
2
))
...
@@ -830,7 +786,7 @@ int handler::delete_table(const char *name)
...
@@ -830,7 +786,7 @@ int handler::delete_table(const char *name)
break
;
break
;
}
}
}
}
DBUG_RETURN
(
error
)
;
return
error
;
}
}
...
@@ -851,16 +807,14 @@ int handler::rename_table(const char * from, const char * to)
...
@@ -851,16 +807,14 @@ int handler::rename_table(const char * from, const char * to)
int
ha_recovery_logging
(
THD
*
thd
,
bool
on
)
int
ha_recovery_logging
(
THD
*
thd
,
bool
on
)
{
{
int
error
=
0
;
int
error
=
0
;
DBUG_ENTER
(
"ha_recovery_logging"
);
DBUG_ENTER
(
"ha_recovery_logging"
);
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
int
handler
::
index_next_same
(
byte
*
buf
,
const
byte
*
key
,
uint
keylen
)
int
handler
::
index_next_same
(
byte
*
buf
,
const
byte
*
key
,
uint
keylen
)
{
{
int
error
;
int
error
;
DBUG_ENTER
(
"handler::index_next_same"
);
if
(
!
(
error
=
index_next
(
buf
)))
if
(
!
(
error
=
index_next
(
buf
)))
{
{
if
(
key_cmp
(
table
,
key
,
active_index
,
keylen
))
if
(
key_cmp
(
table
,
key
,
active_index
,
keylen
))
...
@@ -869,7 +823,7 @@ int handler::index_next_same(byte *buf, const byte *key, uint keylen)
...
@@ -869,7 +823,7 @@ int handler::index_next_same(byte *buf, const byte *key, uint keylen)
error
=
HA_ERR_END_OF_FILE
;
error
=
HA_ERR_END_OF_FILE
;
}
}
}
}
DBUG_RETURN
(
error
)
;
return
error
;
}
}
...
@@ -882,9 +836,7 @@ int handler::index_next_same(byte *buf, const byte *key, uint keylen)
...
@@ -882,9 +836,7 @@ int handler::index_next_same(byte *buf, const byte *key, uint keylen)
int
handler
::
delete_all_rows
()
int
handler
::
delete_all_rows
()
{
{
DBUG_ENTER
(
"handler::delete_all_rows"
);
return
(
my_errno
=
HA_ERR_WRONG_COMMAND
);
DBUG_RETURN
((
my_errno
=
HA_ERR_WRONG_COMMAND
));
}
}
/****************************************************************************
/****************************************************************************
...
@@ -930,37 +882,26 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
...
@@ -930,37 +882,26 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
void
ha_key_cache
(
void
)
void
ha_key_cache
(
void
)
{
{
DBUG_ENTER
(
"ha_key_cache"
);
if
(
keybuff_size
)
if
(
keybuff_size
)
(
void
)
init_key_cache
(
keybuff_size
);
(
void
)
init_key_cache
(
keybuff_size
);
DBUG_VOID_RETURN
;
}
}
void
ha_resize_key_cache
(
void
)
void
ha_resize_key_cache
(
void
)
{
{
DBUG_ENTER
(
"ha_resize_key_cache"
);
(
void
)
resize_key_cache
(
keybuff_size
);
(
void
)
resize_key_cache
(
keybuff_size
);
DBUG_VOID_RETURN
;
}
}
static
int
NEAR_F
delete_file
(
const
char
*
name
,
const
char
*
ext
,
int
extflag
)
static
int
NEAR_F
delete_file
(
const
char
*
name
,
const
char
*
ext
,
int
extflag
)
{
{
char
buff
[
FN_REFLEN
];
char
buff
[
FN_REFLEN
];
DBUG_ENTER
(
"delete_file"
);
VOID
(
fn_format
(
buff
,
name
,
""
,
ext
,
extflag
|
4
));
VOID
(
fn_format
(
buff
,
name
,
""
,
ext
,
extflag
|
4
));
DBUG_RETURN
((
my_delete_with_symlink
(
buff
,
MYF
(
MY_WME
)
)));
return
(
my_delete_with_symlink
(
buff
,
MYF
(
MY_WME
)));
}
}
void
st_ha_check_opt
::
init
()
void
st_ha_check_opt
::
init
()
{
{
DBUG_ENTER
(
"st_ha_check_opt::init"
);
flags
=
sql_flags
=
0
;
flags
=
sql_flags
=
0
;
sort_buffer_size
=
current_thd
->
variables
.
myisam_sort_buff_size
;
sort_buffer_size
=
current_thd
->
variables
.
myisam_sort_buff_size
;
DBUG_VOID_RETURN
;
}
}
sql/opt_range.cc
View file @
7720348b
This diff is collapsed.
Click to expand it.
sql/sql_select.cc
View file @
7720348b
This diff is collapsed.
Click to expand it.
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