Commit a67ff1bf authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

Update of interface for BDB tables.

Fixed bug in SHOW CREATE TABLE
parent 634b9385
......@@ -3,16 +3,17 @@
# Untar a MySQL distribution, change the copyright texts,
# pack it up again to a given directory
$VER="1.1";
$VER="1.2";
use Getopt::Long;
$opt_help= 0;
$opt_target= "mysql-copyright-target-";
$opt_target.= `date +%d%m%y-%H%M%S`;
$opt_help = 0;
$opt_version = 0;
$opt_target = "mysql-copyright-target-";
$opt_target .= `date +%d%m%y-%H%M%S`;
chop $opt_target;
GetOptions("help","target=s") || usage();
GetOptions("help","version","target=s") || error();
# fix the directory prefix for target dir
......@@ -32,7 +33,13 @@ sub main
my $REG_VERSION = '[0-9\.\-]+[a-z]?[0-9\.\-]+?(.alpha|.beta|.gamma|pre\d|[0-9\.\-a-z])?';
my $target;
usage() if (!$ARGV[0] || $opt_help);
if ($opt_version)
{
print "$0 version $VER by Jani Tolonen\n";
exit(0);
}
usage() if ($opt_help);
print error() if ($#ARGV == -1);
`mkdir -p $opt_target`;
$pec= $? >> 8;
......@@ -210,3 +217,16 @@ Options:
EOF
exit(0);
}
####
#### error
####
sub error
{
if ($#ARGV == -1)
{
print "Too few arguments to $0!\n";
}
exit(1);
}
......@@ -7589,7 +7589,7 @@ the DCE libraries while you compile @code{gcc} 2.95!
For HPUX Version 11.x we recommend @strong{MySQL} 3.23.15 or later.
If you are using @code{gcc} 2.95.1 on a unpatched HPUX Versiib 11.x system,
If you are using @code{gcc} 2.95.1 on a unpatched HPUX 11.x system,
you will get the error:
@example
......@@ -28666,6 +28666,22 @@ shell> myisamchk /path/to/datadir/*/*.MYI
* myisamchk other options::
@end menu
Note that if you get an error like:
@example
myisamchk: warning: 1 clients is using or hasn't closed the table properly
@end example
This means that you are trying to check a table that has been updated by
the another program (like the mysqld server) that hasn't yet closed
the file or that has died without closing the file properly.
If you @code{mysqld} is running, you must force a sync/close of all
tables with @code{FLUSH TABLES} and ensure that no one is using the
tables while you are running @code{myisamchk}. In MySQL 3.23 the easiest
way to avoid this problem is to use @code{CHECK TABLE} instead of
@code{myisamchk} to check tables.
@cindex options, @code{myisamchk}
@cindex @code{myisamchk}, options
@node myisamchk general options, myisamchk check options, myisamchk syntax, myisamchk syntax
......@@ -38157,6 +38173,8 @@ though, so 3.23 is not released as a stable version yet.
Fixed bug where the automatic repair of MyISAM tables failed sometimes
when the data file was corrupt.
@item
Changed BDB tables to use new compare function in Berkeley DB 3.2.3
@item
You can now use Unix sockets with @code{mit-pthreads}
Added the latin5 (turkish) character set
@item
......@@ -602,7 +602,7 @@ AC_MSG_RESULT($ac_cv_conv_longlong_to_float)
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_BDB
dnl Sets HAVE_BERKELEY_DB if inst library is found
dnl Makes sure db version is >= 3.1.11
dnl Makes sure db version is >= 3.2.3
dnl Looks in $srcdir for Berkeley distribution not told otherwise
dnl ---------------------------------------------------------------------------
......@@ -806,15 +806,15 @@ AC_DEFUN([MYSQL_CHECK_BDB_VERSION], [
if test $db_major -gt 3
then
bdb_version_ok=yes
elif test $db_major -eq 3 && test $db_minor -gt 1
elif test $db_major -eq 3 && test $db_minor -gt 2
then
bdb_version_ok=yes
elif test $db_major -eq 3 && test $db_minor -eq 1 && test $db_patch -ge 11
elif test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -ge 3
then
bdb_version_ok=yes
else
bdb_version_ok="invalid version $db_major.$db_minor.$db_patch"
bdb_version_ok="$bdb_version_ok (must be at least version 3.1.11)"
bdb_version_ok="$bdb_version_ok (must be at least version 3.2.3)"
fi
])
......
......@@ -140,7 +140,7 @@ extern void bmove512(gptr dst,const gptr src,uint len);
#endif
#if !defined(HAVE_BMOVE) && !defined(bmove)
extern void bmove(gptr dst,const char *src,uint len);
extern void bmove(char *dst, const char *src,uint len);
#endif
extern void bmove_upp(char *dst,const char *src,uint len);
......
......@@ -290,14 +290,14 @@ int chk_size(MI_CHECK *param, register MI_INFO *info)
if (skr > size && skr != size + MEMMAP_EXTRA_MARGIN)
{
error=1;
mi_check_print_error(param,"Size of datafile is: %-8s Should be: %s",
mi_check_print_error(param,"Size of datafile is: %-9s Should be: %s",
llstr(size,buff), llstr(skr,buff2));
param->retry_without_quick=1; /* Don't use quick repair */
}
else
{
mi_check_print_warning(param,
"Size of datafile is: %-8s Should be: %s",
"Size of datafile is: %-9s Should be: %s",
llstr(size,buff), llstr(skr,buff2));
}
}
......
No preview for this file type
......@@ -203,7 +203,7 @@ const char **ha_berkeley::bas_ext() const
static int
berkeley_cmp_hidden_key(const DBT *new_key, const DBT *saved_key)
berkeley_cmp_hidden_key(DB* file, const DBT *new_key, const DBT *saved_key)
{
ulonglong a=uint5korr((char*) new_key->data);
ulonglong b=uint5korr((char*) saved_key->data);
......@@ -211,9 +211,9 @@ berkeley_cmp_hidden_key(const DBT *new_key, const DBT *saved_key)
}
static int
berkeley_cmp_packed_key(const DBT *new_key, const DBT *saved_key)
berkeley_cmp_packed_key(DB *file, const DBT *new_key, const DBT *saved_key)
{
KEY *key= (KEY*) new_key->app_private;
KEY *key= (KEY*) BT_APP_PRIVATE(file);
char *new_key_ptr= (char*) new_key->data;
char *saved_key_ptr=(char*) saved_key->data;
KEY_PART_INFO *key_part= key->key_part, *end=key_part+key->key_parts;
......@@ -242,9 +242,9 @@ berkeley_cmp_packed_key(const DBT *new_key, const DBT *saved_key)
/* The following is not yet used; Should be used for fixed length keys */
static int
berkeley_cmp_fix_length_key(const DBT *new_key, const DBT *saved_key)
berkeley_cmp_fix_length_key(DB *file, const DBT *new_key, const DBT *saved_key)
{
KEY *key=(KEY*) (new_key->app_private);
KEY *key=(KEY*) BT_APP_PRIVATE(file);
char *new_key_ptr= (char*) new_key->data;
char *saved_key_ptr=(char*) saved_key->data;
KEY_PART_INFO *key_part= key->key_part, *end=key_part+key->key_parts;
......@@ -321,6 +321,8 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
file->set_bt_compare(file,
(hidden_primary_key ? berkeley_cmp_hidden_key :
berkeley_cmp_packed_key));
if (!hidden_primary_key)
file->set_bt_app_private(file,table->key_info+table->primary_key);
if ((error=(file->open(file, fn_format(name_buff,name,"", ha_berkeley_ext,
2 | 4),
"main", DB_BTREE, open_mode,0))))
......@@ -359,6 +361,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
sprintf(part,"key%02d",++used_keys);
key_type[i]=table->key_info[i].flags & HA_NOSAME ? DB_NOOVERWRITE : 0;
(*ptr)->set_bt_compare(*ptr, berkeley_cmp_packed_key);
(*ptr)->set_bt_app_private(*ptr,table->key_info+i);
if (!(table->key_info[i].flags & HA_NOSAME))
(*ptr)->set_flags(*ptr, DB_DUP);
if ((error=((*ptr)->open(*ptr, name_buff, part, DB_BTREE,
......@@ -561,7 +564,6 @@ DBT *ha_berkeley::pack_key(DBT *key, uint keynr, char *buff,
DBUG_ENTER("pack_key");
key->data=buff;
key->app_private= key_info;
for ( ; key_part != end ; key_part++)
{
......@@ -599,7 +601,6 @@ DBT *ha_berkeley::pack_key(DBT *key, uint keynr, char *buff,
bzero((char*) key,sizeof(*key));
key->data=buff;
key->app_private= key_info;
for (; key_part != end && (int) key_length > 0 ; key_part++)
{
......@@ -1055,7 +1056,6 @@ int ha_berkeley::read_row(int error, char *buf, uint keynr, DBT *row,
bzero((char*) &key,sizeof(key));
key.data=key_buff2;
key.size=row->size;
key.app_private=table->key_info+primary_key;
memcpy(key_buff2,row->data,row->size);
/* Read the data into current_row */
current_row.flags=DB_DBT_REALLOC;
......@@ -1092,10 +1092,12 @@ int ha_berkeley::index_read(byte * buf, const byte * key,
{
DBT row;
int error;
KEY *key_info= &table->key_info[active_index];
DBUG_ENTER("index_read");
statistic_increment(ha_read_key_count,&LOCK_status);
bzero((char*) &row,sizeof(row));
if (key_len == table->key_info[active_index].key_length)
if (key_len == key_info->key_length)
{
error=read_row(cursor->c_get(cursor, pack_key(&last_key,
active_index,
......@@ -1110,10 +1112,10 @@ int ha_berkeley::index_read(byte * buf, const byte * key,
pack_key(&last_key, active_index, key_buff, key, key_len);
/* Store for compare */
memcpy(key_buff2, key_buff, last_key.size);
((KEY*) last_key.app_private)->handler.bdb_return_if_eq= -1;
key_info->handler.bdb_return_if_eq= -1;
error=read_row(cursor->c_get(cursor, &last_key, &row, DB_SET_RANGE),
buf, active_index, &row, (DBT*) 0, 0);
((KEY*) last_key.app_private)->handler.bdb_return_if_eq=0;
key_info->handler.bdb_return_if_eq= 0;
if (!error && find_flag == HA_READ_KEY_EXACT)
{
/* Check that we didn't find a key that wasn't equal to the current
......@@ -1215,7 +1217,6 @@ DBT *ha_berkeley::get_pos(DBT *to, byte *pos)
bzero((char*) to,sizeof(*to));
to->data=pos;
to->app_private=table->key_info+primary_key;
if (fixed_length_primary_key)
to->size=ref_length;
else
......
......@@ -3905,12 +3905,16 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
if (error == -3)
error=0; /* select_limit used */
}
if (!table)
if (!table) /* If sending data to client */
{
if (error < 0)
join->result->send_error(0,NullS); /* purecov: inspected */
else if (join->result->send_eof())
error= -1;
join->result->send_error(0,NullS); /* purecov: inspected */
else
{
join_free(join); // Unlock all cursors
if (join->result->send_eof())
error= -1;
}
}
else if (error < 0)
join->result->send_error(0,NullS); /* purecov: inspected */
......
......@@ -718,17 +718,16 @@ store_create_info(THD *thd, TABLE *table, String *packet)
field->sql_type(type);
packet->append(type.ptr(),type.length());
bool null_default_value = (field->type() == FIELD_TYPE_TIMESTAMP ||
field->unireg_check == Field::NEXT_NUMBER);
bool has_default = (field->type() != FIELD_TYPE_BLOB);
bool has_default = (field->type() != FIELD_TYPE_BLOB &&
field->type() != FIELD_TYPE_TIMESTAMP &&
field->unireg_check != Field::NEXT_NUMBER);
if (flags & NOT_NULL_FLAG)
packet->append(" NOT NULL", 9);
if((flags & NOT_NULL_FLAG) && !null_default_value)
packet->append(" NOT NULL", 9);
if(has_default)
if (has_default)
{
packet->append(" default ", 9);
if (!null_default_value && !field->is_null())
if (!field->is_null())
{ // Not null by default
type.set(tmp,sizeof(tmp));
field->val_str(&type,&type);
......@@ -736,7 +735,7 @@ store_create_info(THD *thd, TABLE *table, String *packet)
packet->append(type.ptr(),type.length());
packet->append('\'');
}
else if (field->maybe_null() || null_default_value)
else if (field->maybe_null())
packet->append("NULL", 4); // Null as default
else
packet->append(tmp,0);
......
......@@ -52,7 +52,7 @@ asm(".L5: ");
#else
void bmove(dst, src, len)
register byte *dst;
register char *dst;
register const char *src;
register uint len;
{
......
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