Commit e47742cb authored by marko's avatar marko

branches/zip: Merge revisions 536:558 from trunk.

parent e69d2f57
......@@ -76,7 +76,7 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr
include/univ.i include/usr0sess.h include/usr0sess.ic include/usr0types.h \
include/ut0byte.h include/ut0byte.ic include/ut0dbg.h include/ut0lst.h \
include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic \
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
cmakelists.txt
noinst_LIBRARIES = libinnobase.a
......
......@@ -21,16 +21,24 @@ fi
set -u
rm -rf to-mysql
mkdir -p to-mysql/storage/
mkdir to-mysql{,/storage,/patches,/mysql-test{,/t,/r,/include}}
svn log -v -r "$(($1 + 1)):BASE" > to-mysql/log
svn export -q . to-mysql/storage/innobase
cd to-mysql
mkdir -p sql mysql-test/t mysql-test/r mysql-test/include
cd storage/innobase
mv handler/* ../../sql
rmdir handler
seq $(($1+1)) $2|while read REV
do
PATCH=to-mysql/patches/r$REV.patch
svn log -v -r$REV > $PATCH
if [ $(wc -c < $PATCH) -gt 73 ]
then
svn diff -r$(($REV-1)):$REV >> $PATCH
else
rm $PATCH
fi
done
cd to-mysql/storage/innobase
mv handler ../../sql
mv mysql-test/*.test mysql-test/*.opt ../../mysql-test/t
mv mysql-test/*.result ../../mysql-test/r
......
......@@ -134,6 +134,7 @@ extern "C" {
#include "../storage/innobase/include/fil0fil.h"
#include "../storage/innobase/include/trx0xa.h"
#include "../storage/innobase/include/thr0loc.h"
#include "../storage/innobase/include/ha_prototypes.h"
}
#define HA_INNOBASE_ROWS_IN_TABLE 10000 /* to get optimization right */
......@@ -780,6 +781,25 @@ innobase_mysql_tmpfile(void)
return(fd2);
}
/*************************************************************************
Wrapper around MySQL's copy_and_convert function, see it for
documentation. */
extern "C"
ulint
innobase_convert_string(
/*====================*/
void* to,
ulint to_length,
CHARSET_INFO* to_cs,
const void* from,
ulint from_length,
CHARSET_INFO* from_cs,
uint* errors)
{
return(copy_and_convert((char*)to, to_length, to_cs,
(const char*)from, from_length, from_cs, errors));
}
/*************************************************************************
Gets the InnoDB transaction handle for a MySQL handler object, creates
an InnoDB transaction struct if the corresponding MySQL thread struct still
......@@ -4131,6 +4151,9 @@ ha_innobase::index_prev(
mysql_byte* buf) /* in/out: buffer for previous row in MySQL
format */
{
statistic_increment(current_thd->status_var.ha_read_prev_count,
&LOCK_status);
return(general_fetch(buf, ROW_SEL_PREV, 0));
}
......
......@@ -57,11 +57,23 @@ extern fil_addr_t fil_addr_null;
page */
#define FIL_PAGE_OFFSET 4 /* page offset inside space */
#define FIL_PAGE_PREV 8 /* if there is a 'natural' predecessor
of the page, its offset */
of the page, its offset.
Otherwise FIL_NULL.
This field is not set on BLOB pages,
which are stored as a singly-linked
list. See also FIL_PAGE_NEXT. */
#define FIL_PAGE_ZBLOB_SPACE_ID 8 /* space id of a compressed BLOB page,
4 bytes */
#define FIL_PAGE_NEXT 12 /* if there is a 'natural' successor
of the page, its offset */
of the page, its offset.
Otherwise FIL_NULL.
B-tree index pages
(FIL_PAGE_TYPE contains FIL_PAGE_INDEX)
on the same PAGE_LEVEL are maintained
as a doubly linked list via
FIL_PAGE_PREV and FIL_PAGE_NEXT
in the collation order of the
smallest user record on each page. */
#define FIL_PAGE_LSN 16 /* lsn of the end of the newest
modification log record to the page */
#define FIL_PAGE_TYPE 24 /* file page type: FIL_PAGE_INDEX,...,
......
#ifndef HA_INNODB_PROTOTYPES_H
#define HA_INNODB_PROTOTYPES_H
/* Prototypes for global functions in ha_innodb.cc that are called by
InnoDB's C-code. */
/*************************************************************************
Wrapper around MySQL's copy_and_convert function, see it for
documentation. */
ulint
innobase_convert_string(
/*====================*/
void* to,
ulint to_length,
CHARSET_INFO* to_cs,
const void* from,
ulint from_length,
CHARSET_INFO* from_cs,
uint* errors);
#endif
......@@ -333,6 +333,33 @@ mem_heap_dup(
const void* data, /* in: data to be copied */
ulint len); /* in: length of data, in bytes */
/**************************************************************************
Concatenate two memory blocks and return the result, using a memory heap. */
void*
mem_heap_cat(
/*=========*/
/* out, own: the result */
mem_heap_t* heap, /* in: memory heap where result is allocated */
const void* b1, /* in: block 1 */
ulint len1, /* in: length of b1, in bytes */
const void* b2, /* in: block 2 */
ulint len2); /* in: length of b2, in bytes */
/********************************************************************
A simple (s)printf replacement that dynamically allocates the space for the
formatted string from the given heap. This supports a very limited set of
the printf syntax: types 's' and 'u' and length modifier 'l' (which is
required for the 'u' type). */
char*
mem_heap_printf(
/*============*/
/* out: heap-allocated formatted string */
mem_heap_t* heap, /* in: memory heap */
const char* format, /* in: format string */
...) __attribute__ ((format (printf, 2, 3)));
#ifdef MEM_PERIODIC_CHECK
/**********************************************************************
Goes through the list of all allocated mem blocks, checks their magic
......
......@@ -18,8 +18,10 @@ Created 5/30/1994 Heikki Tuuri
/* Maximum values for various fields (for non-blob tuples) */
#define REC_MAX_N_FIELDS (1024 - 1)
/* Flag denoting the predefined minimum record: this bit is ORed in the 4
info bits of a record */
/* Info bit denoting the predefined minimum record: this bit is set
if and only if the record is the first user record on a non-leaf
B-tree page that is the leftmost page on its level
(PAGE_LEVEL is nonzero and FIL_PAGE_PREV is FIL_NULL). */
#define REC_INFO_MIN_REC_FLAG 0x10UL
/* The deleted flag in info bits */
#define REC_INFO_DELETED_FLAG 0x20UL /* when bit is set to 1, it means the
......
......@@ -17,6 +17,7 @@ Created 6/9/1994 Heikki Tuuri
#include "btr0sea.h"
#include "srv0srv.h"
#include "mem0dbg.c"
#include <stdarg.h>
/*
THE MEMORY MANAGEMENT
......@@ -127,6 +128,27 @@ mem_heap_dup(
return(memcpy(mem_heap_alloc(heap, len), data, len));
}
/**************************************************************************
Concatenate two memory blocks and return the result, using a memory heap. */
void*
mem_heap_cat(
/*=========*/
/* out, own: the result */
mem_heap_t* heap, /* in: memory heap where result is allocated */
const void* b1, /* in: block 1 */
ulint len1, /* in: length of b1, in bytes */
const void* b2, /* in: block 2 */
ulint len2) /* in: length of b2, in bytes */
{
void* res = mem_heap_alloc(heap, len1 + len2);
memcpy(res, b1, len1);
memcpy(res + len1, b2, len2);
return(res);
}
/**************************************************************************
Concatenate two strings and return the result, using a memory heap. */
......@@ -152,6 +174,150 @@ mem_heap_strcat(
return(s);
}
/********************************************************************
Helper function for mem_heap_printf. */
static
ulint
mem_heap_printf_low(
/*================*/
/* out: length of formatted string,
including terminating NUL */
char* buf, /* in/out: buffer to store formatted string
in, or NULL to just calculate length */
const char* format, /* in: format string */
va_list ap) /* in: arguments */
{
ulint len = 0;
while (*format) {
/* Does this format specifier have the 'l' length modifier. */
ibool is_long = FALSE;
/* Length of one parameter. */
size_t plen;
if (*format++ != '%') {
/* Non-format character. */
len++;
if (buf) {
*buf++ = *(format - 1);
}
continue;
}
if (*format == 'l') {
is_long = TRUE;
format++;
}
switch (*format++) {
case 's':
/* string */
{
char* s = va_arg(ap, char*);
/* "%ls" is a non-sensical format specifier. */
ut_a(!is_long);
plen = strlen(s);
len += plen;
if (buf) {
memcpy(buf, s, plen);
buf += plen;
}
}
break;
case 'u':
/* unsigned int */
{
char tmp[32];
unsigned long val;
/* We only support 'long' values for now. */
ut_a(is_long);
val = va_arg(ap, unsigned long);
plen = sprintf(tmp, "%lu", val);
len += plen;
if (buf) {
memcpy(buf, tmp, plen);
buf += plen;
}
}
break;
case '%':
/* "%l%" is a non-sensical format specifier. */
ut_a(!is_long);
len++;
if (buf) {
*buf++ = '%';
}
break;
default:
ut_error;
}
}
/* For the NUL character. */
len++;
if (buf) {
*buf = '\0';
}
return(len);
}
/********************************************************************
A simple (s)printf replacement that dynamically allocates the space for the
formatted string from the given heap. This supports a very limited set of
the printf syntax: types 's' and 'u' and length modifier 'l' (which is
required for the 'u' type). */
char*
mem_heap_printf(
/*============*/
/* out: heap-allocated formatted string */
mem_heap_t* heap, /* in: memory heap */
const char* format, /* in: format string */
...)
{
va_list ap;
char* str;
ulint len;
/* Calculate length of string */
len = 0;
va_start(ap, format);
len = mem_heap_printf_low(NULL, format, ap);
va_end(ap);
/* Now create it for real. */
str = mem_heap_alloc(heap, len);
va_start(ap, format);
mem_heap_printf_low(str, format, ap);
va_end(ap);
return(str);
}
/*******************************************************************
Creates a memory heap block where data can be allocated. */
......
......@@ -207,6 +207,13 @@ sym_tab_add_bound_lit(
*lit_type = PARS_STR_LIT;
break;
case DATA_CHAR:
ut_a(blit->length > 0);
len = blit->length;
*lit_type = PARS_STR_LIT;
break;
case DATA_INT:
ut_a(blit->length > 0);
ut_a(blit->length <= 8);
......
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