summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-09-29 00:58:16 +0300
committerunknown <monty@donna.mysql.com>2000-09-29 00:58:16 +0300
commitc33289a3a19431b833d7fe06cbfb7f57747cc9b6 (patch)
treeb7b27884a7a1c424b00084acf096abc9155bcb32
parent3a5ab655f175d86e9c7f4eab290933ffa622eeaf (diff)
downloadmariadb-git-c33289a3a19431b833d7fe06cbfb7f57747cc9b6.tar.gz
Fixed indention, removed compiler varnings and fixed a bug
in FULLTEXT indexes. Docs/manual.texi: Removed some @ifset nushere tags which crashed the manual when using emacs client/mysql-test.c: ***MISSING WEAVE*** heap/hp_test2.c: Removed compiler warnings isam/pack_isam.c: Removed compiler warnings isam/update.c: Removed compiler warnings myisam/ft_parser.c: cleanup myisam/ft_update.c: Fixed crash when inserting a blob which was NULL myisam/mi_check.c: -e continues checking of other keys on error myisam/mi_rkey.c: cleanup myisam/myisamchk.c: cleanup myisam/myisamlog.c: Added use of rnd to make things more predictable myisammrg/myrg_rkey.c: Removed compiler warnings mysys/mf_pack.c: cleanup mysys/my_fstream.c: cleanup sql/ha_berkeley.cc: cleanup sql/handler.cc: cleanup sql/item_func.cc: cleanup sql/item_func.h: cleanup sql/net_serv.cc: cleanup sql/slave.cc: cleanup sql/sql_class.cc: cleanup sql/sql_show.cc: cleanup
-rw-r--r--Docs/manual.texi109
-rw-r--r--heap/hp_test2.c1
-rw-r--r--isam/pack_isam.c18
-rw-r--r--isam/update.c10
-rw-r--r--myisam/ft_parser.c2
-rw-r--r--myisam/ft_update.c11
-rw-r--r--myisam/mi_check.c15
-rw-r--r--myisam/mi_rkey.c14
-rw-r--r--myisam/myisamchk.c2
-rw-r--r--myisam/myisamlog.c47
-rw-r--r--myisammrg/myrg_rkey.c1
-rw-r--r--mysys/mf_pack.c3
-rw-r--r--mysys/my_fstream.c1
-rw-r--r--sql/ha_berkeley.cc8
-rw-r--r--sql/handler.cc1
-rw-r--r--sql/item_func.cc5
-rw-r--r--sql/item_func.h2
-rw-r--r--sql/net_serv.cc1
-rw-r--r--sql/slave.cc428
-rw-r--r--sql/sql_class.cc6
-rw-r--r--sql/sql_show.cc6
21 files changed, 351 insertions, 340 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 37d91c2b263..e58556a9191 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -163,18 +163,18 @@ General Information About MySQL
* General-SQL:: General SQL information and tutorials
* Useful Links:: Useful @strong{MySQL}-related links
-About this manual
+About This Manual
* Manual conventions:: Conventions used in this manual
-MySQL mailing lists
+MySQL Mailing Lists
* Mailing-list:: The @strong{MySQL} mailing lists
* Asking questions:: Asking questions or reporting bugs
* Bug reports:: How to report bugs or problems
* Answering questions:: Guidelines for answering questions on the mailing list
-MySQL licensing and support
+MySQL Licensing and Support
* Licensing policy:: @strong{MySQL} licensing policy
* Copyright:: Copyrights used by @strong{MySQL}
@@ -182,22 +182,22 @@ MySQL licensing and support
* Cost:: @strong{MySQL} licensing and support costs
* Support:: Types of commercial support
-Copyrights used by MySQL
+Copyrights Used by MySQL
* Copyright changes:: Possible future copyright changes
-Example licensing situations
+Example Licensing Situations
* Products that use MySQL:: Selling products that use @strong{MySQL}
* ISP:: ISP @strong{MySQL} services
* Web server:: Running a web server using @strong{MySQL}.
-@strong{MySQL} licensing and support costs
+@strong{MySQL} Licensing and Support Costs
* Payment information:: Payment information
* Contact information:: Contact information
-Types of commercial support
+Types of Commercial Support
* Basic email support:: Basic email support
* Extended email support:: Extended email support
@@ -223,31 +223,31 @@ Installing MySQL
* Post-installation:: Post-installation setup and testing
* Upgrade:: Is there anything special to do when upgrading/downgrading @strong{MySQL}?
-Installing a MySQL binary distribution
+Installing a MySQL Binary Distribution
* Linux-RPM:: Linux RPM files
* Building clients:: Building client programs
* Binary install system issues:: System-specific issues
-System-specific issues
+System-specific Issues
* Binary notes-Linux:: Linux notes for binary distribution
* Binary notes-HP-UX:: HP-UX notes for binary distribution
-Installing a MySQL source distribution
+Installing a MySQL Source Distribution
* Quick install:: Quick installation overview
* Applying patches:: Applying patches
* configure options:: Typical @code{configure} options
-Perl installation comments
+Perl Installation Comments
* Perl installation:: Installing Perl on Unix
* ActiveState Perl:: Installing ActiveState Perl on Windows
* Windows Perl:: Installing the @strong{MySQL} Perl distribution on Windows
* Perl support problems:: Problems using the Perl @code{DBI}/@code{DBD} interface
-System-specific issues
+System-specific Issues
* Solaris:: Solaris notes
* Solaris 2.7:: Solaris 2.7 / 2.8 notes
@@ -269,7 +269,7 @@ System-specific issues
* Mac OS X:: Mac OS X notes
* BEOS::
-Linux notes (all Linux versions)
+Linux Notes (All Linux Versions)
* Linux-x86:: Linux-x86 notes
* Linux-RedHat50:: RedHat 5.0 notes
@@ -280,13 +280,13 @@ Linux notes (all Linux versions)
* Qube2:: Qube2 Linux notes
* Linux-Ia64::
-BSD/OS notes
+BSD/OS Notes
* BSDI2:: BSD/OS 2.x notes
* BSDI3:: BSD/OS 3.x notes
* BSDI4:: BSD/OS 4.x notes
-Windows notes
+Windows Notes
* Windows installation:: Installing @strong{MySQL} on Windows
* Win95 start:: Starting @strong{MySQL} on Win95 / Win98
@@ -298,7 +298,7 @@ Windows notes
* Windows and BDB tables.::
* Windows vs Unix:: @strong{MySQL}-Windows compared to Unix @strong{MySQL}
-Post-installation setup and testing
+Post-installation Setup and Testing
* mysql_install_db:: Problems running @code{mysql_install_db}
* Starting server:: Problems starting the @strong{MySQL} server
@@ -368,10 +368,10 @@ MySQL language reference
* DROP TABLE:: @code{DROP TABLE} syntax
* OPTIMIZE TABLE:: @code{OPTIMIZE TABLE} syntax
* CHECK TABLE:: @code{CHECK TABLE} syntax
-* ANALYZE TABLE:: @code{ANALYZE TABLE} syntax
-* REPAIR TABLE:: @code{REPAIR TABLE} syntax
* BACKUP TABLE:: @code{BACKUP TABLE} syntax
* RESTORE TABLE:: @code{RESTORE TABLE} syntax
+* ANALYZE TABLE:: @code{ANALYZE TABLE} syntax
+* REPAIR TABLE:: @code{REPAIR TABLE} syntax
* DELETE:: @code{DELETE} syntax
* SELECT:: @code{SELECT} syntax
* JOIN:: @code{JOIN} syntax
@@ -465,7 +465,7 @@ Functions for use in @code{SELECT} and @code{WHERE} clauses
MySQL table types
* MyISAM:: MyISAM tables
-* MERGE:: MERGE tables
+* MERGE::
* ISAM:: ISAM tables
* HEAP:: HEAP tables
* BDB:: BDB or Berkeley_db tables
@@ -544,7 +544,7 @@ Replication in MySQL
* Replication Features:: Replication Features
* Replication Options:: Replication Options in my.cnf
* Replication SQL:: SQL Commands related to replication
-* Replication FAQ:: Frequently asked questions about replication
+* Replication FAQ:: Frequently Asked Questions about replication
Getting maximum performance from MySQL
@@ -581,7 +581,7 @@ Speed of queries that access or update data
* Estimating performance:: Estimating query performance
* SELECT speed:: Speed of @code{SELECT} queries
* Where optimizations:: How MySQL optimizes @code{WHERE} clauses
-* LEFT JOIN optimization:: How MySQL optimizes @code{LEFT JOIN} and @code{RIGHT JOIN}
+* LEFT JOIN optimization:: How MySQL optimizes @code{LEFT JOIN}
* LIMIT optimization:: How MySQL optimizes @code{LIMIT}
* Insert speed:: Speed of @code{INSERT} queries
* Update speed:: Speed of @code{UPDATE} queries
@@ -812,6 +812,7 @@ MySQL change history
Changes in release 3.23.x (Recommended; beta)
+* News-3.23.26:: Changes in release 3.23.26
* News-3.23.25:: Changes in release 3.23.25
* News-3.23.24:: Changes in release 3.23.24
* News-3.23.23:: Changes in release 3.23.23
@@ -939,7 +940,7 @@ Changes in release 3.19.x
* News-3.19.4:: Changes in release 3.19.4
* News-3.19.3:: Changes in release 3.19.3
-List of things we want to add to MySQL in the future (The TODO)
+MySQL and the future (The TODO)
* TODO future:: Things that must done in the very near future
* TODO sometime:: Things that have to be done sometime
@@ -6401,8 +6402,8 @@ table. @xref{Crashing}.
To get a core dump on Linux if mysqld dies with a SIGSEGV
signal, you can start mysqld with the @code{--core-file} option. Note
-that you also probably need to raise the @code{core file size} with
-@code{ulimit}!
+that you also probably need to raise the @code{core file size} by adding
+@code{ulimit -c 1000000} to @code{safe_mysqld}.
If you are using LinuxThreads and @code{mysqladmin shutdown} doesn't work,
you must upgrade to LinuxThreads Version 0.7.1 or newer.
@@ -12270,10 +12271,10 @@ to restart @code{mysqld} with @code{--skip-grant-tables} to be able to run
* DROP TABLE:: @code{DROP TABLE} syntax
* OPTIMIZE TABLE:: @code{OPTIMIZE TABLE} syntax
* CHECK TABLE:: @code{CHECK TABLE} syntax
-* ANALYZE TABLE:: @code{ANALYZE TABLE} syntax
-* REPAIR TABLE:: @code{REPAIR TABLE} syntax
* BACKUP TABLE:: @code{BACKUP TABLE} syntax
* RESTORE TABLE:: @code{RESTORE TABLE} syntax
+* ANALYZE TABLE:: @code{ANALYZE TABLE} syntax
+* REPAIR TABLE:: @code{REPAIR TABLE} syntax
* DELETE:: @code{DELETE} syntax
* SELECT:: @code{SELECT} syntax
* JOIN:: @code{JOIN} syntax
@@ -17599,7 +17600,7 @@ The different check types stand for the following:
@end multitable
@findex BACKUP TABLE
-@node BACKUP TABLE, RESTORE TABLE, CHECK TABLE, Reference
+@node BACKUP TABLE, RESTORE TABLE, CHECK TABLE, Reference
@section @code{BACKUP TABLE} syntax
@example
@@ -17774,6 +17775,7 @@ the @code{LIMIT} value.
@node SELECT, JOIN, DELETE, Reference
@section @code{SELECT} syntax
+@c help SELECT
@example
SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
[HIGH_PRIORITY]
@@ -17788,6 +17790,7 @@ SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
[LIMIT [offset,] rows]
[PROCEDURE procedure_name] ]
@end example
+@c help end
@code{SELECT} is used to retrieve rows selected from one or more tables.
@code{select_expression} indicates the columns you want to retrieve.
@@ -24409,7 +24412,7 @@ command line. (Slave)
@end multitable
-@node Replication FAQ, , Replication SQL, Replication
+@node Replication FAQ, , Replication SQL, Replication
@section Replication FAQ
@strong{Q}: Why do I sometimes see more than one @code{Binlog_Dump} thread on
@@ -36153,7 +36156,6 @@ The twz driver: A type 4 JDBC driver by Terrence W. Zellers
private and educational use. (not supported anymore)
@c no answer from server 990830
@c You can always find the latest driver at @uref{http://www.voicenet.com/~zellert/tjFM/}.
-@item
@item @uref{http://www.mysql.com/Downloads/Contrib/pmdamysql.tgz,pmdamysql.tgz}
A @strong{MySQL} PMDA. Provides @strong{MySQL} server status and configuration
variables.
@@ -36255,6 +36257,11 @@ By Terry Jones
@item @uref{http://www.mysql.com/Downloads/Contrib/eiffel-wrapper-1.0.tar.gz,eiffel-wrapper-1.0.tar.gz}.
Eiffel wrapper by Michael Ravits.
+
+@item @uref{http://www.mysql.com/Downloads/Contrib/SQLmy0.06.tgz,SQLmy0.06.tgz}.
+FlagShip Replaceable Database Driver (RDD) for MySQL. By Alejandro
+Fernandez Herrero.
+@uref{http://www.fship.com/rdds.html, Flagship RDD home page}
@end itemize
@appendixsec Clients
@@ -36698,7 +36705,6 @@ Previous versions of things found here that you probably won't be
interested in.
@end itemize
-
@page
@node Credits, News, Contrib, Top
@appendix Contributors to MySQL
@@ -36987,16 +36993,6 @@ ODBC and VisualC++ interface questions.
@strong{MySQL} server.
@end table
-@c we don't want the entire change history in the nusphere manual
-@ifset nusphere
-@node News, Bugs, Credits, Top
-@appendix MySQL change history
-
-The MySQL change history can be found in the latest version of the mysql
-manual at @url{http://www.mysql.com/documentation/manual/}
-@end ifset
-
-@ifclear nusphere
@node News, Bugs, Credits, Top
@appendix MySQL change history
@@ -37031,6 +37027,7 @@ version. The replication and BerkeleyDB code is still under development,
though, so 3.23 is not released as a stable version yet.
@menu
+* News-3.23.26:: Changes in release 3.23.26
* News-3.23.25:: Changes in release 3.23.25
* News-3.23.24:: Changes in release 3.23.24
* News-3.23.23:: Changes in release 3.23.23
@@ -37059,7 +37056,16 @@ though, so 3.23 is not released as a stable version yet.
* News-3.23.0:: Changes in release 3.23.0
@end menu
-@node News-3.23.25, News-3.23.24, News-3.23.x, News-3.23.x
+@node News-3.23.26, News-3.23.25, News-3.23.x, News-3.23.x
+@appendixsubsec Changes in release 3.23.26
+@itemize @bullet
+@item
+Fixed bug in @code{FULLTEXT} index when inserting a NULL column.
+@item
+Changed to use @code{mkstemp()} instead of @code{tempnam()}.
+@end itemize
+
+@node News-3.23.25, News-3.23.24, News-3.23.26, News-3.23.x
@appendixsubsec Changes in release 3.23.25
@itemize @bullet
@item
@@ -41195,7 +41201,6 @@ fields, the @code{BLOB} was garbage on output.
@item
Fixed @code{DISTINCT} with calculated columns.
@end itemize
-@end ifclear
@node Bugs, TODO, News, Top
@appendix Known errors and design deficiencies in MySQL
@@ -42555,15 +42560,6 @@ All new development is concentrated to @strong{MySQL}.
@page
@c This node name is special
-@ifset nusphere
-@node GPL license, LGPL license, Unireg, Top
-@appendix GNU General Public License
-
-The GPL License can be found at ...
-
-@end ifset
-
-@ifclear nusphere
@node GPL license, LGPL license, Unireg, Top
@appendix GNU General Public License
@@ -42909,19 +42905,9 @@ library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
@end example
-@end ifclear
@page
-@ifset nusphere
-@node LGPL license, Function Index, GPL license, Top
-@appendix GNU Library General Public License
-
-The LGPL License can be found at ...
-
-@end ifset
-
-@ifclear nusphere
@node LGPL license, Function Index, GPL license, Top
@appendix GNU Library General Public License
@@ -43408,7 +43394,6 @@ necessary. Here is a sample; alter the names:
That's all there is to it!
@end example
-@end ifclear
@node Function Index, Concept Index, LGPL license, Top
@unnumbered SQL command, type and function index
diff --git a/heap/hp_test2.c b/heap/hp_test2.c
index 179e2c7c399..bfb30e59622 100644
--- a/heap/hp_test2.c
+++ b/heap/hp_test2.c
@@ -62,6 +62,7 @@ char *argv[];
HP_KEYSEG keyseg[MAX_KEYS*5];
HEAP_PTR position;
MY_INIT(argv[0]); /* init my_sys library & pthreads */
+ LINT_INIT(position);
filename= "test2";
filename2= "test2_2";
diff --git a/isam/pack_isam.c b/isam/pack_isam.c
index 9193f52a863..1040096fa4a 100644
--- a/isam/pack_isam.c
+++ b/isam/pack_isam.c
@@ -574,9 +574,9 @@ static int compress(MRG_INFO *mrg,char *result_table)
end_file_buffer();
if (verbose && mrg->records)
- printf("Min record length: %6d Max length: %6d Mean total length: %6d\n",
+ printf("Min record length: %6d Max length: %6d Mean total length: %6lu\n",
mrg->min_pack_length,mrg->max_pack_length,
- (long) new_length/mrg->records);
+ (ulong) new_length/mrg->records);
if (!test_only)
{
@@ -763,11 +763,11 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
{
global_count=count;
if (!(element=tree_insert(&count->int_tree,pos,0)) ||
- element->count == 1 &&
- count->tree_buff + tree_buff_length <
- count->tree_pos + count->field_length ||
- count->field_length == 1 &&
- count->int_tree.elements_in_tree > 1)
+ (element->count == 1 &&
+ count->tree_buff + tree_buff_length <
+ count->tree_pos + count->field_length ||
+ count->field_length == 1 &&
+ count->int_tree.elements_in_tree > 1))
{
delete_tree(&count->int_tree);
my_free(count->tree_buff,MYF(0));
@@ -1760,8 +1760,8 @@ static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
if (max_record_length >= max_allowed_length)
{
fprintf(stderr,
- "Error: Found record with packed-length: %d, max is: %d\n",
- max_record_length,max_allowed_length);
+ "Error: Found record with packed-length: %d, max is: %lu\n",
+ max_record_length, (ulong) max_allowed_length);
error=1;
break;
}
diff --git a/isam/update.c b/isam/update.c
index ffcea740986..82dab4140e3 100644
--- a/isam/update.c
+++ b/isam/update.c
@@ -31,6 +31,7 @@ int nisam_update(register N_INFO *info, const byte *oldrec, const byte *newrec)
uchar old_key[N_MAX_KEY_BUFF],*new_key;
DBUG_ENTER("nisam_update");
+ LINT_INIT(save_errno);
if (!(info->update & HA_STATE_AKTIV))
{
my_errno=HA_ERR_KEY_NOT_FOUND;
@@ -54,7 +55,7 @@ int nisam_update(register N_INFO *info, const byte *oldrec, const byte *newrec)
info->s->base.max_key_file_length -
info->s->blocksize* INDEX_BLOCK_MARGIN *info->s->state.keys)
{
- my_errno=HA_ERR_INDEX_FILE_FULL;
+ save_errno=HA_ERR_INDEX_FILE_FULL;
goto err_end;
}
@@ -108,12 +109,9 @@ err:
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | HA_STATE_AKTIV |
key_changed);
err_end:
- nisam_log_record(LOG_UPDATE,info,newrec,info->lastpos,my_errno);
+ nisam_log_record(LOG_UPDATE,info,newrec,info->lastpos,save_errno);
VOID(_nisam_writeinfo(info,1));
allow_break(); /* Allow SIGHUP & SIGINT */
- if (save_errno == HA_ERR_KEY_NOT_FOUND)
- my_errno=HA_ERR_CRASHED;
- else
- my_errno=save_errno;
+ my_errno=(save_errno == HA_ERR_KEY_NOT_FOUND) ? HA_ERR_CRASHED : save_errno;
DBUG_RETURN(-1);
} /* nisam_update */
diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c
index 22826c68889..5f5159a57dd 100644
--- a/myisam/ft_parser.c
+++ b/myisam/ft_parser.c
@@ -87,7 +87,7 @@ FT_WORD * ft_linearize(MI_INFO *info, uint keynr, byte *keybuf, TREE *wtree)
}
delete_tree(wtree);
my_free((char*) wtree,MYF(0));
- if (wlist==NULL)
+ if (!wlist)
return NULL;
docstat.list->pos=NULL;
diff --git a/myisam/ft_update.c b/myisam/ft_update.c
index 1c16a77ab5b..7cfce1158fc 100644
--- a/myisam/ft_update.c
+++ b/myisam/ft_update.c
@@ -37,9 +37,8 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf,
byte *pos;
uint i;
- i=info->s->keyinfo[keynr].keysegs-FT_SEGS;
keyseg=info->s->keyinfo[keynr].seg;
- while(i--)
+ for (i=info->s->keyinfo[keynr].keysegs-FT_SEGS ; i-- ; )
{
uint len;
@@ -61,10 +60,12 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf,
}
else
len=keyseg->length;
-
- parsed=ft_parse(parsed, pos, len);
- if (parsed==NULL) return NULL;
+ if (!(parsed=ft_parse(parsed, pos, len)))
+ return NULL;
}
+ /* Handle the case where all columns are NULL */
+ if (!parsed && !(parsed=ft_parse(0, "", 0)))
+ return NULL;
return ft_linearize(info, keynr, keybuf, parsed);
}
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 88447231f02..ce561e13bd2 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -314,7 +314,7 @@ int chk_size(MI_CHECK *param, register MI_INFO *info)
int chk_key(MI_CHECK *param, register MI_INFO *info)
{
- uint key,found_keys=0,full_text_keys=0;
+ uint key,found_keys=0,full_text_keys=0,result=0;
ha_rows keys;
ha_checksum old_record_checksum,init_checksum;
my_off_t all_keydata,all_totaldata,key_totlength,length;
@@ -361,7 +361,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
{
mi_check_print_error(param,"Can't read indexpage from filepos: %s",
llstr(share->state.key_root[key],buff));
- DBUG_RETURN(-1);
+ if (!(param->testflag & T_INFO))
+ DBUG_RETURN(-1);
+ result= -1;
+ continue;
}
param->key_file_blocks+=keyinfo->block_length;
keys=0;
@@ -377,7 +380,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
{
mi_check_print_error(param,"Found %s keys of %s",llstr(keys,buff),
llstr(info->state->records,buff2));
+ if (!(param->testflag & T_INFO))
DBUG_RETURN(-1);
+ result= -1;
+ continue;
}
if (found_keys - full_text_keys == 1 &&
((share->options &
@@ -391,7 +397,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
key+1);
else
mi_check_print_error(param,"Key 1 doesn't point at all records");
- DBUG_RETURN(-1);
+ if (!(param->testflag & T_INFO))
+ DBUG_RETURN(-1);
+ result= -1;
+ continue;
}
}
else
diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c
index 62f16aa4bcb..d201694ab05 100644
--- a/myisam/mi_rkey.c
+++ b/myisam/mi_rkey.c
@@ -39,13 +39,13 @@ int _mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
if (raw_key)
{
- if (key_len == 0)
- key_len=USE_WHOLE_KEY;
- key_buff=info->lastkey+info->s->base.max_key_length;
- pack_key_length=_mi_pack_key(info,(uint) inx,key_buff,(uchar*) key,key_len);
- info->last_rkey_length=pack_key_length;
- DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,share->keyinfo[inx].seg,
- key_buff,pack_key_length););
+ if (key_len == 0)
+ key_len=USE_WHOLE_KEY;
+ key_buff=info->lastkey+info->s->base.max_key_length;
+ pack_key_length=_mi_pack_key(info,(uint) inx,key_buff,(uchar*) key,key_len);
+ info->last_rkey_length=pack_key_length;
+ DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,share->keyinfo[inx].seg,
+ key_buff,pack_key_length););
}
else
{
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index aa5ba48c03f..c1d3e8873f1 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -193,7 +193,7 @@ static struct option long_options[] =
static void print_version(void)
{
- printf("%s Ver 1.31 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.32 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
}
diff --git a/myisam/myisamlog.c b/myisam/myisamlog.c
index a492448065d..87f09f984f7 100644
--- a/myisam/myisamlog.c
+++ b/myisam/myisamlog.c
@@ -1,15 +1,15 @@
/* 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 */
@@ -32,6 +32,7 @@
struct file_info {
long process;
int filenr,id;
+ uint rnd;
my_string name,show_name,record;
MI_INFO *isam;
bool closed,used;
@@ -70,13 +71,14 @@ static void printf_log(const char *str,...);
static bool cmp_filename(struct file_info *file_info,my_string name);
static uint verbose=0,update=0,test_info=0,max_files=0,re_open_count=0,
- recover=0,prefix_remove=0,opt_processes=0;
+ recover=0,prefix_remove=0,opt_processes=0,opt_myisam_with_debug=0;
static my_string log_filename=0,filepath=0,write_filename=0,record_pos_file=0;
static ulong com_count[10][3],number_of_commands=(ulong) ~0L,
isamlog_process;
static my_off_t isamlog_filepos,start_offset=0,record_pos= HA_OFFSET_ERROR;
static const char *command_name[]=
-{"open","write","update","delete","close","extra","lock","re-open","delete-all", NullS};
+{"open","write","update","delete","close","extra","lock","re-open",
+ "delete-all", NullS};
int main(int argc, char **argv)
@@ -91,11 +93,11 @@ int main(int argc, char **argv)
max_files=(set_maximum_open_files(min(max_files,8))-6)/2;
if (update)
- printf("Trying to %s isamfiles according to log '%s'\n",
+ printf("Trying to %s MyISAM files according to log '%s'\n",
(recover ? "recover" : "update"),log_filename);
error= examine_log(log_filename,argv);
if (update && ! error)
- puts("isamfile:s updated successfully");
+ puts("Tables updated successfully");
total_count=total_error=total_recover=0;
for (i=first=0 ; command_name[i] ; i++)
{
@@ -134,7 +136,7 @@ static void get_options(register int *argc, register char ***argv)
char option;
help=0;
- usage="Usage: %s [-?iruvIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n";
+ usage="Usage: %s [-?iruvDIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n";
pos="";
while (--*argc > 0 && *(pos = *(++*argv)) == '-' ) {
@@ -199,6 +201,9 @@ static void get_options(register int *argc, register char ***argv)
update=1;
recover++;
break;
+ case 'D':
+ opt_myisam_with_debug=1;
+ break;
case 'P':
opt_processes=1;
break;
@@ -246,7 +251,7 @@ static void get_options(register int *argc, register char ***argv)
/* Fall through */
case 'I':
case '?':
- printf("%s Ver 1.2 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.3 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
puts("By Monty, for your professional use\n");
if (version)
@@ -261,7 +266,7 @@ static void get_options(register int *argc, register char ***argv)
puts(" -o \"offset\" -p # \"remove # components from path\"");
puts(" -r \"recover\" -R \"file recordposition\"");
puts(" -u \"update\" -v \"verbose\" -w \"write file\"");
- puts(" -P \"processes\"");
+ puts(" -D \"myisam compileled with DBUG\" -P \"processes\"");
puts("\nOne can give a second and a third '-v' for more verbose.");
puts("Normaly one does a update (-u).");
puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted.");
@@ -365,14 +370,16 @@ static int examine_log(my_string file_name, char **table_names)
case MI_LOG_OPEN:
if (!table_names[0])
{
- com_count[command][0]--; /* Must be counted explicite */
+ com_count[command][0]--; /* Must be counted explicite */
if (result)
com_count[command][1]--;
}
if (curr_file_info)
- printf("\nWarning: %s is opened twice with same process and filenumber\n",
+ {
+ printf("\nWarning: %s is opened with same process and filenumber\nMaybe you should use the -P option ?\n",
curr_file_info->show_name);
+ }
if (my_b_read(&cache,(byte*) head,2))
goto err;
file_info.name=0;
@@ -389,7 +396,7 @@ static int examine_log(my_string file_name, char **table_names)
for (pos=file_info.name; pos=strchr(pos,'\\') ; pos++)
*pos= '/';
- pos=file_info.name;
+ pos=file_info.name;
for (i=0 ; i < prefix_remove ; i++)
{
char *next;
@@ -446,6 +453,10 @@ static int examine_log(my_string file_name, char **table_names)
goto end;
files_open++;
file_info.closed=0;
+ if (opt_myisam_with_debug)
+ file_info.isam->s->rnd= 0;
+ else
+ file_info.isam->s->rnd= isamlog_process;
}
VOID(tree_insert(&tree,(gptr) &file_info,0));
if (file_info.used)
@@ -482,10 +493,12 @@ static int examine_log(my_string file_name, char **table_names)
if (mi_extra(curr_file_info->isam,
(int) extra_command) != (int) result)
{
+ fflush(stdout);
VOID(fprintf(stderr,
"Warning: error %d, expected %d on command %s at %s\n",
my_errno,result,command_name[command],
llstr(isamlog_filepos,llbuff)));
+ fflush(stderr);
}
}
break;
@@ -628,9 +641,11 @@ static int examine_log(my_string file_name, char **table_names)
command_name[command],result);
break;
default:
+ fflush(stdout);
VOID(fprintf(stderr,
"Error: found unknown command %d in logfile, aborted\n",
command));
+ fflush(stderr);
goto end;
}
}
@@ -643,12 +658,16 @@ static int examine_log(my_string file_name, char **table_names)
DBUG_RETURN(0);
err:
+ fflush(stdout);
VOID(fprintf(stderr,"Got error %d when reading from logfile\n",my_errno));
+ fflush(stderr);
goto end;
com_err:
+ fflush(stdout);
VOID(fprintf(stderr,"Got error %d, expected %d on command %s at %s\n",
my_errno,result,command_name[command],
llstr(isamlog_filepos,llbuff)));
+ fflush(stderr);
end:
end_key_cache();
delete_tree(&tree);
@@ -792,6 +811,7 @@ static int close_some_file(TREE *tree)
(void*) &access_param,left_root_right));
if (!access_param.found)
return 1; /* No open file that is possibly to close */
+ access_param.found->rnd=access_param.found->isam->s->rnd;
if (mi_close(access_param.found->isam))
return 1;
access_param.found->closed=1;
@@ -811,6 +831,7 @@ static int reopen_closed_file(TREE *tree, struct file_info *fileinfo)
if (!(fileinfo->isam= mi_open(name,O_RDWR,HA_OPEN_WAIT_IF_LOCKED)))
return 1;
fileinfo->closed=0;
+ fileinfo->isam->s->rnd=fileinfo->rnd;
re_open_count++;
return 0;
}
diff --git a/myisammrg/myrg_rkey.c b/myisammrg/myrg_rkey.c
index d66d5ec3fe7..7432366f348 100644
--- a/myisammrg/myrg_rkey.c
+++ b/myisammrg/myrg_rkey.c
@@ -45,6 +45,7 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
MI_INFO *mi;
int err;
byte *buf=((search_flag == HA_READ_KEY_EXACT) ? record: 0);
+ LINT_INIT(key_buff);
if (_myrg_init_queue(info,inx,search_flag))
return my_errno;
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index bfa9e5d8711..c18d37888b8 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -30,10 +30,9 @@ static my_string NEAR_F expand_tilde(my_string *path);
/* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */
/* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */
+ /* to may be == from */
void pack_dirname(my_string to, const char *from)
-
- /* to may be == from */
{
int cwd_err;
uint d_length,length,buff_length;
diff --git a/mysys/my_fstream.c b/mysys/my_fstream.c
index 76bd12abe32..d93caadbcdc 100644
--- a/mysys/my_fstream.c
+++ b/mysys/my_fstream.c
@@ -20,6 +20,7 @@
#include "mysys_priv.h"
#include "mysys_err.h"
#include <errno.h>
+#include <stdio.h>
#ifdef HAVE_FSEEKO
#undef ftell
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index f9ee7595433..5f156622901 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -388,7 +388,6 @@ int ha_berkeley::close(void)
bool ha_berkeley::fix_rec_buff_for_blob(ulong length)
{
- uint extra;
if (! rec_buff || length > alloced_rec_buff_length)
{
byte *newptr;
@@ -663,7 +662,7 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
const byte * new_row, DBT *prim_key)
{
DBT row, old_key;
- int error,new_error;
+ int error;
DBUG_ENTER("update_primary_key");
if (primary_key_changed)
@@ -705,9 +704,8 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
int ha_berkeley::update_row(const byte * old_row, byte * new_row)
{
- DBT row, prim_key, key, old_prim_key;
+ DBT prim_key, key, old_prim_key;
int error;
- uint keynr;
DB_TXN *sub_trans;
bool primary_key_changed;
DBUG_ENTER("update_row");
@@ -1242,7 +1240,7 @@ THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to,
static int create_sub_table(const char *table_name, const char *sub_name,
DBTYPE type, int flags)
{
- int error,error2;
+ int error;
DB *file;
DBUG_ENTER("create_sub_table");
DBUG_PRINT("enter",("sub_name: %s",sub_name));
diff --git a/sql/handler.cc b/sql/handler.cc
index ccd958664a7..68d12a96f98 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -37,7 +37,6 @@
/* static functions defined in this file */
-static void NEAR_F set_form_timestamp(TABLE *table, byte *record);
static int NEAR_F delete_file(const char *name,const char *ext,int extflag);
ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count,
diff --git a/sql/item_func.cc b/sql/item_func.cc
index eada5d03079..3ea7eadd238 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -775,7 +775,10 @@ longlong Item_func_locate::val_int()
return 0; /* purecov: inspected */
}
null_value=0;
- uint start=0,start0=0;
+ uint start=0;
+#ifdef USE_MB
+ uint start0=0;
+#endif
if (arg_count == 3)
{
start=(uint) args[2]->val_int()-1;
diff --git a/sql/item_func.h b/sql/item_func.h
index 0eae4512ab4..68ec61db2c1 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -843,7 +843,7 @@ public:
FT_DOCLIST *ft_handler;
Item_func_match(List<Item> &a, Item *b): Item_real_func(b),
- fields(a), table(0), ft_handler(0), master(0) {}
+ fields(a), table(0), master(0), ft_handler(0) {}
~Item_func_match()
{
if (!master)
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index dac1fe0bd68..14bf2700378 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -412,7 +412,6 @@ net_real_write(NET *net,const char *packet,ulong len)
static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
{
- char buff[1024];
ALARM alarm_buff;
uint retry_count=0;
if (!thr_alarm_in_use(alarmed))
diff --git a/sql/slave.cc b/sql/slave.cc
index 7fcfb803ac1..f8746c78e49 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -516,7 +516,6 @@ command");
static uint read_event(MYSQL* mysql, MASTER_INFO *mi)
{
uint len = packet_error;
- NET* net = &mysql->net;
int read_errno = EINTR; // for convinience lets think we start by
// being in the interrupted state :-)
// my_real_read() will time us out
@@ -543,251 +542,250 @@ static uint read_event(MYSQL* mysql, MASTER_INFO *mi)
}
DBUG_PRINT("info",( "len=%u, net->read_pos[4] = %d\n",
- len, net->read_pos[4]));
+ len, mysql->net.read_pos[4]));
return len - 1;
}
+
static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{
- Log_event * ev = Log_event::read_log_event((const char*)net->read_pos + 1 , event_len);
- if(ev)
- {
- switch(ev->get_type_code())
+ Log_event * ev = Log_event::read_log_event((const char*)net->read_pos + 1,
+ event_len);
+ if (ev)
+ {
+ switch(ev->get_type_code())
+ {
+ case QUERY_EVENT:
+ {
+ Query_log_event* qev = (Query_log_event*)ev;
+ int q_len = qev->q_len;
+ init_sql_alloc(&thd->mem_root, 8192,0);
+ thd->db = (char*)qev->db;
+ if(db_ok(thd->db, replicate_do_db, replicate_ignore_db))
+ {
+ thd->query = (char*)qev->query;
+ thd->set_time((time_t)qev->when);
+ thd->current_tablenr = 0;
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
+ thd->query_id = query_id++;
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ thd->last_nx_table = thd->last_nx_db = 0;
+ for(;;)
{
- case QUERY_EVENT:
+ thd->query_error = 0; // clear error
+ thd->last_nx_table = thd->last_nx_db = 0;
+ thd->net.last_errno = 0;
+ thd->net.last_error[0] = 0;
+ mysql_parse(thd, thd->query, q_len); // try query
+ if(!thd->query_error || slave_killed(thd)) // break if ok
+ break;
+ // if not ok
+ if(thd->last_nx_table && thd->last_nx_db)
{
- Query_log_event* qev = (Query_log_event*)ev;
- int q_len = qev->q_len;
- init_sql_alloc(&thd->mem_root, 8192,0);
- thd->db = (char*)qev->db;
- if(db_ok(thd->db, replicate_do_db, replicate_ignore_db))
- {
- thd->query = (char*)qev->query;
- thd->set_time((time_t)qev->when);
- thd->current_tablenr = 0;
- VOID(pthread_mutex_lock(&LOCK_thread_count));
- thd->query_id = query_id++;
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
- thd->last_nx_table = thd->last_nx_db = 0;
- for(;;)
- {
- thd->query_error = 0; // clear error
- thd->last_nx_table = thd->last_nx_db = 0;
- thd->net.last_errno = 0;
- thd->net.last_error[0] = 0;
- mysql_parse(thd, thd->query, q_len); // try query
- if(!thd->query_error || slave_killed(thd)) // break if ok
- break;
- // if not ok
- if(thd->last_nx_table && thd->last_nx_db)
- {
- // for now, let's just fail if the table is not
- // there, and not try to be a smart alec...
+ // for now, let's just fail if the table is not
+ // there, and not try to be a smart alec...
- // if table was not there
- //if(fetch_nx_table(thd,&glob_mi))
- // try to to fetch from master
- break; // if we can't, just break
- }
- else
- break; // if failed for some other reason, bail out
-
- // if fetched the table from master successfully
- // we need to restore query info in thd because
- // fetch_nx_table executes create table
- thd->query = (char*)qev->query;
- thd->set_time((time_t)qev->when);
- thd->current_tablenr = 0;
- }
- }
- thd->db = 0;// prevent db from being freed
- thd->query = 0; // just to be sure
- close_thread_tables(thd);
- free_root(&thd->mem_root,0);
- if (thd->query_error)
- {
- sql_print_error("Slave: error running query '%s' ",
- qev->query);
- return 1;
- }
- delete ev;
-
- if(thd->fatal_error)
- {
- sql_print_error("Slave: Fatal error running query '%s' ",
- thd->query);
- return 1;
- }
-
- mi->inc_pos(event_len);
- flush_master_info(mi);
- break;
+ // if table was not there
+ //if(fetch_nx_table(thd,&glob_mi))
+ // try to to fetch from master
+ break; // if we can't, just break
}
+ else
+ break; // if failed for some other reason, bail out
+
+ // if fetched the table from master successfully
+ // we need to restore query info in thd because
+ // fetch_nx_table executes create table
+ thd->query = (char*)qev->query;
+ thd->set_time((time_t)qev->when);
+ thd->current_tablenr = 0;
+ }
+ }
+ thd->db = 0;// prevent db from being freed
+ thd->query = 0; // just to be sure
+ close_thread_tables(thd);
+ free_root(&thd->mem_root,0);
+ if (thd->query_error)
+ {
+ sql_print_error("Slave: error running query '%s' ",
+ qev->query);
+ return 1;
+ }
+ delete ev;
+
+ if(thd->fatal_error)
+ {
+ sql_print_error("Slave: Fatal error running query '%s' ",
+ thd->query);
+ return 1;
+ }
+
+ mi->inc_pos(event_len);
+ flush_master_info(mi);
+ break;
+ }
- case LOAD_EVENT:
- {
- Load_log_event* lev = (Load_log_event*)ev;
- init_sql_alloc(&thd->mem_root, 8192,0);
- thd->db = (char*)lev->db;
- thd->query = 0;
- thd->query_error = 0;
+ case LOAD_EVENT:
+ {
+ Load_log_event* lev = (Load_log_event*)ev;
+ init_sql_alloc(&thd->mem_root, 8192,0);
+ thd->db = (char*)lev->db;
+ thd->query = 0;
+ thd->query_error = 0;
- if(db_ok(thd->db, replicate_do_db, replicate_ignore_db))
- {
- thd->set_time((time_t)lev->when);
- thd->current_tablenr = 0;
- VOID(pthread_mutex_lock(&LOCK_thread_count));
- thd->query_id = query_id++;
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
-
- enum enum_duplicates handle_dup = DUP_IGNORE;
- if(lev->sql_ex.opt_flags && REPLACE_FLAG)
- handle_dup = DUP_REPLACE;
- sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags && DUMPFILE_FLAG );
- String field_term(&lev->sql_ex.field_term, 1),
- enclosed(&lev->sql_ex.enclosed, 1), line_term(&lev->sql_ex.line_term,1),
- escaped(&lev->sql_ex.escaped, 1), line_start(&lev->sql_ex.line_start, 1);
+ if(db_ok(thd->db, replicate_do_db, replicate_ignore_db))
+ {
+ thd->set_time((time_t)lev->when);
+ thd->current_tablenr = 0;
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
+ thd->query_id = query_id++;
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
+
+ enum enum_duplicates handle_dup = DUP_IGNORE;
+ if(lev->sql_ex.opt_flags && REPLACE_FLAG)
+ handle_dup = DUP_REPLACE;
+ sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags && DUMPFILE_FLAG );
+ String field_term(&lev->sql_ex.field_term, 1),
+ enclosed(&lev->sql_ex.enclosed, 1), line_term(&lev->sql_ex.line_term,1),
+ escaped(&lev->sql_ex.escaped, 1), line_start(&lev->sql_ex.line_start, 1);
- ex.field_term = &field_term;
- if(lev->sql_ex.empty_flags & FIELD_TERM_EMPTY)
- ex.field_term->length(0);
+ ex.field_term = &field_term;
+ if(lev->sql_ex.empty_flags & FIELD_TERM_EMPTY)
+ ex.field_term->length(0);
- ex.enclosed = &enclosed;
- if(lev->sql_ex.empty_flags & ENCLOSED_EMPTY)
- ex.enclosed->length(0);
+ ex.enclosed = &enclosed;
+ if(lev->sql_ex.empty_flags & ENCLOSED_EMPTY)
+ ex.enclosed->length(0);
- ex.line_term = &line_term;
- if(lev->sql_ex.empty_flags & LINE_TERM_EMPTY)
- ex.line_term->length(0);
+ ex.line_term = &line_term;
+ if(lev->sql_ex.empty_flags & LINE_TERM_EMPTY)
+ ex.line_term->length(0);
- ex.line_start = &line_start;
- if(lev->sql_ex.empty_flags & LINE_START_EMPTY)
- ex.line_start->length(0);
+ ex.line_start = &line_start;
+ if(lev->sql_ex.empty_flags & LINE_START_EMPTY)
+ ex.line_start->length(0);
- ex.escaped = &escaped;
- if(lev->sql_ex.empty_flags & ESCAPED_EMPTY)
- ex.escaped->length(0);
+ ex.escaped = &escaped;
+ if(lev->sql_ex.empty_flags & ESCAPED_EMPTY)
+ ex.escaped->length(0);
- ex.opt_enclosed = (lev->sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
- if(lev->sql_ex.empty_flags & FIELD_TERM_EMPTY)
- ex.field_term->length(0);
+ ex.opt_enclosed = (lev->sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
+ if(lev->sql_ex.empty_flags & FIELD_TERM_EMPTY)
+ ex.field_term->length(0);
- ex.skip_lines = lev->skip_lines;
+ ex.skip_lines = lev->skip_lines;
- TABLE_LIST tables;
- bzero((char*) &tables,sizeof(tables));
- tables.db = thd->db;
- tables.name = tables.real_name = (char*)lev->table_name;
- tables.lock_type = TL_WRITE;
+ TABLE_LIST tables;
+ bzero((char*) &tables,sizeof(tables));
+ tables.db = thd->db;
+ tables.name = tables.real_name = (char*)lev->table_name;
+ tables.lock_type = TL_WRITE;
- if (open_tables(thd, &tables))
- {
- sql_print_error("Slave: error opening table %s ",
- tables.name);
- delete ev;
- return 1;
- }
-
- List<Item> fields;
- lev->set_fields(fields);
- thd->net.vio = net->vio;
- // mysql_load will use thd->net to read the file
- thd->net.pkt_nr = net->pkt_nr;
- // make sure the client does get confused
- // about the packet sequence
- if(mysql_load(thd, &ex, &tables, fields, handle_dup, 1,
- TL_WRITE))
- thd->query_error = 1;
- net->pkt_nr = thd->net.pkt_nr;
- }
- else // we will just ask the master to send us /dev/null if we do not want to
- // load the data :-)
- {
- (void)my_net_write(net, "\xfb/dev/null", 10);
- (void)net_flush(net);
- (void)my_net_read(net); // discard response
- send_ok(net); // the master expects it
- }
+ if (open_tables(thd, &tables))
+ {
+ sql_print_error("Slave: error opening table %s ",
+ tables.name);
+ delete ev;
+ return 1;
+ }
+
+ List<Item> fields;
+ lev->set_fields(fields);
+ thd->net.vio = net->vio;
+ // mysql_load will use thd->net to read the file
+ thd->net.pkt_nr = net->pkt_nr;
+ // make sure the client does get confused
+ // about the packet sequence
+ if(mysql_load(thd, &ex, &tables, fields, handle_dup, 1,
+ TL_WRITE))
+ thd->query_error = 1;
+ net->pkt_nr = thd->net.pkt_nr;
+ }
+ else // we will just ask the master to send us /dev/null if we do not want to
+ // load the data :-)
+ {
+ (void)my_net_write(net, "\xfb/dev/null", 10);
+ (void)net_flush(net);
+ (void)my_net_read(net); // discard response
+ send_ok(net); // the master expects it
+ }
- thd->net.vio = 0;
- thd->db = 0;// prevent db from being freed
- close_thread_tables(thd);
- if(thd->query_error)
- {
- int sql_error = thd->net.last_errno;
- if(!sql_error)
- sql_error = ER_UNKNOWN_ERROR;
+ thd->net.vio = 0;
+ thd->db = 0;// prevent db from being freed
+ close_thread_tables(thd);
+ if(thd->query_error)
+ {
+ int sql_error = thd->net.last_errno;
+ if(!sql_error)
+ sql_error = ER_UNKNOWN_ERROR;
- sql_print_error("Slave: error '%s' running load data infile ",
- ER(sql_error));
- delete ev;
- return 1;
- }
- delete ev;
+ sql_print_error("Slave: error '%s' running load data infile ",
+ ER(sql_error));
+ delete ev;
+ return 1;
+ }
+ delete ev;
- if(thd->fatal_error)
- {
- sql_print_error("Slave: Fatal error running query '%s' ",
- thd->query);
- return 1;
- }
-
- mi->inc_pos(event_len);
- flush_master_info(mi);
- break;
- }
+ if(thd->fatal_error)
+ {
+ sql_print_error("Slave: Fatal error running query '%s' ",
+ thd->query);
+ return 1;
+ }
+
+ mi->inc_pos(event_len);
+ flush_master_info(mi);
+ break;
+ }
- case START_EVENT:
- mi->inc_pos(event_len);
- flush_master_info(mi);
- break;
+ case START_EVENT:
+ mi->inc_pos(event_len);
+ flush_master_info(mi);
+ break;
- case STOP_EVENT:
- mi->inc_pos(event_len);
- flush_master_info(mi);
- break;
- case ROTATE_EVENT:
- {
- Rotate_log_event* rev = (Rotate_log_event*)ev;
- int ident_len = rev->ident_len;
- memcpy(mi->log_file_name, rev->new_log_ident,ident_len );
- mi->log_file_name[ident_len] = 0;
- mi->pos = 0;
- break;
- }
+ case STOP_EVENT:
+ mi->inc_pos(event_len);
+ flush_master_info(mi);
+ break;
+ case ROTATE_EVENT:
+ {
+ Rotate_log_event* rev = (Rotate_log_event*)ev;
+ int ident_len = rev->ident_len;
+ memcpy(mi->log_file_name, rev->new_log_ident,ident_len );
+ mi->log_file_name[ident_len] = 0;
+ mi->pos = 0;
+ break;
+ }
- case INTVAR_EVENT:
- {
- Intvar_log_event* iev = (Intvar_log_event*)ev;
- switch(iev->type)
- {
- case LAST_INSERT_ID_EVENT:
- thd->last_insert_id_used = 1;
- thd->last_insert_id = iev->val;
- break;
- case INSERT_ID_EVENT:
- thd->next_insert_id = iev->val;
- break;
+ case INTVAR_EVENT:
+ {
+ Intvar_log_event* iev = (Intvar_log_event*)ev;
+ switch(iev->type)
+ {
+ case LAST_INSERT_ID_EVENT:
+ thd->last_insert_id_used = 1;
+ thd->last_insert_id = iev->val;
+ break;
+ case INSERT_ID_EVENT:
+ thd->next_insert_id = iev->val;
+ break;
- }
- mi->inc_pos(event_len);
- flush_master_info(mi);
- break;
- }
- }
-
+ }
+ mi->inc_pos(event_len);
+ flush_master_info(mi);
+ break;
+ }
}
+
+ }
else
- {
- sql_print_error("Could not parse log event entry, check the master for binlog corruption\
+ {
+ sql_print_error("Could not parse log event entry, check the master for binlog corruption\n\
This may also be a network problem, or just a bug in the master or slave code");
- return 1;
- }
-
-
-
-return 0;
+ return 1;
+ }
+ return 0;
}
// slave thread
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 059b17c6d84..2db08045d89 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -553,11 +553,11 @@ bool select_dump::send_data(List<Item> &items)
}
while ((item=li++))
{
- Item_result result_type=item->result_type();
res=item->str_result(&tmp);
- if (!res)
+ if (!res) // If NULL
{
- if (my_b_write(&cache,(byte*) "",1)) goto err; // NULL
+ if (my_b_write(&cache,(byte*) "",1))
+ goto err;
}
else if (my_b_write(&cache,(byte*) res->ptr(),res->length()))
{
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 0fa7aaf1d88..ea6e09f6cb5 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -753,13 +753,11 @@ store_create_info(THD *thd, TABLE *table, String* packet)
for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
{
- if(j)
+ if (j)
packet->append(',');
- if(key_part->field)
+ if (key_part->field)
packet->append(key_part->field->field_name);
- KEY *key=table->key_info+i;
-
if (!key_part->field ||
(key_part->length !=
table->field[key_part->fieldnr-1]->key_length() &&