Commit f86fd782 authored by brian@zim.(none)'s avatar brian@zim.(none)

Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  zim.(none):/home/brian/mysql/archive-5.1
parents 68076249 3ee76a3e
......@@ -2438,7 +2438,7 @@ MYSQL_STORAGE_ENGINE(berkeley,,berkeley-db,,,,storage/bdb,,,[
MYSQL_STORAGE_ENGINE(example,,,,,no,storage/example,,,[
AC_CONFIG_FILES(storage/example/Makefile)
])
MYSQL_STORAGE_ENGINE(archive)
MYSQL_STORAGE_ENGINE(archive,,,,,,storage/archive)
dnl MYSQL_STORAGE_ENGINE(csv,,,,,tina_hton,,ha_tina.o)
MYSQL_STORAGE_ENGINE(csv,,,,,no,storage/csv,,,[
AC_CONFIG_FILES(storage/csv/Makefile)
......@@ -2564,6 +2564,7 @@ AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
strings/Makefile regex/Makefile storage/Makefile storage/heap/Makefile dnl
storage/myisam/Makefile storage/myisammrg/Makefile dnl
storage/archive/Makefile dnl
os2/Makefile os2/include/Makefile os2/include/sys/Makefile dnl
man/Makefile BUILD/Makefile vio/Makefile dnl
libmysql/Makefile client/Makefile dnl
......
......@@ -83,6 +83,7 @@ sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy
INC_LIB= $(top_builddir)/regex/libregex.a \
$(top_builddir)/storage/myisam/libmyisam.a \
$(top_builddir)/storage/myisammrg/libmyisammrg.a \
$(top_builddir)/storage/archive/libarchive.a \
$(top_builddir)/storage/heap/libheap.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
......
......@@ -32,6 +32,7 @@ bin_PROGRAMS = mysql_tzinfo_to_sql
gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@
LDADD = $(top_builddir)/storage/myisam/libmyisam.a \
$(top_builddir)/storage/myisammrg/libmyisammrg.a \
$(top_builddir)/storage/archive/libarchive.a \
$(top_builddir)/storage/heap/libheap.a \
$(top_builddir)/vio/libvio.a \
$(top_builddir)/mysys/libmysys.a \
......
This diff is collapsed.
......@@ -19,6 +19,7 @@
#endif
#include <zlib.h>
#include "../storage/archive/azlib.h"
/*
Please read ha_archive.cc first. If you are looking for more general
......@@ -33,7 +34,7 @@ typedef struct st_archive_share {
pthread_mutex_t mutex;
THR_LOCK lock;
File meta_file; /* Meta file we use */
gzFile archive_write; /* Archive file we are working with */
azio_stream archive_write; /* Archive file we are working with */
bool dirty; /* Flag for if a flush should occur */
bool crashed; /* Meta file is crashed */
ha_rows rows_recorded; /* Number of rows in tables */
......@@ -49,7 +50,7 @@ class ha_archive: public handler
{
THR_LOCK_DATA lock; /* MySQL lock */
ARCHIVE_SHARE *share; /* Shared lock info */
gzFile archive; /* Archive file we are working with */
azio_stream archive; /* Archive file we are working with */
z_off_t current_position; /* The position of the row we just read */
byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */
String buffer; /* Buffer used for blob storage */
......@@ -77,19 +78,19 @@ public:
int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
int real_write_row(byte *buf, gzFile writer);
int real_write_row(byte *buf, azio_stream *writer);
int delete_all_rows();
int rnd_init(bool scan=1);
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
int get_row(gzFile file_to_read, byte *buf);
int get_row(azio_stream *file_to_read, byte *buf);
int read_meta_file(File meta_file, ha_rows *rows);
int write_meta_file(File meta_file, ha_rows rows, bool dirty);
ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table);
int free_share(ARCHIVE_SHARE *share);
bool auto_repair() const { return 1; } // For the moment we just do this
int read_data_header(gzFile file_to_read);
int write_data_header(gzFile file_to_write);
int read_data_header(azio_stream *file_to_read);
int write_data_header(azio_stream *file_to_write);
void position(const byte *record);
void info(uint);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
......
......@@ -21,7 +21,7 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory
EXTRA_DIST =
SUBDIRS =
DIST_SUBDIRS = . csv example bdb heap innobase myisam myisammrg ndb
DIST_SUBDIRS = . csv example bdb heap innobase myisam myisammrg ndb archive
# Don't update the files from bitkeeper
%::SCCS/s.%
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
@ZLIB_INCLUDES@
LDADD = libarchive.a $(top_srcdir)/mysys/libmysys.a \
$(top_srcdir)/dbug/libdbug.a \
$(top_srcdir)/strings/libmystrings.a \
@ZLIB_LIBS@
pkglib_LIBRARIES = libarchive.a
noinst_PROGRAMS = archive_test
archive_test_LDFLAGS = @NOINST_LDFLAGS@
noinst_HEADERS = azlib.h
libarchive_a_SOURCES = azio.c
# Don't update the files from bitkeeper
%::SCCS/s.%
#include <stdio.h>
#include <azlib.h>
#define TEST_STRING "This is a test"
#define BUFFER_LEN 1024
int main(int argc, char *argv[])
{
int ret;
azio_stream foo, foo1;
char buffer[BUFFER_LEN];
MY_INIT(argv[0]);
if (!(ret= azopen(&foo, "test", O_CREAT|O_WRONLY|O_TRUNC|O_BINARY)))
{
printf("Could not create test file\n");
return 0;
}
azwrite(&foo, TEST_STRING, sizeof(TEST_STRING));
azflush(&foo, Z_FINISH);
if (!(ret= azopen(&foo1, "test", O_RDONLY|O_BINARY)))
{
printf("Could not open test file\n");
return 0;
}
ret= azread(&foo1, buffer, BUFFER_LEN);
printf("Read %d bytes\n", ret);
printf("%s\n", buffer);
azrewind(&foo1);
azclose(&foo);
if (!(ret= azopen(&foo, "test", O_APPEND|O_WRONLY|O_BINARY)))
{
printf("Could not create test file\n");
return 0;
}
azwrite(&foo, TEST_STRING, sizeof(TEST_STRING));
azflush(&foo, Z_FINISH);
ret= azread(&foo1, buffer, BUFFER_LEN);
printf("Read %d bytes\n", ret);
printf("%s\n", buffer);
azclose(&foo);
azclose(&foo1);
//unlink("test");
return 0;
}
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment