summaryrefslogtreecommitdiff
path: root/sql/examples
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2005-11-18 16:38:01 +0100
committerunknown <guilhem@mysql.com>2005-11-18 16:38:01 +0100
commit41de6f9a7cfcb39e8461835dfe67dbc24f457bb4 (patch)
tree07e22cfddd8927526e3bb2ef581822106278886f /sql/examples
parent081cc1558734f2ee7a674ddacaa2436b2a46d039 (diff)
parent14637f97cdd7ff4a7d60c09052e2e280ee57c957 (diff)
downloadmariadb-git-41de6f9a7cfcb39e8461835dfe67dbc24f457bb4.tar.gz
Merge mysql.com:/home/mysql_src/mysql-5.0
into mysql.com:/home/mysql_src/mysql-5.1-merge-of-5.0 (not all files are good, I'll fix; I'll ask some devs to check their part) BitKeeper/etc/ignore: auto-union include/my_global.h: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/information_schema.result: Auto merged mysql-test/t/view.test: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged sql/field.cc: Auto merged sql/item.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.h: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_table.cc: Auto merged sql/table.h: Auto merged storage/myisam/mi_key.c: Auto merged storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Auto merged storage/ndb/src/ndbapi/NdbImpl.hpp: Auto merged storage/ndb/src/ndbapi/ndb_cluster_connection.cpp: Auto merged support-files/mysql.spec.sh: Auto merged configure.in: merge mysql-test/r/ps_1general.result: merge ("ul", will fix) sql/examples/ha_tina.cc: merge sql/ha_innodb.cc: merge sql/handler.h: merge sql/log.cc: merge sql/set_var.cc: merge sql/share/errmsg.txt: merge (bad, will fix) sql/sql_show.cc: merge (bad, will fix) sql/sql_yacc.yy: merge storage/ndb/src/ndbapi/NdbRecAttr.cpp: merge
Diffstat (limited to 'sql/examples')
-rw-r--r--sql/examples/ha_tina.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc
index 46636b93d21..6bb883f91e0 100644
--- a/sql/examples/ha_tina.cc
+++ b/sql/examples/ha_tina.cc
@@ -95,11 +95,15 @@ handlerton tina_hton= {
*****************************************************************************/
/*
- Used for sorting chains.
+ Used for sorting chains with qsort().
*/
int sort_set (tina_set *a, tina_set *b)
{
- return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) );
+ /*
+ We assume that intervals do not intersect. So, it is enought to compare
+ any two points. Here we take start of intervals for comparison.
+ */
+ return ( a->begin > b->begin ? -1 : ( a->begin < b->begin ? 1 : 0 ) );
}
static byte* tina_get_key(TINA_SHARE *share,uint *length,
@@ -200,7 +204,8 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
- if ((share->data_file= my_open(data_file_name, O_RDWR, MYF(0))) == -1)
+ if ((share->data_file= my_open(data_file_name, O_RDWR|O_APPEND,
+ MYF(0))) == -1)
goto error2;
/*
@@ -836,14 +841,8 @@ int ha_tina::rnd_end()
(qsort_cmp)sort_set);
for (ptr= chain; ptr < chain_ptr; ptr++)
{
- /* We peek a head to see if this is the last chain */
- if (ptr+1 == chain_ptr)
- memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
- length - (size_t)ptr->end);
- else
- memmove((caddr_t)share->mapped_file + ptr->begin,
- (caddr_t)share->mapped_file + ptr->end,
- (size_t)((ptr++)->begin - ptr->end));
+ memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
+ length - (size_t)ptr->end);
length= length - (size_t)(ptr->end - ptr->begin);
}