diff options
author | unknown <brian@zim.(none)> | 2005-06-01 21:56:30 -0700 |
---|---|---|
committer | unknown <brian@zim.(none)> | 2005-06-01 21:56:30 -0700 |
commit | f629af609b10f91f4456c778f35c21cbf1d8788a (patch) | |
tree | 21533890f530ab28e8f4542b5f7ca2deada7e9da /sql/examples | |
parent | 288008ea17321835df3669536bfaa77835bb6ffc (diff) | |
parent | e2bf6b04a6d97a6680cd4deb653fc92e6604bfea (diff) | |
download | mariadb-git-f629af609b10f91f4456c778f35c21cbf1d8788a.tar.gz |
Merge of 4.1->5.0. This contained the fixes for GCC 4.0
BitKeeper/deleted/.del-ha_isam.cc~4dce65904db2675e:
Auto merged
BitKeeper/deleted/.del-ha_isammrg.cc~dc682e4755d77a2e:
Auto merged
client/mysqladmin.cc:
Auto merged
client/sql_string.cc:
Auto merged
mysys/raid.cc:
Auto merged
sql/field.cc:
Auto merged
sql/ha_berkeley.cc:
Auto merged
sql/ha_blackhole.cc:
Auto merged
sql/ha_heap.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_geofunc.cc:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/item_uniq.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/opt_range.h:
Auto merged
sql/procedure.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/protocol_cursor.cc:
Auto merged
sql/repl_failsafe.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_analyse.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/examples/ha_example.cc:
Auto merged
sql/examples/ha_tina.cc:
Auto merged
sql/sql_map.cc:
Auto merged
sql/sql_olap.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_repl.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_string.cc:
Auto merged
sql/sql_udf.cc:
Auto merged
sql/tztime.cc:
Auto merged
sql/examples/ha_archive.cc:
Merge fix
sql/mysqld.cc:
Hand merge
sql/opt_range.cc:
Hand Merge
sql/sql_acl.cc:
Hand Merge
Diffstat (limited to 'sql/examples')
-rw-r--r-- | sql/examples/ha_archive.cc | 10 | ||||
-rw-r--r-- | sql/examples/ha_example.cc | 8 | ||||
-rw-r--r-- | sql/examples/ha_tina.cc | 41 |
3 files changed, 25 insertions, 34 deletions
diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc index f28ba79a00e..4f0cfb91d20 100644 --- a/sql/examples/ha_archive.cc +++ b/sql/examples/ha_archive.cc @@ -14,7 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#include <my_global.h> + +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif @@ -600,7 +602,7 @@ int ha_archive::write_row(byte * buf) if (!delayed_insert || !bulk_insert) share->dirty= TRUE; - if (written != table->s->reclength) + if (written != (z_off_t)table->s->reclength) goto error; /* We should probably mark the table as damagaged if the record is written @@ -617,7 +619,7 @@ int ha_archive::write_row(byte * buf) { ((Field_blob*) table->field[*ptr])->get_ptr(&data_ptr); written= gzwrite(share->archive_write, data_ptr, (unsigned)size); - if (written != size) + if (written != (z_off_t)size) goto error; } } @@ -788,7 +790,7 @@ int ha_archive::rnd_pos(byte * buf, byte *pos) statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, &LOCK_status); current_position= my_get_ptr(pos, ref_length); - z_off_t seek= gzseek(archive, current_position, SEEK_SET); + (void)gzseek(archive, current_position, SEEK_SET); DBUG_RETURN(get_row(archive, buf)); } diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc index 562b51878bf..66d1a801333 100644 --- a/sql/examples/ha_example.cc +++ b/sql/examples/ha_example.cc @@ -63,7 +63,9 @@ -Brian */ -#ifdef __GNUC__ +#include <my_global.h> + +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif @@ -150,10 +152,8 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) return share; -error2: - thr_lock_delete(&share->lock); - pthread_mutex_destroy(&share->mutex); error: + pthread_mutex_destroy(&share->mutex); pthread_mutex_unlock(&example_mutex); my_free((gptr) share, MYF(0)); diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 9ac446587ec..6ca7f67ef66 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -20,10 +20,10 @@ First off, this is a play thing for me, there are a number of things wrong with it: *) It was designed for csv and therefor its performance is highly questionable. *) Indexes have not been implemented. This is because the files can be traded in - and out of the table directory without having to worry about rebuilding anything. + and out of the table directory without having to worry about rebuilding anything. *) NULLs and "" are treated equally (like a spreadsheet). *) There was in the beginning no point to anyone seeing this other then me, so there - is a good chance that I haven't quite documented it well. + is a good chance that I haven't quite documented it well. *) Less design, more "make it work" Now there are a few cool things with it: @@ -38,7 +38,9 @@ TODO: -Brian */ -#ifdef __GNUC__ +#include <my_global.h> + +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif @@ -89,12 +91,12 @@ int get_mmap(TINA_SHARE *share, int write) { if (write) share->mapped_file= (byte *)mmap(NULL, share->file_stat.st_size, - PROT_READ|PROT_WRITE, MAP_SHARED, - share->data_file, 0); + PROT_READ|PROT_WRITE, MAP_SHARED, + share->data_file, 0); else share->mapped_file= (byte *)mmap(NULL, share->file_stat.st_size, - PROT_READ, MAP_PRIVATE, - share->data_file, 0); + PROT_READ, MAP_PRIVATE, + share->data_file, 0); if ((share->mapped_file ==(caddr_t)-1)) { /* @@ -144,9 +146,9 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) { char data_file_name[FN_REFLEN]; if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &share, sizeof(*share), - &tmp_name, length+1, - NullS)) + &share, sizeof(*share), + &tmp_name, length+1, + NullS)) { pthread_mutex_unlock(&tina_mutex); return NULL; @@ -341,7 +343,6 @@ int ha_tina::find_current_row(byte *buf) for (Field **field=table->field ; *field ; field++) { - int x; buffer.length(0); mapped_ptr++; // Increment past the first quote for(;mapped_ptr != end_ptr; mapped_ptr++) @@ -746,28 +747,16 @@ int ha_tina::rnd_end() */ qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set), (qsort_cmp)sort_set); for (ptr= chain; ptr < chain_ptr; ptr++) - printf("Chain %d, %d\n", (int)ptr->begin, (int)ptr->end); - for (ptr= chain; ptr < chain_ptr; ptr++) { - //memmove(share->mapped_file + ptr->begin, share->mapped_file - //+ ptr->end, length - (size_t)ptr->end); /* We peek a head to see if this is the last chain */ - printf("Delete %d, %d, %d\n", (int)ptr->begin, (int)ptr->end, (int)length); if (ptr+1 == chain_ptr) - { - printf("Shiftina(end) %d(%d) to %d\n", (int)ptr->end, (int)(length - (size_t)ptr->end), (int)ptr->begin); memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end, length - (size_t)ptr->end); - } else - { - printf("Shifting %d(%d) to %d\n", (int)ptr->end, (int)((ptr++)->begin - (size_t)ptr->end), (int)ptr->begin); - memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end, - (size_t)(ptr++)->begin - (size_t)ptr->end); - } + memmove((caddr_t)share->mapped_file + ptr->begin, (caddr_t)share->mapped_file + ptr->end, + (size_t)((ptr++)->begin - ptr->end)); length= length - (size_t)(ptr->end - ptr->begin); } - printf("Buffer %s\n",share->mapped_file); /* Truncate the file to the new size */ if (my_chsize(share->data_file, length, 0, MYF(MY_WME))) @@ -850,7 +839,7 @@ int ha_tina::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_i DBUG_ENTER("ha_tina::create"); if ((create_file= my_create(fn_format(name_buff,name,"",".CSV",MY_REPLACE_EXT|MY_UNPACK_FILENAME),0, - O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) + O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) DBUG_RETURN(-1); my_close(create_file,MYF(0)); |