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
881b405d
Commit
881b405d
authored
Dec 19, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into janus.mylan:/usr/home/serg/Abk/mysql-5.1
parents
cd7cfc2a
554599e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
126 deletions
+115
-126
sql/handler.h
sql/handler.h
+115
-126
No files found.
sql/handler.h
View file @
881b405d
...
@@ -973,32 +973,12 @@ class handler :public Sql_alloc
...
@@ -973,32 +973,12 @@ class handler :public Sql_alloc
public:
public:
typedef
ulonglong
Table_flags
;
typedef
ulonglong
Table_flags
;
protected:
protected:
struct
st_table_share
*
table_share
;
/* The table definition */
struct
st_table_share
*
table_share
;
/* The table definition */
struct
st_table
*
table
;
/* The current open table */
struct
st_table
*
table
;
/* The current open table */
Table_flags
cached_table_flags
;
/* Set on init() and open() */
Table_flags
cached_table_flags
;
/* Set on init() and open() */
virtual
int
index_init
(
uint
idx
,
bool
sorted
)
{
active_index
=
idx
;
return
0
;
}
virtual
int
index_end
()
{
active_index
=
MAX_KEY
;
return
0
;
}
/**
rnd_init() can be called two times without rnd_end() in between
(it only makes sense if scan=1).
then the second call should prepare for the new table scan (e.g
if rnd_init allocates the cursor, second call should position it
to the start of the table, no need to deallocate and allocate it again
*/
virtual
int
rnd_init
(
bool
scan
)
=
0
;
virtual
int
rnd_end
()
{
return
0
;
}
virtual
Table_flags
table_flags
(
void
)
const
=
0
;
void
ha_statistic_increment
(
ulong
SSV
::*
offset
)
const
;
void
**
ha_data
(
THD
*
)
const
;
THD
*
ha_thd
(
void
)
const
;
ha_rows
estimation_rows_to_insert
;
ha_rows
estimation_rows_to_insert
;
virtual
void
start_bulk_insert
(
ha_rows
rows
)
{}
virtual
int
end_bulk_insert
()
{
return
0
;
}
public:
public:
handlerton
*
ht
;
/* storage engine of this handler */
handlerton
*
ht
;
/* storage engine of this handler */
uchar
*
ref
;
/* Pointer to current row */
uchar
*
ref
;
/* Pointer to current row */
...
@@ -1071,7 +1051,74 @@ public:
...
@@ -1071,7 +1051,74 @@ public:
{
{
cached_table_flags
=
table_flags
();
cached_table_flags
=
table_flags
();
}
}
/* ha_ methods: pubilc wrappers for private virtual API */
int
ha_open
(
TABLE
*
table
,
const
char
*
name
,
int
mode
,
int
test_if_locked
);
int
ha_open
(
TABLE
*
table
,
const
char
*
name
,
int
mode
,
int
test_if_locked
);
int
ha_index_init
(
uint
idx
,
bool
sorted
)
{
int
result
;
DBUG_ENTER
(
"ha_index_init"
);
DBUG_ASSERT
(
inited
==
NONE
);
if
(
!
(
result
=
index_init
(
idx
,
sorted
)))
inited
=
INDEX
;
DBUG_RETURN
(
result
);
}
int
ha_index_end
()
{
DBUG_ENTER
(
"ha_index_end"
);
DBUG_ASSERT
(
inited
==
INDEX
);
inited
=
NONE
;
DBUG_RETURN
(
index_end
());
}
int
ha_rnd_init
(
bool
scan
)
{
int
result
;
DBUG_ENTER
(
"ha_rnd_init"
);
DBUG_ASSERT
(
inited
==
NONE
||
(
inited
==
RND
&&
scan
));
inited
=
(
result
=
rnd_init
(
scan
))
?
NONE
:
RND
;
DBUG_RETURN
(
result
);
}
int
ha_rnd_end
()
{
DBUG_ENTER
(
"ha_rnd_end"
);
DBUG_ASSERT
(
inited
==
RND
);
inited
=
NONE
;
DBUG_RETURN
(
rnd_end
());
}
int
ha_reset
();
/* this is necessary in many places, e.g. in HANDLER command */
int
ha_index_or_rnd_end
()
{
return
inited
==
INDEX
?
ha_index_end
()
:
inited
==
RND
?
ha_rnd_end
()
:
0
;
}
Table_flags
ha_table_flags
()
const
{
return
cached_table_flags
;
}
/**
These functions represent the public interface to *users* of the
handler class, hence they are *not* virtual. For the inheritance
interface, see the (private) functions write_row(), update_row(),
and delete_row() below.
*/
int
ha_external_lock
(
THD
*
thd
,
int
lock_type
);
int
ha_write_row
(
uchar
*
buf
);
int
ha_update_row
(
const
uchar
*
old_data
,
uchar
*
new_data
);
int
ha_delete_row
(
const
uchar
*
buf
);
void
ha_release_auto_increment
();
int
ha_check_for_upgrade
(
HA_CHECK_OPT
*
check_opt
);
/** to be actually called to get 'check()' functionality*/
int
ha_check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
ha_repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
void
ha_start_bulk_insert
(
ha_rows
rows
)
{
estimation_rows_to_insert
=
rows
;
start_bulk_insert
(
rows
);
}
int
ha_end_bulk_insert
()
{
estimation_rows_to_insert
=
0
;
return
end_bulk_insert
();
}
void
adjust_next_insert_id_after_explicit_value
(
ulonglong
nr
);
void
adjust_next_insert_id_after_explicit_value
(
ulonglong
nr
);
int
update_auto_increment
();
int
update_auto_increment
();
void
print_keydup_error
(
uint
key_nr
,
const
char
*
msg
);
void
print_keydup_error
(
uint
key_nr
,
const
char
*
msg
);
...
@@ -1134,45 +1181,6 @@ public:
...
@@ -1134,45 +1181,6 @@ public:
virtual
const
char
*
index_type
(
uint
key_number
)
{
DBUG_ASSERT
(
0
);
return
""
;}
virtual
const
char
*
index_type
(
uint
key_number
)
{
DBUG_ASSERT
(
0
);
return
""
;}
int
ha_index_init
(
uint
idx
,
bool
sorted
)
{
int
result
;
DBUG_ENTER
(
"ha_index_init"
);
DBUG_ASSERT
(
inited
==
NONE
);
if
(
!
(
result
=
index_init
(
idx
,
sorted
)))
inited
=
INDEX
;
DBUG_RETURN
(
result
);
}
int
ha_index_end
()
{
DBUG_ENTER
(
"ha_index_end"
);
DBUG_ASSERT
(
inited
==
INDEX
);
inited
=
NONE
;
DBUG_RETURN
(
index_end
());
}
int
ha_rnd_init
(
bool
scan
)
{
int
result
;
DBUG_ENTER
(
"ha_rnd_init"
);
DBUG_ASSERT
(
inited
==
NONE
||
(
inited
==
RND
&&
scan
));
inited
=
(
result
=
rnd_init
(
scan
))
?
NONE
:
RND
;
DBUG_RETURN
(
result
);
}
int
ha_rnd_end
()
{
DBUG_ENTER
(
"ha_rnd_end"
);
DBUG_ASSERT
(
inited
==
RND
);
inited
=
NONE
;
DBUG_RETURN
(
rnd_end
());
}
int
ha_reset
();
/* this is necessary in many places, e.g. in HANDLER command */
int
ha_index_or_rnd_end
()
{
return
inited
==
INDEX
?
ha_index_end
()
:
inited
==
RND
?
ha_rnd_end
()
:
0
;
}
Table_flags
ha_table_flags
()
const
{
return
cached_table_flags
;
}
/**
/**
Signal that the table->read_set and table->write_set table maps changed
Signal that the table->read_set and table->write_set table maps changed
...
@@ -1183,20 +1191,8 @@ public:
...
@@ -1183,20 +1191,8 @@ public:
*/
*/
virtual
void
column_bitmaps_signal
();
virtual
void
column_bitmaps_signal
();
uint
get_index
(
void
)
const
{
return
active_index
;
}
uint
get_index
(
void
)
const
{
return
active_index
;
}
virtual
int
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
)
=
0
;
virtual
int
close
(
void
)
=
0
;
virtual
int
close
(
void
)
=
0
;
/**
These functions represent the public interface to *users* of the
handler class, hence they are *not* virtual. For the inheritance
interface, see the (private) functions write_row(), update_row(),
and delete_row() below.
*/
int
ha_external_lock
(
THD
*
thd
,
int
lock_type
);
int
ha_write_row
(
uchar
*
buf
);
int
ha_update_row
(
const
uchar
*
old_data
,
uchar
*
new_data
);
int
ha_delete_row
(
const
uchar
*
buf
);
/**
/**
@retval 0 Bulk update used by handler
@retval 0 Bulk update used by handler
@retval 1 Bulk update not used, normal operation used
@retval 1 Bulk update not used, normal operation used
...
@@ -1258,11 +1254,6 @@ public:
...
@@ -1258,11 +1254,6 @@ public:
DBUG_ASSERT
(
FALSE
);
DBUG_ASSERT
(
FALSE
);
return
HA_ERR_WRONG_COMMAND
;
return
HA_ERR_WRONG_COMMAND
;
}
}
private:
virtual
int
index_read
(
uchar
*
buf
,
const
uchar
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
)
{
return
HA_ERR_WRONG_COMMAND
;
}
public:
/**
/**
@brief
@brief
Positions an index cursor to the index specified in the handle. Fetches the
Positions an index cursor to the index specified in the handle. Fetches the
...
@@ -1294,10 +1285,6 @@ public:
...
@@ -1294,10 +1285,6 @@ public:
virtual
int
index_last
(
uchar
*
buf
)
virtual
int
index_last
(
uchar
*
buf
)
{
return
HA_ERR_WRONG_COMMAND
;
}
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
int
index_next_same
(
uchar
*
buf
,
const
uchar
*
key
,
uint
keylen
);
virtual
int
index_next_same
(
uchar
*
buf
,
const
uchar
*
key
,
uint
keylen
);
private:
virtual
int
index_read_last
(
uchar
*
buf
,
const
uchar
*
key
,
uint
key_len
)
{
return
(
my_errno
=
HA_ERR_WRONG_COMMAND
);
}
public:
/**
/**
@brief
@brief
The following functions works like index_read, but it find the last
The following functions works like index_read, but it find the last
...
@@ -1356,12 +1343,6 @@ public:
...
@@ -1356,12 +1343,6 @@ public:
virtual
int
extra_opt
(
enum
ha_extra_function
operation
,
ulong
cache_size
)
virtual
int
extra_opt
(
enum
ha_extra_function
operation
,
ulong
cache_size
)
{
return
extra
(
operation
);
}
{
return
extra
(
operation
);
}
/**
Reset state of file to after 'open'.
This function is called after every statement for all tables used
by that statement.
*/
virtual
int
reset
()
{
return
0
;
}
/**
/**
In an UPDATE or DELETE, if the row under the cursor was locked by another
In an UPDATE or DELETE, if the row under the cursor was locked by another
transaction, and the engine used an optimistic read of the last
transaction, and the engine used an optimistic read of the last
...
@@ -1396,10 +1377,6 @@ public:
...
@@ -1396,10 +1377,6 @@ public:
ulonglong
nb_desired_values
,
ulonglong
nb_desired_values
,
ulonglong
*
first_value
,
ulonglong
*
first_value
,
ulonglong
*
nb_reserved_values
);
ulonglong
*
nb_reserved_values
);
private:
virtual
void
release_auto_increment
()
{
return
;
};
public:
void
ha_release_auto_increment
();
void
set_next_insert_id
(
ulonglong
id
)
void
set_next_insert_id
(
ulonglong
id
)
{
{
DBUG_PRINT
(
"info"
,(
"auto_increment: next value %lu"
,
(
ulong
)
id
));
DBUG_PRINT
(
"info"
,(
"auto_increment: next value %lu"
,
(
ulong
)
id
));
...
@@ -1430,26 +1407,7 @@ public:
...
@@ -1430,26 +1407,7 @@ public:
{
return
HA_ERR_WRONG_COMMAND
;
}
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
void
update_create_info
(
HA_CREATE_INFO
*
create_info
)
{}
virtual
void
update_create_info
(
HA_CREATE_INFO
*
create_info
)
{}
protected:
/* to be implemented in handlers */
/** admin commands - called from mysql_admin_table */
virtual
int
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
/**
In these two methods check_opt can be modified
to specify CHECK option to use to call check()
upon the table.
*/
virtual
int
check_for_upgrade
(
HA_CHECK_OPT
*
check_opt
)
{
return
0
;
}
public:
int
ha_check_for_upgrade
(
HA_CHECK_OPT
*
check_opt
);
int
check_old_types
();
int
check_old_types
();
/** to be actually called to get 'check()' functionality*/
int
ha_check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
virtual
int
backup
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
virtual
int
backup
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
/**
/**
...
@@ -1458,11 +1416,6 @@ public:
...
@@ -1458,11 +1416,6 @@ public:
*/
*/
virtual
int
restore
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
virtual
int
restore
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
protected:
virtual
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
public:
int
ha_repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
virtual
int
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
virtual
int
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
virtual
int
analyze
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
virtual
int
analyze
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
...
@@ -1478,16 +1431,6 @@ public:
...
@@ -1478,16 +1431,6 @@ public:
virtual
int
disable_indexes
(
uint
mode
)
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
int
disable_indexes
(
uint
mode
)
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
int
enable_indexes
(
uint
mode
)
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
int
enable_indexes
(
uint
mode
)
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
int
indexes_are_disabled
(
void
)
{
return
0
;}
virtual
int
indexes_are_disabled
(
void
)
{
return
0
;}
void
ha_start_bulk_insert
(
ha_rows
rows
)
{
estimation_rows_to_insert
=
rows
;
start_bulk_insert
(
rows
);
}
int
ha_end_bulk_insert
()
{
estimation_rows_to_insert
=
0
;
return
end_bulk_insert
();
}
virtual
int
discard_or_import_tablespace
(
my_bool
discard
)
virtual
int
discard_or_import_tablespace
(
my_bool
discard
)
{
return
HA_ERR_WRONG_COMMAND
;}
{
return
HA_ERR_WRONG_COMMAND
;}
virtual
int
net_read_dump
(
NET
*
net
)
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
int
net_read_dump
(
NET
*
net
)
{
return
HA_ERR_WRONG_COMMAND
;
}
...
@@ -1754,13 +1697,37 @@ public:
...
@@ -1754,13 +1697,37 @@ public:
*/
*/
virtual
void
use_hidden_primary_key
();
virtual
void
use_hidden_primary_key
();
protected:
/* Service methods for use by storage engines. */
void
ha_statistic_increment
(
ulong
SSV
::*
offset
)
const
;
void
**
ha_data
(
THD
*
)
const
;
THD
*
ha_thd
(
void
)
const
;
private:
private:
/*
/*
R
ow-level primitives for storage engines. These should be
L
ow-level primitives for storage engines. These should be
overridden by the storage engine class. To call these methods, use
overridden by the storage engine class. To call these methods, use
the corresponding 'ha_*' method above.
the corresponding 'ha_*' method above.
*/
*/
virtual
int
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
)
=
0
;
virtual
int
index_init
(
uint
idx
,
bool
sorted
)
{
active_index
=
idx
;
return
0
;
}
virtual
int
index_end
()
{
active_index
=
MAX_KEY
;
return
0
;
}
/**
rnd_init() can be called two times without rnd_end() in between
(it only makes sense if scan=1).
then the second call should prepare for the new table scan (e.g
if rnd_init allocates the cursor, second call should position it
to the start of the table, no need to deallocate and allocate it again
*/
virtual
int
rnd_init
(
bool
scan
)
=
0
;
virtual
int
rnd_end
()
{
return
0
;
}
/**
Reset state of file to after 'open'.
This function is called after every statement for all tables used
by that statement.
*/
virtual
int
reset
()
{
return
0
;
}
virtual
Table_flags
table_flags
(
void
)
const
=
0
;
/**
/**
Is not invoked for non-transactional temporary tables.
Is not invoked for non-transactional temporary tables.
...
@@ -1788,8 +1755,30 @@ private:
...
@@ -1788,8 +1755,30 @@ private:
{
{
return
0
;
return
0
;
}
}
virtual
void
release_auto_increment
()
{
return
;
};
/** admin commands - called from mysql_admin_table */
virtual
int
check_for_upgrade
(
HA_CHECK_OPT
*
check_opt
)
{
return
0
;
}
virtual
int
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
/**
In this method check_opt can be modified
to specify CHECK option to use to call check()
upon the table.
*/
virtual
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
return
HA_ADMIN_NOT_IMPLEMENTED
;
}
virtual
void
start_bulk_insert
(
ha_rows
rows
)
{}
virtual
int
end_bulk_insert
()
{
return
0
;
}
virtual
int
index_read
(
uchar
*
buf
,
const
uchar
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
)
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
int
index_read_last
(
uchar
*
buf
,
const
uchar
*
key
,
uint
key_len
)
{
return
(
my_errno
=
HA_ERR_WRONG_COMMAND
);
}
};
};
/* Some extern variables used with handlers */
/* Some extern variables used with handlers */
extern
const
char
*
ha_row_type
[];
extern
const
char
*
ha_row_type
[];
...
...
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