Merge mysql.com:/home/mydev/mysql-4.1

into mysql.com:/home/mydev/mysql-4.1-4100
This commit is contained in:
ingo@mysql.com 2005-06-02 10:02:08 +02:00
commit 3ba1b99034
57 changed files with 276 additions and 149 deletions

View File

@ -48,8 +48,8 @@ global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wch
c_warnings="$global_warnings -Wunused" c_warnings="$global_warnings -Wunused"
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor" cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
base_max_configs="--with-innodb --with-bdb --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio" base_max_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio"
max_leave_isam_configs="--with-innodb --with-bdb --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio --with-embedded-server" max_leave_isam_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio --with-embedded-server"
max_no_es_configs="$max_leave_isam_configs --without-isam" max_no_es_configs="$max_leave_isam_configs --without-isam"
max_configs="$max_no_es_configs --with-embedded-server" max_configs="$max_no_es_configs --with-embedded-server"

View File

@ -271,7 +271,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
option_wait=1; option_wait=1;
} }
else else
option_wait= ~0; option_wait= ~(uint)0;
break; break;
case '?': case '?':
case 'I': /* Info */ case 'I': /* Info */

View File

@ -16,11 +16,12 @@
/* This file is originally from the mysql distribution. Coded by monty */ /* This file is originally from the mysql distribution. Coded by monty */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
#include <my_global.h>
#include <my_sys.h> #include <my_sys.h>
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <m_ctype.h>

View File

@ -783,3 +783,9 @@ id aes_decrypt(str, 'bar')
1 foo 1 foo
2 NULL 2 NULL
DROP TABLE t1, t2; DROP TABLE t1, t2;
select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
field(0,NULL,1,0) field("",NULL,"bar","") field(0.0,NULL,1.0,0.0)
3 3 3
select field(NULL,1,2,NULL), field(NULL,1,2,0);
field(NULL,1,2,NULL) field(NULL,1,2,0)
0 0

View File

@ -72,7 +72,7 @@ T1 CREATE TABLE `T1` (
RENAME TABLE T1 TO T2; RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2"; SHOW TABLES LIKE "T2";
Tables_in_test (T2) Tables_in_test (T2)
t2 T2
SELECT * FROM t2; SELECT * FROM t2;
a a
1 1
@ -83,25 +83,25 @@ t3
RENAME TABLE T3 TO T1; RENAME TABLE T3 TO T1;
SHOW TABLES LIKE "T1"; SHOW TABLES LIKE "T1";
Tables_in_test (T1) Tables_in_test (T1)
t1 T1
ALTER TABLE T1 add b int; ALTER TABLE T1 add b int;
SHOW TABLES LIKE "T1"; SHOW TABLES LIKE "T1";
Tables_in_test (T1) Tables_in_test (T1)
t1 T1
ALTER TABLE T1 RENAME T2; ALTER TABLE T1 RENAME T2;
SHOW TABLES LIKE "T2"; SHOW TABLES LIKE "T2";
Tables_in_test (T2) Tables_in_test (T2)
t2 T2
LOCK TABLE T2 WRITE; LOCK TABLE T2 WRITE;
ALTER TABLE T2 drop b; ALTER TABLE T2 drop b;
SHOW TABLES LIKE "T2"; SHOW TABLES LIKE "T2";
Tables_in_test (T2) Tables_in_test (T2)
t2 T2
UNLOCK TABLES; UNLOCK TABLES;
RENAME TABLE T2 TO T1; RENAME TABLE T2 TO T1;
SHOW TABLES LIKE "T1"; SHOW TABLES LIKE "T1";
Tables_in_test (T1) Tables_in_test (T1)
t1 T1
SELECT * from T1; SELECT * from T1;
a a
1 1

View File

@ -9,6 +9,7 @@ BEGIN;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
OPTIMIZE TABLE t1; OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize error Lock wait timeout exceeded; try restarting transaction
test.t1 optimize status Operation failed test.t1 optimize status Operation failed
OPTIMIZE TABLE non_existing; OPTIMIZE TABLE non_existing;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text

View File

@ -521,3 +521,9 @@ SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bug #10944: Mishandling of NULL arguments in FIELD()
#
select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
select field(NULL,1,2,NULL), field(NULL,1,2,0);

View File

@ -70,6 +70,8 @@
tonu@mysql.com & monty@mysql.com tonu@mysql.com & monty@mysql.com
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -14,7 +14,9 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 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 #pragma implementation // gcc: Class implementation
#endif #endif
@ -575,7 +577,7 @@ int ha_archive::write_row(byte * buf)
written= gzwrite(share->archive_write, buf, table->reclength); written= gzwrite(share->archive_write, buf, table->reclength);
DBUG_PRINT("ha_archive::get_row", ("Wrote %d bytes expected %d", written, table->reclength)); DBUG_PRINT("ha_archive::get_row", ("Wrote %d bytes expected %d", written, table->reclength));
share->dirty= TRUE; share->dirty= TRUE;
if (written != table->reclength) if (written != (z_off_t)table->reclength)
goto error; goto error;
/* /*
We should probably mark the table as damagaged if the record is written We should probably mark the table as damagaged if the record is written
@ -590,7 +592,7 @@ int ha_archive::write_row(byte * buf)
{ {
(*field)->get_ptr(&ptr); (*field)->get_ptr(&ptr);
written= gzwrite(share->archive_write, ptr, (unsigned)size); written= gzwrite(share->archive_write, ptr, (unsigned)size);
if (written != size) if (written != (z_off_t)size)
goto error; goto error;
} }
} }
@ -613,7 +615,6 @@ error:
int ha_archive::rnd_init(bool scan) int ha_archive::rnd_init(bool scan)
{ {
DBUG_ENTER("ha_archive::rnd_init"); DBUG_ENTER("ha_archive::rnd_init");
int read; // gzread() returns int, and we use this to check the header
/* We rewind the file so that we can read from the beginning if scan */ /* We rewind the file so that we can read from the beginning if scan */
if (scan) if (scan)
@ -747,7 +748,7 @@ int ha_archive::rnd_pos(byte * buf, byte *pos)
DBUG_ENTER("ha_archive::rnd_pos"); DBUG_ENTER("ha_archive::rnd_pos");
statistic_increment(ha_read_rnd_count,&LOCK_status); statistic_increment(ha_read_rnd_count,&LOCK_status);
current_position= ha_get_ptr(pos, ref_length); current_position= ha_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)); DBUG_RETURN(get_row(archive, buf));
} }

View File

@ -63,7 +63,9 @@
-Brian -Brian
*/ */
#ifdef __GNUC__ #include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
@ -150,10 +152,8 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
return share; return share;
error2:
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
error: error:
pthread_mutex_destroy(&share->mutex);
pthread_mutex_unlock(&example_mutex); pthread_mutex_unlock(&example_mutex);
my_free((gptr) share, MYF(0)); my_free((gptr) share, MYF(0));

View File

@ -20,10 +20,10 @@
First off, this is a play thing for me, there are a number of things wrong with it: 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. *) 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 *) 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). *) NULLs and "" are treated equally (like a spreadsheet).
*) There was in the beginning no point to anyone seeing this other then me, so there *) 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" *) Less design, more "make it work"
Now there are a few cool things with it: Now there are a few cool things with it:
@ -38,7 +38,9 @@ TODO:
-Brian -Brian
*/ */
#ifdef __GNUC__ #include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
@ -89,12 +91,12 @@ int get_mmap(TINA_SHARE *share, int write)
{ {
if (write) if (write)
share->mapped_file= (byte *)mmap(NULL, share->file_stat.st_size, share->mapped_file= (byte *)mmap(NULL, share->file_stat.st_size,
PROT_READ|PROT_WRITE, MAP_SHARED, PROT_READ|PROT_WRITE, MAP_SHARED,
share->data_file, 0); share->data_file, 0);
else else
share->mapped_file= (byte *)mmap(NULL, share->file_stat.st_size, share->mapped_file= (byte *)mmap(NULL, share->file_stat.st_size,
PROT_READ, MAP_PRIVATE, PROT_READ, MAP_PRIVATE,
share->data_file, 0); share->data_file, 0);
if ((share->mapped_file ==(caddr_t)-1)) 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]; char data_file_name[FN_REFLEN];
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&share, sizeof(*share), &share, sizeof(*share),
&tmp_name, length+1, &tmp_name, length+1,
NullS)) NullS))
{ {
pthread_mutex_unlock(&tina_mutex); pthread_mutex_unlock(&tina_mutex);
return NULL; return NULL;
@ -341,7 +343,6 @@ int ha_tina::find_current_row(byte *buf)
for (Field **field=table->field ; *field ; field++) for (Field **field=table->field ; *field ; field++)
{ {
int x;
buffer.length(0); buffer.length(0);
mapped_ptr++; // Increment past the first quote mapped_ptr++; // Increment past the first quote
for(;mapped_ptr != end_ptr; mapped_ptr++) for(;mapped_ptr != end_ptr; mapped_ptr++)
@ -735,29 +736,17 @@ int ha_tina::rnd_end()
beginning so that we move the smallest amount of data possible. beginning so that we move the smallest amount of data possible.
*/ */
qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set), (qsort_cmp)sort_set); 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++) 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 */ /* 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) 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, memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
length - (size_t)ptr->end); length - (size_t)ptr->end);
}
else else
{ memmove((caddr_t)share->mapped_file + ptr->begin, (caddr_t)share->mapped_file + ptr->end,
printf("Shifting %d(%d) to %d\n", (int)ptr->end, (int)((ptr++)->begin - (size_t)ptr->end), (int)ptr->begin); (size_t)((ptr++)->begin - ptr->end));
memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
(size_t)(ptr++)->begin - (size_t)ptr->end);
}
length= length - (size_t)(ptr->end - ptr->begin); length= length - (size_t)(ptr->end - ptr->begin);
} }
printf("Buffer %s\n",share->mapped_file);
/* Truncate the file to the new size */ /* Truncate the file to the new size */
if (my_chsize(share->data_file, length, 0, MYF(MY_WME))) if (my_chsize(share->data_file, length, 0, MYF(MY_WME)))
@ -840,7 +829,7 @@ int ha_tina::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_i
DBUG_ENTER("ha_tina::create"); DBUG_ENTER("ha_tina::create");
if ((create_file= my_create(fn_format(name_buff,name,"",".CSV",MY_REPLACE_EXT|MY_UNPACK_FILENAME),0, 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); DBUG_RETURN(-1);
my_close(create_file,MYF(0)); my_close(create_file,MYF(0));

View File

@ -19,6 +19,8 @@
** This file implements classes defined in field.h ** This file implements classes defined in field.h
*****************************************************************************/ *****************************************************************************/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -47,6 +47,8 @@
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
@ -484,7 +486,6 @@ int ha_heap::create(const char *name, TABLE *table_arg,
for (; key_part != key_part_end; key_part++, seg++) for (; key_part != key_part_end; key_part++, seg++)
{ {
uint flag= key_part->key_type;
Field *field= key_part->field; Field *field= key_part->field;
if (pos->algorithm == HA_KEY_ALG_BTREE) if (pos->algorithm == HA_KEY_ALG_BTREE)
seg->type= field->key_type(); seg->type= field->key_type();

View File

@ -28,6 +28,8 @@ have disables the InnoDB inlining in this file. */
in Windows? in Windows?
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -20,6 +20,8 @@
NDB Cluster NDB Cluster
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -17,6 +17,8 @@
/* Handler-calling-functions */ /* Handler-calling-functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -20,6 +20,8 @@
** to usage. ** to usage.
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -17,6 +17,8 @@
/* This file defines all compare functions */ /* This file defines all compare functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -17,6 +17,8 @@
/* This file defines all numerical functions */ /* This file defines all numerical functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
@ -1488,6 +1490,10 @@ void Item_func_locate::print(String *str)
longlong Item_func_field::val_int() longlong Item_func_field::val_int()
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
if (args[0]->null_value)
return 0;
if (cmp_type == STRING_RESULT) if (cmp_type == STRING_RESULT)
{ {
String *field; String *field;
@ -1505,8 +1511,8 @@ longlong Item_func_field::val_int()
longlong val= args[0]->val_int(); longlong val= args[0]->val_int();
for (uint i=1; i < arg_count ; i++) for (uint i=1; i < arg_count ; i++)
{ {
if (val == args[i]->val_int()) if (!args[i]->null_value && val == args[i]->val_int())
return (longlong) (i); return (longlong) (i);
} }
} }
else else
@ -1514,8 +1520,8 @@ longlong Item_func_field::val_int()
double val= args[0]->val(); double val= args[0]->val();
for (uint i=1; i < arg_count ; i++) for (uint i=1; i < arg_count ; i++)
{ {
if (val == args[i]->val()) if (!args[i]->null_value && val == args[i]->val())
return (longlong) (i); return (longlong) (i);
} }
} }
return 0; return 0;

View File

@ -17,6 +17,8 @@
/* This file defines all spatial functions */ /* This file defines all spatial functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -20,6 +20,8 @@
** (This shouldn't be needed) ** (This shouldn't be needed)
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -22,6 +22,8 @@ SUBSELECT TODO:
(sql_select.h/sql_select.cc) (sql_select.h/sql_select.cc)
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
@ -379,9 +381,6 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
return RES_REDUCE; return RES_REDUCE;
} }
return RES_OK; return RES_OK;
err:
return RES_ERROR;
} }
void Item_singlerow_subselect::store(uint i, Item *item) void Item_singlerow_subselect::store(uint i, Item *item)

View File

@ -17,6 +17,8 @@
/* Sum functions (COUNT, MIN...) */ /* Sum functions (COUNT, MIN...) */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -17,6 +17,8 @@
/* This file defines all time functions */ /* This file defines all time functions */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -15,6 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Compability file */ /* Compability file */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation #pragma implementation
#endif #endif

View File

@ -16,6 +16,9 @@
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -3355,7 +3355,7 @@ static int bootstrap(FILE *file)
thd->client_capabilities=0; thd->client_capabilities=0;
my_net_init(&thd->net,(st_vio*) 0); my_net_init(&thd->net,(st_vio*) 0);
thd->max_client_packet_length= thd->net.max_packet; thd->max_client_packet_length= thd->net.max_packet;
thd->master_access= ~0; thd->master_access= ~(ulong)0;
thd->thread_id=thread_id++; thd->thread_id=thread_id++;
thread_count++; thread_count++;
@ -5574,12 +5574,6 @@ static void print_version(void)
server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT); server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
} }
static void use_help(void)
{
print_version();
printf("Use '--help' or '--no-defaults --help' for a list of available options\n");
}
static void usage(void) static void usage(void)
{ {
if (!(default_charset_info= get_charset_by_csname(default_character_set_name, if (!(default_charset_info= get_charset_by_csname(default_character_set_name,

View File

@ -23,6 +23,8 @@
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -143,7 +143,7 @@ class SQL_SELECT :public Sql_alloc {
~SQL_SELECT(); ~SQL_SELECT();
void cleanup(); void cleanup();
bool check_quick(THD *thd, bool force_quick_range, ha_rows limit) bool check_quick(THD *thd, bool force_quick_range, ha_rows limit)
{ return test_quick_select(thd, key_map(~0), 0, limit, force_quick_range) < 0; } { return test_quick_select(thd, key_map(~(uint)0), 0, limit, force_quick_range) < 0; }
inline bool skip_record() { return cond ? cond->val_int() == 0 : 0; } inline bool skip_record() { return cond ? cond->val_int() == 0 : 0; }
int test_quick_select(THD *thd, key_map keys, table_map prev_tables, int test_quick_select(THD *thd, key_map keys, table_map prev_tables,
ha_rows limit, bool force_quick_range=0); ha_rows limit, bool force_quick_range=0);

View File

@ -17,6 +17,8 @@
/* Procedures (functions with changes output of select) */ /* Procedures (functions with changes output of select) */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -19,6 +19,8 @@
The actual communction is handled by the net_xxx functions in net_serv.cc The actual communction is handled by the net_xxx functions in net_serv.cc
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -19,6 +19,8 @@
The actual communction is handled by the net_xxx functions in net_serv.cc The actual communction is handled by the net_xxx functions in net_serv.cc
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -71,7 +71,7 @@ static int init_failsafe_rpl_thread(THD* thd)
my_net_init(&thd->net, 0); my_net_init(&thd->net, 0);
thd->net.read_timeout = slave_net_timeout; thd->net.read_timeout = slave_net_timeout;
thd->max_client_packet_length=thd->net.max_packet; thd->max_client_packet_length=thd->net.max_packet;
thd->master_access= ~0; thd->master_access= ~(ulong)0;
thd->priv_user = 0; thd->priv_user = 0;
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
thd->thread_id = thread_id++; thd->thread_id = thread_id++;

View File

@ -48,6 +48,8 @@
new attribute. new attribute.
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -2577,7 +2577,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
thd->client_capabilities = 0; thd->client_capabilities = 0;
my_net_init(&thd->net, 0); my_net_init(&thd->net, 0);
thd->net.read_timeout = slave_net_timeout; thd->net.read_timeout = slave_net_timeout;
thd->master_access= ~0; thd->master_access= ~(ulong)0;
thd->priv_user = 0; thd->priv_user = 0;
thd->slave_thread = 1; thd->slave_thread = 1;
/* /*

View File

@ -1002,7 +1002,7 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
ulong acl_get(const char *host, const char *ip, ulong acl_get(const char *host, const char *ip,
const char *user, const char *db, my_bool db_is_pattern) const char *user, const char *db, my_bool db_is_pattern)
{ {
ulong host_access= ~0,db_access= 0; ulong host_access= ~(ulong)0,db_access= 0;
uint i,key_length; uint i,key_length;
char key[ACL_KEY_LENGTH],*tmp_db,*end; char key[ACL_KEY_LENGTH],*tmp_db,*end;
acl_entry *entry; acl_entry *entry;
@ -3673,7 +3673,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
} }
if (replace_user_table(thd, tables[0].table, if (replace_user_table(thd, tables[0].table,
*lex_user, ~0, 1, 0)) *lex_user, ~(ulong)0, 1, 0))
{ {
result= -1; result= -1;
continue; continue;
@ -3700,7 +3700,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
if (!strcmp(lex_user->user.str,user) && if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(system_charset_info, lex_user->host.str, host)) !my_strcasecmp(system_charset_info, lex_user->host.str, host))
{ {
if (!replace_db_table(tables[1].table, acl_db->db, *lex_user, ~0, 1)) if (!replace_db_table(tables[1].table, acl_db->db, *lex_user, ~(ulong)0, 1))
{ {
/* /*
Don't increment counter as replace_db_table deleted the Don't increment counter as replace_db_table deleted the
@ -3734,7 +3734,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
if (replace_table_table(thd,grant_table,tables[2].table,*lex_user, if (replace_table_table(thd,grant_table,tables[2].table,*lex_user,
grant_table->db, grant_table->db,
grant_table->tname, grant_table->tname,
~0, 0, 1)) ~(ulong)0, 0, 1))
{ {
result= -1; result= -1;
} }
@ -3750,7 +3750,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
columns, columns,
grant_table->db, grant_table->db,
grant_table->tname, grant_table->tname,
~0, 1)) ~(ulong)0, 1))
{ {
revoked= 1; revoked= 1;
continue; continue;

View File

@ -23,6 +23,8 @@
** - type set is out of optimization yet ** - type set is out of optimization yet
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -22,6 +22,8 @@
** **
*****************************************************************************/ *****************************************************************************/
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -23,6 +23,8 @@
needs something like 'ssh'. needs something like 'ssh'.
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -1443,7 +1443,7 @@ bool delayed_insert::handle_inserts(void)
if (thd.killed || table->version != refresh_version) if (thd.killed || table->version != refresh_version)
{ {
thd.killed=1; thd.killed=1;
max_rows= ~0; // Do as much as possible max_rows= ~(uint)0; // Do as much as possible
} }
/* /*

View File

@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -28,6 +28,8 @@
#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1 #ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif

View File

@ -561,7 +561,6 @@ bool is_update_query(enum enum_sql_command command)
static void time_out_user_resource_limits(THD *thd, USER_CONN *uc) static void time_out_user_resource_limits(THD *thd, USER_CONN *uc)
{ {
bool error= 0;
time_t check_time = thd->start_time ? thd->start_time : time(NULL); time_t check_time = thd->start_time ? thd->start_time : time(NULL);
DBUG_ENTER("time_out_user_resource_limits"); DBUG_ENTER("time_out_user_resource_limits");
@ -587,7 +586,6 @@ static bool check_mqh(THD *thd, uint check_command)
{ {
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
bool error= 0; bool error= 0;
time_t check_time = thd->start_time ? thd->start_time : time(NULL);
USER_CONN *uc=thd->user_connect; USER_CONN *uc=thd->user_connect;
DBUG_ENTER("check_mqh"); DBUG_ENTER("check_mqh");
DBUG_ASSERT(uc != 0); DBUG_ASSERT(uc != 0);

View File

@ -17,6 +17,8 @@
/* mysql_select and join optimization */ /* mysql_select and join optimization */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
@ -34,7 +36,7 @@ const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
}; };
const key_map key_map_empty(0); const key_map key_map_empty(0);
const key_map key_map_full(~0); const key_map key_map_full(~(uint)0);
static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array); static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array);
static bool make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, static bool make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
@ -3450,7 +3452,7 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
join_tab->select_cond=0; join_tab->select_cond=0;
join_tab->quick=0; join_tab->quick=0;
join_tab->type= JT_ALL; /* Map through all records */ join_tab->type= JT_ALL; /* Map through all records */
join_tab->keys.init(~0); /* test everything in quick */ join_tab->keys.init(~(uint)0); /* test everything in quick */
join_tab->info=0; join_tab->info=0;
join_tab->on_expr=0; join_tab->on_expr=0;
join_tab->ref.key = -1; join_tab->ref.key = -1;

View File

@ -16,11 +16,12 @@
/* This file is originally from the mysql distribution. Coded by monty */ /* This file is originally from the mysql distribution. Coded by monty */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
#include <my_global.h>
#include <my_sys.h> #include <my_sys.h>
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <m_ctype.h>

View File

@ -40,6 +40,34 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
uint order_num, ORDER *order, uint order_num, ORDER *order,
ha_rows *copied,ha_rows *deleted); ha_rows *copied,ha_rows *deleted);
/*
Build the path to a file for a table (or the base path that can
then have various extensions stuck on to it).
SYNOPSIS
build_table_path()
buff Buffer to build the path into
bufflen sizeof(buff)
db Name of database
table Name of table
ext Filename extension
RETURN
0 Error
# Size of path
*/
static uint build_table_path(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext)
{
strxnmov(buff, bufflen-1, mysql_data_home, "/", db, "/", table, ext,
NullS);
return unpack_filename(buff,buff);
}
/* /*
delete (drop) tables. delete (drop) tables.
@ -214,8 +242,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
DBUG_RETURN(-1); DBUG_RETURN(-1);
alias= (lower_case_table_names == 2) ? table->alias : table->real_name; alias= (lower_case_table_names == 2) ? table->alias : table->real_name;
/* remove form file and isam files */ /* remove form file and isam files */
strxmov(path, mysql_data_home, "/", db, "/", alias, reg_ext, NullS); build_table_path(path, sizeof(path), db, alias, reg_ext);
(void) unpack_filename(path,path);
} }
if (drop_temporary || if (drop_temporary ||
(access(path,F_OK) && ha_create_table_from_engine(thd,db,alias,TRUE))) (access(path,F_OK) && ha_create_table_from_engine(thd,db,alias,TRUE)))
@ -295,13 +322,10 @@ int quick_rm_table(enum db_type base,const char *db,
{ {
char path[FN_REFLEN]; char path[FN_REFLEN];
int error=0; int error=0;
my_snprintf(path, sizeof(path), "%s/%s/%s%s", build_table_path(path, sizeof(path), db, table_name, reg_ext);
mysql_data_home, db, table_name, reg_ext);
unpack_filename(path,path);
if (my_delete(path,MYF(0))) if (my_delete(path,MYF(0)))
error=1; /* purecov: inspected */ error=1; /* purecov: inspected */
my_snprintf(path, sizeof(path), "%s/%s/%s", mysql_data_home, db, table_name); build_table_path(path, sizeof(path), db, table_name, "");
unpack_filename(path,path);
return ha_delete_table(base,path) || error; return ha_delete_table(base,path) || error;
} }
@ -1299,11 +1323,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (!create_info->default_table_charset) if (!create_info->default_table_charset)
{ {
HA_CREATE_INFO db_info; HA_CREATE_INFO db_info;
uint length;
char path[FN_REFLEN]; char path[FN_REFLEN];
strxmov(path, mysql_data_home, "/", db, NullS); /* Abuse build_table_path() to build the path to the db.opt file */
length= unpack_dirname(path,path); // Convert if not unix build_table_path(path, sizeof(path), db, MY_DB_OPT_FILE, "");
strmov(path+length, MY_DB_OPT_FILE);
load_db_opt(thd, path, &db_info); load_db_opt(thd, path, &db_info);
create_info->default_table_charset= db_info.default_table_charset; create_info->default_table_charset= db_info.default_table_charset;
} }
@ -1317,17 +1339,18 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
/* Check if table exists */ /* Check if table exists */
if (create_info->options & HA_LEX_CREATE_TMP_TABLE) if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{ {
my_snprintf(path, sizeof(path), "%s%s%lx_%lx_%x%s", char tmp_table_name[NAME_LEN+1];
mysql_tmpdir, tmp_file_prefix, current_pid, thd->thread_id, my_snprintf(tmp_table_name, sizeof(tmp_table_name), "%s%lx_%lx_%x",
thd->tmp_table++, reg_ext); tmp_file_prefix, current_pid, thd->thread_id,
thd->tmp_table++);
if (lower_case_table_names) if (lower_case_table_names)
my_casedn_str(files_charset_info, path); my_casedn_str(files_charset_info, tmp_table_name);
create_info->table_options|=HA_CREATE_DELAY_KEY_WRITE; create_info->table_options|=HA_CREATE_DELAY_KEY_WRITE;
build_table_path(path, sizeof(path), db, tmp_table_name, reg_ext);
} }
else else
my_snprintf(path, sizeof(path), "%s/%s/%s%s", mysql_data_home, db, build_table_path(path, sizeof(path), db, alias, reg_ext);
alias, reg_ext);
unpack_filename(path,path);
/* Check if table already exists */ /* Check if table already exists */
if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) if ((create_info->options & HA_LEX_CREATE_TMP_TABLE)
&& find_temporary_table(thd,db,table_name)) && find_temporary_table(thd,db,table_name))
@ -1560,37 +1583,41 @@ mysql_rename_table(enum db_type base,
const char *new_db, const char *new_db,
const char *new_name) const char *new_name)
{ {
char from[FN_REFLEN], to[FN_REFLEN]; char from[FN_REFLEN], to[FN_REFLEN], lc_from[FN_REFLEN], lc_to[FN_REFLEN];
char tmp_from[NAME_LEN+1], tmp_to[NAME_LEN+1]; char *from_base= from, *to_base= to;
char tmp_name[NAME_LEN+1];
handler *file=get_new_handler((TABLE*) 0, base); handler *file=get_new_handler((TABLE*) 0, base);
int error=0; int error=0;
DBUG_ENTER("mysql_rename_table"); DBUG_ENTER("mysql_rename_table");
build_table_path(from, sizeof(from), old_db, old_name, "");
build_table_path(to, sizeof(to), new_db, new_name, "");
/*
If lower_case_table_names == 2 (case-preserving but case-insensitive
file system) and the storage is not HA_FILE_BASED, we need to provide
a lowercase file name, but we leave the .frm in mixed case.
*/
if (lower_case_table_names == 2 && !(file->table_flags() & HA_FILE_BASED)) if (lower_case_table_names == 2 && !(file->table_flags() & HA_FILE_BASED))
{ {
/* Table handler expects to get all file names as lower case */ strmov(tmp_name, old_name);
strmov(tmp_from, old_name); my_casedn_str(files_charset_info, tmp_name);
my_casedn_str(files_charset_info, tmp_from); build_table_path(lc_from, sizeof(lc_from), old_db, tmp_name, "");
old_name= tmp_from; from_base= lc_from;
strmov(tmp_to, new_name); strmov(tmp_name, new_name);
my_casedn_str(files_charset_info, tmp_to); my_casedn_str(files_charset_info, tmp_name);
new_name= tmp_to; build_table_path(lc_to, sizeof(lc_to), new_db, tmp_name, "");
to_base= lc_to;
} }
my_snprintf(from, sizeof(from), "%s/%s/%s",
mysql_data_home, old_db, old_name);
my_snprintf(to, sizeof(to), "%s/%s/%s",
mysql_data_home, new_db, new_name);
fn_format(from,from,"","",4);
fn_format(to,to, "","",4);
if (!(error=file->rename_table((const char*) from,(const char *) to))) if (!(error=file->rename_table(from_base, to_base)))
{ {
if (rename_file_ext(from,to,reg_ext)) if (rename_file_ext(from,to,reg_ext))
{ {
error=my_errno; error=my_errno;
/* Restore old file name */ /* Restore old file name */
file->rename_table((const char*) to,(const char *) from); file->rename_table(to_base, from_base);
} }
} }
delete file; delete file;
@ -1768,8 +1795,8 @@ static int prepare_for_repair(THD* thd, TABLE_LIST *table_list,
if (!(table= table_list->table)) /* if open_ltable failed */ if (!(table= table_list->table)) /* if open_ltable failed */
{ {
char name[FN_REFLEN]; char name[FN_REFLEN];
strxmov(name, mysql_data_home, "/", table_list->db, "/", build_table_path(name, sizeof(name), table_list->db,
table_list->real_name, NullS); table_list->real_name, "");
if (openfrm(name, "", 0, 0, 0, &tmp_table)) if (openfrm(name, "", 0, 0, 0, &tmp_table))
DBUG_RETURN(0); // Can't open frm file DBUG_RETURN(0); // Can't open frm file
table= &tmp_table; table= &tmp_table;
@ -2052,6 +2079,28 @@ send_result_message:
((result_code= table->table->file->analyze(thd, check_opt)) > 0)) ((result_code= table->table->file->analyze(thd, check_opt)) > 0))
result_code= 0; // analyze went ok result_code= 0; // analyze went ok
} }
if (result_code) // either mysql_recreate_table or analyze failed
{
const char *err_msg;
if ((err_msg= thd->net.last_error))
{
if (!thd->vio_ok())
{
sql_print_error(err_msg);
}
else
{
/* Hijack the row already in-progress. */
protocol->store("error", 5, system_charset_info);
protocol->store(err_msg, system_charset_info);
(void)protocol->write();
/* Start off another row for HA_ADMIN_FAILED */
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info);
}
}
}
result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK; result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
table->next= save_next; table->next= save_next;
goto send_result_message; goto send_result_message;
@ -2570,11 +2619,10 @@ int mysql_create_indexes(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
else else
{ {
if (table->file->add_index(table, key_info_buffer, key_count)|| if (table->file->add_index(table, key_info_buffer, key_count)||
(my_snprintf(path, sizeof(path), "%s/%s/%s%s", mysql_data_home, build_table_path(path, sizeof(path), table_list->db,
table_list->db, (lower_case_table_names == 2) ? (lower_case_table_names == 2) ?
table_list->alias: table_list->real_name, reg_ext) >= table_list->alias : table_list->real_name,
(int) sizeof(path)) || reg_ext) != 0 ||
! unpack_filename(path, path) ||
mysql_create_frm(thd, path, &create_info, mysql_create_frm(thd, path, &create_info,
fields, key_count, key_info_buffer, table->file)) fields, key_count, key_info_buffer, table->file))
/* don't need to free((gptr) key_info_buffer);*/ /* don't need to free((gptr) key_info_buffer);*/
@ -2672,11 +2720,10 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
keys, /*tmp_table*/ 0, db_options, table->file, keys, /*tmp_table*/ 0, db_options, table->file,
key_info_buffer, key_count, key_info_buffer, key_count,
/*select_field_count*/ 0)|| /*select_field_count*/ 0)||
(snprintf(path, sizeof(path), "%s/%s/%s%s", mysql_data_home, build_table_path(path, sizeof(path), table_list->db,
table_list->db, (lower_case_table_names == 2)? (lower_case_table_names == 2) ?
table_list->alias: table_list->real_name, reg_ext)>= table_list->alias : table_list->real_name,
(int)sizeof(path))|| reg_ext) != 0 ||
! unpack_filename(path, path)||
mysql_create_frm(thd, path, &create_info, mysql_create_frm(thd, path, &create_info,
fields, key_count, key_info_buffer, table->file)) fields, key_count, key_info_buffer, table->file))
/*don't need to free((gptr) key_numbers);*/ /*don't need to free((gptr) key_numbers);*/
@ -3199,9 +3246,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
else else
{ {
char path[FN_REFLEN]; char path[FN_REFLEN];
my_snprintf(path, sizeof(path), "%s/%s/%s", mysql_data_home, build_table_path(path, sizeof(path), new_db, tmp_name, "");
new_db, tmp_name);
fn_format(path,path,"","",4);
new_table=open_temporary_table(thd, path, new_db, tmp_name,0); new_table=open_temporary_table(thd, path, new_db, tmp_name,0);
} }
if (!new_table) if (!new_table)
@ -3406,9 +3451,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
shutdown. shutdown.
*/ */
char path[FN_REFLEN]; char path[FN_REFLEN];
my_snprintf(path, sizeof(path), "%s/%s/%s", mysql_data_home, build_table_path(path, sizeof(path), new_db, table_name, "");
new_db, table_name);
fn_format(path,path,"","",4);
table=open_temporary_table(thd, path, new_db, tmp_name,0); table=open_temporary_table(thd, path, new_db, tmp_name,0);
if (table) if (table)
{ {

View File

@ -28,6 +28,8 @@
** dynamic functions, so this shouldn't be a real problem. ** dynamic functions, so this shouldn't be a real problem.
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: implement sql_udf.h #pragma implementation // gcc: implement sql_udf.h
#endif #endif

View File

@ -20,18 +20,20 @@
(We will refer to this code as to elsie-code further.) (We will refer to this code as to elsie-code further.)
*/ */
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
/* /*
We should not include mysql_priv.h in mysql_tzinfo_to_sql utility since We should not include mysql_priv.h in mysql_tzinfo_to_sql utility since
it creates unsolved link dependencies on some platforms. it creates unsolved link dependencies on some platforms.
*/ */
#include <my_global.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#if !defined(TZINFO2SQL) && !defined(TESTTIME) #if !defined(TZINFO2SQL) && !defined(TESTTIME)
#include "mysql_priv.h" #include "mysql_priv.h"
#else #else
#include <my_global.h>
#include <my_time.h> #include <my_time.h>
#include "tztime.h" #include "tztime.h"
#include <my_sys.h> #include <my_sys.h>

View File

@ -128,26 +128,32 @@ int vio_ssl_write(Vio * vio, const gptr buf, int size)
int vio_ssl_fastsend(Vio * vio __attribute__((unused))) int vio_ssl_fastsend(Vio * vio __attribute__((unused)))
{ {
int r= 0; int r=0;
DBUG_ENTER("vio_ssl_fastsend"); DBUG_ENTER("vio_ssl_fastsend");
#ifdef IPTOS_THROUGHPUT #if defined(IPTOS_THROUGHPUT) && !defined(__EMX__)
{ {
#ifndef __EMX__ int tos= IPTOS_THROUGHPUT;
int tos = IPTOS_THROUGHPUT; r= setsockopt(vio->sd, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(tos));
if (!setsockopt(vio->sd, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(tos))) }
#endif /* !__EMX__ */ #endif /* IPTOS_THROUGHPUT && !__EMX__ */
{ if (!r)
int nodelay = 1; {
if (setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (void *) &nodelay, #ifdef __WIN__
sizeof(nodelay))) { BOOL nodelay= 1;
DBUG_PRINT("warning", r= setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (const char*) &nodelay,
("Couldn't set socket option for fast send")); sizeof(nodelay));
r= -1; #else
} int nodelay= 1;
} r= setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (void*) &nodelay,
sizeof(nodelay));
#endif /* __WIN__ */
}
if (r)
{
DBUG_PRINT("warning", ("Couldn't set socket option for fast send"));
r= -1;
} }
#endif /* IPTOS_THROUGHPUT */
DBUG_PRINT("exit", ("%d", r)); DBUG_PRINT("exit", ("%d", r));
DBUG_RETURN(r); DBUG_RETURN(r);
} }
@ -424,6 +430,11 @@ void vio_ssl_timeout(Vio *vio __attribute__((unused)),
uint which __attribute__((unused)), uint which __attribute__((unused)),
uint timeout __attribute__((unused))) uint timeout __attribute__((unused)))
{ {
/* Not yet implemented (non critical) */ #ifdef __WIN__
ulong wait_timeout= (ulong) timeout * 1000;
(void) setsockopt(vio->sd, SOL_SOCKET,
which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout,
sizeof(wait_timeout));
#endif /* __WIN__ */
} }
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */