Commit 88aff4bf authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Updated manual about embedded version.

Speed up column-completion in 'mysql'
Don't use ISAM if HAVE_ISAM is not defined
A lot of fixes for the embedded version.  All libraries are now included in libmysqld.a
Changed arguments to convert_dirname() to make it more general.
Renamed files in the 'merge' directory to all use a common prefix.
Don't compile both assembler and C functions on x86
parent e8012350
...@@ -412,3 +412,5 @@ libmysqld/examples/sql_string.cc ...@@ -412,3 +412,5 @@ libmysqld/examples/sql_string.cc
libmysqld/examples/sql_string.h libmysqld/examples/sql_string.h
libmysqld/examples/mysql libmysqld/examples/mysql
libmysqld/examples/mysqltest libmysqld/examples/mysqltest
libmysqld/examples/test-gdbinit
scripts/mysql_explain_log
This diff is collapsed.
...@@ -854,6 +854,7 @@ dnl echo "DBG2: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" ...@@ -854,6 +854,7 @@ dnl echo "DBG2: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'"
no ) no )
bdb_includes= bdb_includes=
bdb_libs= bdb_libs=
bdb_libs_with_path=
;; ;;
supplied-two ) supplied-two )
MYSQL_CHECK_INSTALLED_BDB([$bdb_includes], [$bdb_libs]) MYSQL_CHECK_INSTALLED_BDB([$bdb_includes], [$bdb_libs])
...@@ -883,6 +884,7 @@ dnl echo "DBG2: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" ...@@ -883,6 +884,7 @@ dnl echo "DBG2: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'"
esac esac
bdb_includes= bdb_includes=
bdb_libs= bdb_libs=
bdb_libs_with_path=
;; ;;
esac esac
;; ;;
...@@ -911,6 +913,7 @@ dnl echo "DBG3: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" ...@@ -911,6 +913,7 @@ dnl echo "DBG3: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'"
AC_SUBST(bdb_includes) AC_SUBST(bdb_includes)
AC_SUBST(bdb_libs) AC_SUBST(bdb_libs)
AC_SUBST(bdb_libs_with_path)
]) ])
AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [ AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [
...@@ -931,6 +934,7 @@ dnl echo ["MYSQL_CHECK_INSTALLED_BDB ($1) ($2)"] ...@@ -931,6 +934,7 @@ dnl echo ["MYSQL_CHECK_INSTALLED_BDB ($1) ($2)"]
MYSQL_TOP_BUILDDIR([lib]) MYSQL_TOP_BUILDDIR([lib])
bdb_includes="-I$inc" bdb_includes="-I$inc"
bdb_libs="-L$lib -ldb" bdb_libs="-L$lib -ldb"
bdb_libs_with_path="$lib/libdb.a"
]) ])
LDFLAGS="$save_LDFLAGS" LDFLAGS="$save_LDFLAGS"
else else
...@@ -959,6 +963,7 @@ dnl echo ["MYSQL_CHECK_BDB_DIR ($1)"] ...@@ -959,6 +963,7 @@ dnl echo ["MYSQL_CHECK_BDB_DIR ($1)"]
MYSQL_TOP_BUILDDIR([dir]) MYSQL_TOP_BUILDDIR([dir])
bdb_includes="-I$dir/build_unix" bdb_includes="-I$dir/build_unix"
bdb_libs="-L$dir/build_unix -ldb" bdb_libs="-L$dir/build_unix -ldb"
bdb_libs_with_path="$dir/build_unix/libdb.a"
else else
bdb_dir_ok="$bdb_version_ok" bdb_dir_ok="$bdb_version_ok"
fi fi
...@@ -1070,6 +1075,7 @@ AC_DEFUN([MYSQL_CHECK_INNODB], [ ...@@ -1070,6 +1075,7 @@ AC_DEFUN([MYSQL_CHECK_INNODB], [
AC_DEFINE(HAVE_INNOBASE_DB) AC_DEFINE(HAVE_INNOBASE_DB)
have_innodb="yes" have_innodb="yes"
innodb_includes="-I../innobase/include" innodb_includes="-I../innobase/include"
innodb_system_libs=""
dnl Some libs are listed several times, in order for gcc to sort out dnl Some libs are listed several times, in order for gcc to sort out
dnl circular references. dnl circular references.
innodb_libs="\ innodb_libs="\
...@@ -1110,7 +1116,7 @@ dnl circular references. ...@@ -1110,7 +1116,7 @@ dnl circular references.
\$(top_builddir)/innobase/os/libos.a\ \$(top_builddir)/innobase/os/libos.a\
\$(top_builddir)/innobase/ut/libut.a" \$(top_builddir)/innobase/ut/libut.a"
AC_CHECK_LIB(rt, aio_read, [innodb_libs="$innodb_libs -lrt"]) AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
;; ;;
* ) * )
AC_MSG_RESULT([Not using Innodb]) AC_MSG_RESULT([Not using Innodb])
...@@ -1119,6 +1125,7 @@ dnl circular references. ...@@ -1119,6 +1125,7 @@ dnl circular references.
AC_SUBST(innodb_includes) AC_SUBST(innodb_includes)
AC_SUBST(innodb_libs) AC_SUBST(innodb_libs)
AC_SUBST(innodb_system_libs)
]) ])
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
......
...@@ -47,10 +47,12 @@ int completion_hash_init(HashTable *ht, uint nSize) ...@@ -47,10 +47,12 @@ int completion_hash_init(HashTable *ht, uint nSize)
ht->arBuckets = (Bucket **) my_malloc(nSize* sizeof(Bucket *), ht->arBuckets = (Bucket **) my_malloc(nSize* sizeof(Bucket *),
MYF(MY_ZEROFILL | MY_WME)); MYF(MY_ZEROFILL | MY_WME));
if (!ht->arBuckets) { if (!ht->arBuckets)
{
ht->initialized = 0; ht->initialized = 0;
return FAILURE; return FAILURE;
} }
init_alloc_root(&ht->mem_root, 8192, 0);
ht->pHashFunction = hashpjw; ht->pHashFunction = hashpjw;
ht->nTableSize = nSize; ht->nTableSize = nSize;
ht->initialized = 1; ht->initialized = 1;
...@@ -78,8 +80,7 @@ int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength, ...@@ -78,8 +80,7 @@ int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength,
if (!memcmp(p->arKey, arKey, nKeyLength)) { if (!memcmp(p->arKey, arKey, nKeyLength)) {
entry *n; entry *n;
n = (entry *) my_malloc(sizeof(entry), n = (entry *) alloc_root(&ht->mem_root,sizeof(entry));
MYF(MY_WME));
n->pNext = p->pData; n->pNext = p->pData;
n->str = str; n->str = str;
p->pData = n; p->pData = n;
...@@ -91,20 +92,16 @@ int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength, ...@@ -91,20 +92,16 @@ int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength,
p = p->pNext; p = p->pNext;
} }
p = (Bucket *) my_malloc(sizeof(Bucket),MYF(MY_WME)); if (!(p = (Bucket *) alloc_root(&ht->mem_root, sizeof(Bucket))))
if (!p) {
return FAILURE; return FAILURE;
}
p->arKey = arKey; p->arKey = arKey;
p->nKeyLength = nKeyLength; p->nKeyLength = nKeyLength;
p->h = h; p->h = h;
p->pData = (entry*) my_malloc(sizeof(entry),MYF(MY_WME)); if (!(p->pData = (entry*) alloc_root(&ht->mem_root, sizeof(entry))))
if (!p->pData) {
my_free((gptr) p,MYF(0));
return FAILURE; return FAILURE;
}
p->pData->str = str; p->pData->str = str;
p->pData->pNext = 0; p->pData->pNext = 0;
p->count = 1; p->count = 1;
...@@ -209,24 +206,7 @@ Bucket *find_longest_match(HashTable *ht, char *str, uint length, ...@@ -209,24 +206,7 @@ Bucket *find_longest_match(HashTable *ht, char *str, uint length,
void completion_hash_clean(HashTable *ht) void completion_hash_clean(HashTable *ht)
{ {
uint i; free_root(&ht->mem_root,MYF(0));
entry *e, *t;
Bucket *b, *tmp;
for (i=0; i<ht->nTableSize; i++) {
b = ht->arBuckets[i];
while (b) {
e = b->pData;
while (e) {
t = e;
e = e->pNext;
my_free((gptr) t,MYF(0));
}
tmp = b;
b = b->pNext;
my_free((gptr) tmp,MYF(0));
}
}
bzero((char*) ht->arBuckets,ht->nTableSize*sizeof(Bucket *)); bzero((char*) ht->arBuckets,ht->nTableSize*sizeof(Bucket *));
} }
...@@ -241,9 +221,7 @@ void completion_hash_free(HashTable *ht) ...@@ -241,9 +221,7 @@ void completion_hash_free(HashTable *ht)
void add_word(HashTable *ht,char *str) void add_word(HashTable *ht,char *str)
{ {
int i; int i;
int length= (int) strlen(str); char *pos=str;
for (i=1; *pos; i++, pos++)
for (i=1; i<=length; i++) {
completion_hash_update(ht, str, i, str); completion_hash_update(ht, str, i, str);
}
} }
...@@ -22,26 +22,29 @@ ...@@ -22,26 +22,29 @@
#define FAILURE 1 #define FAILURE 1
#include <sys/types.h> #include <sys/types.h>
#include <my_sys.h>
typedef struct _entry { typedef struct _entry {
char *str; char *str;
struct _entry *pNext; struct _entry *pNext;
} entry; } entry;
typedef struct bucket { typedef struct bucket
uint h; /* Used for numeric indexing */ {
char *arKey; uint h; /* Used for numeric indexing */
uint nKeyLength; char *arKey;
uint count; uint nKeyLength;
entry *pData; uint count;
struct bucket *pNext; entry *pData;
struct bucket *pNext;
} Bucket; } Bucket;
typedef struct hashtable { typedef struct hashtable {
uint nTableSize; uint nTableSize;
uint initialized; uint initialized;
uint(*pHashFunction) (char *arKey, uint nKeyLength); MEM_ROOT mem_root;
Bucket **arBuckets; uint(*pHashFunction) (char *arKey, uint nKeyLength);
Bucket **arBuckets;
} HashTable; } HashTable;
extern int completion_hash_init(HashTable *ht, uint nSize); extern int completion_hash_init(HashTable *ht, uint nSize);
...@@ -54,4 +57,4 @@ extern void completion_hash_clean(HashTable *ht); ...@@ -54,4 +57,4 @@ extern void completion_hash_clean(HashTable *ht);
extern int completion_hash_exists(HashTable *ht, char *arKey, uint nKeyLength); extern int completion_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
extern void completion_hash_free(HashTable *ht); extern void completion_hash_free(HashTable *ht);
#endif /* _HASH_ */ #endif /* _HASH_ */
...@@ -137,6 +137,7 @@ static const char *xmlmeta[] = { ...@@ -137,6 +137,7 @@ static const char *xmlmeta[] = {
static char default_pager[FN_REFLEN]; static char default_pager[FN_REFLEN];
char pager[FN_REFLEN], outfile[FN_REFLEN]; char pager[FN_REFLEN], outfile[FN_REFLEN];
FILE *PAGER, *OUTFILE; FILE *PAGER, *OUTFILE;
MEM_ROOT hash_mem_root;
#include "sslopt-vars.h" #include "sslopt-vars.h"
...@@ -302,8 +303,9 @@ int main(int argc,char *argv[]) ...@@ -302,8 +303,9 @@ int main(int argc,char *argv[])
!(status.line_buff=batch_readline_init(max_allowed_packet+512,stdin))) !(status.line_buff=batch_readline_init(max_allowed_packet+512,stdin)))
exit(1); exit(1);
glob_buffer.realloc(512); glob_buffer.realloc(512);
mysql_server_init(0, NULL, server_default_groups); mysql_server_init(0, NULL, (char**) server_default_groups);
completion_hash_init(&ht,50); completion_hash_init(&ht, 128);
init_alloc_root(&hash_mem_root, 16384, 0);
bzero((char*) &mysql, sizeof(mysql)); bzero((char*) &mysql, sizeof(mysql));
if (sql_connect(current_host,current_db,current_user,opt_password, if (sql_connect(current_host,current_db,current_user,opt_password,
opt_silent)) opt_silent))
...@@ -387,6 +389,8 @@ sig_handler mysql_end(int sig) ...@@ -387,6 +389,8 @@ sig_handler mysql_end(int sig)
} }
batch_readline_end(status.line_buff); batch_readline_end(status.line_buff);
completion_hash_free(&ht); completion_hash_free(&ht);
free_root(&hash_mem_root,MYF(0));
#endif #endif
if (sig >= 0) if (sig >= 0)
put_info(sig ? "Aborted" : "Bye", INFO_RESULT); put_info(sig ? "Aborted" : "Bye", INFO_RESULT);
...@@ -1170,7 +1174,8 @@ static char *new_command_generator(char *text,int state) ...@@ -1170,7 +1174,8 @@ static char *new_command_generator(char *text,int state)
static void build_completion_hash(bool skip_rehash,bool write_info) static void build_completion_hash(bool skip_rehash,bool write_info)
{ {
COMMANDS *cmd=commands; COMMANDS *cmd=commands;
static MYSQL_RES *databases=0,*tables=0,*fields; MYSQL_RES *databases=0,*tables=0;
MYSQL_RES *fields;
static char ***field_names= 0; static char ***field_names= 0;
MYSQL_ROW database_row,table_row; MYSQL_ROW database_row,table_row;
MYSQL_FIELD *sql_field; MYSQL_FIELD *sql_field;
...@@ -1181,16 +1186,11 @@ static void build_completion_hash(bool skip_rehash,bool write_info) ...@@ -1181,16 +1186,11 @@ static void build_completion_hash(bool skip_rehash,bool write_info)
if (status.batch || quick || !current_db) if (status.batch || quick || !current_db)
DBUG_VOID_RETURN; // We don't need completion in batches DBUG_VOID_RETURN; // We don't need completion in batches
completion_hash_clean(&ht);
if (tables) if (tables)
{ {
mysql_free_result(tables); mysql_free_result(tables);
tables=0; tables=0;
} }
if (databases) {
mysql_free_result(databases);
databases=0;
}
/* hash SQL commands */ /* hash SQL commands */
while (cmd->name) { while (cmd->name) {
...@@ -1200,16 +1200,28 @@ static void build_completion_hash(bool skip_rehash,bool write_info) ...@@ -1200,16 +1200,28 @@ static void build_completion_hash(bool skip_rehash,bool write_info)
if (skip_rehash) if (skip_rehash)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
/* Free old used memory */
if (field_names)
field_names=0;
completion_hash_clean(&ht);
free_root(&hash_mem_root,MYF(0));
/* hash MySQL functions (to be implemented) */ /* hash MySQL functions (to be implemented) */
/* hash all database names */ /* hash all database names */
if (mysql_query(&mysql,"show databases")==0) { if (mysql_query(&mysql,"show databases") == 0)
{
if (!(databases = mysql_store_result(&mysql))) if (!(databases = mysql_store_result(&mysql)))
put_info(mysql_error(&mysql),INFO_INFO); put_info(mysql_error(&mysql),INFO_INFO);
else else
{ {
while ((database_row=mysql_fetch_row(databases))) while ((database_row=mysql_fetch_row(databases)))
add_word(&ht,(char*) database_row[0]); {
char *str=strdup_root(&hash_mem_root, (char*) database_row[0]);
if (str)
add_word(&ht,(char*) str);
}
mysql_free_result(databases);
} }
} }
/* hash all table names */ /* hash all table names */
...@@ -1227,23 +1239,13 @@ You can turn off this feature to get a quicker startup with -A\n\n"); ...@@ -1227,23 +1239,13 @@ You can turn off this feature to get a quicker startup with -A\n\n");
} }
while ((table_row=mysql_fetch_row(tables))) while ((table_row=mysql_fetch_row(tables)))
{ {
if (!completion_hash_exists(&ht,(char*) table_row[0], char *str=strdup_root(&hash_mem_root, (char*) table_row[0]);
(uint) strlen((const char*) table_row[0]))) if (str &&
add_word(&ht,table_row[0]); !completion_hash_exists(&ht,(char*) str, (uint) strlen(str)))
} add_word(&ht,str);
}
}
/* FIXME: free() on small chunks is sloooowwww. glibc bug */
if (field_names) {
for (i=0; field_names[i]; i++) {
for (j=0; field_names[i][j]; j++) {
my_free(field_names[i][j],MYF(0));
} }
my_free((gptr) field_names[i],MYF(0));
} }
my_free((gptr) field_names,MYF(0));
} }
field_names=0;
/* hash all field names, both with the table prefix and without it */ /* hash all field names, both with the table prefix and without it */
if (!tables) /* no tables */ if (!tables) /* no tables */
...@@ -1251,36 +1253,37 @@ You can turn off this feature to get a quicker startup with -A\n\n"); ...@@ -1251,36 +1253,37 @@ You can turn off this feature to get a quicker startup with -A\n\n");
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
mysql_data_seek(tables,0); mysql_data_seek(tables,0);
field_names = (char ***) my_malloc(sizeof(char **) * if (!(field_names= (char ***) alloc_root(&hash_mem_root,sizeof(char **) *
(uint) (mysql_num_rows(tables)+1), (uint) (mysql_num_rows(tables)+1))))
MYF(MY_WME)); {
if (!field_names) mysql_free_result(tables);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
}
i=0; i=0;
while ((table_row=mysql_fetch_row(tables))) while ((table_row=mysql_fetch_row(tables)))
{ {
if ((fields=mysql_list_fields(&mysql,(const char*) table_row[0],NullS))) if ((fields=mysql_list_fields(&mysql,(const char*) table_row[0],NullS)))
{ {
num_fields=mysql_num_fields(fields); num_fields=mysql_num_fields(fields);
field_names[i] = (char **) my_malloc(sizeof(char *)*(num_fields*2+1), if (!(field_names[i] = (char **) alloc_root(&hash_mem_root,
MYF(0)); sizeof(char *) *
if (!field_names[i]) (num_fields*2+1))))
{ break;
continue;
}
field_names[i][num_fields*2]='\0'; field_names[i][num_fields*2]='\0';
j=0; j=0;
while ((sql_field=mysql_fetch_field(fields))) while ((sql_field=mysql_fetch_field(fields)))
{ {
sprintf(buf,"%s.%s",table_row[0],sql_field->name); sprintf(buf,"%s.%s",table_row[0],sql_field->name);
field_names[i][j] = my_strdup(buf,MYF(0)); field_names[i][j] = strdup_root(&hash_mem_root,buf);
add_word(&ht,field_names[i][j]); add_word(&ht,field_names[i][j]);
field_names[i][num_fields+j] = my_strdup(sql_field->name,MYF(0)); field_names[i][num_fields+j] = strdup_root(&hash_mem_root,
sql_field->name);
if (!completion_hash_exists(&ht,field_names[i][num_fields+j], if (!completion_hash_exists(&ht,field_names[i][num_fields+j],
(uint) strlen(field_names[i][num_fields+j]))) (uint) strlen(field_names[i][num_fields+j])))
add_word(&ht,field_names[i][num_fields+j]); add_word(&ht,field_names[i][num_fields+j]);
j++; j++;
} }
mysql_free_result(fields);
} }
else else
{ {
...@@ -1290,6 +1293,7 @@ You can turn off this feature to get a quicker startup with -A\n\n"); ...@@ -1290,6 +1293,7 @@ You can turn off this feature to get a quicker startup with -A\n\n");
} }
i++; i++;
} }
mysql_free_result(tables);
field_names[i]=0; // End pointer field_names[i]=0; // End pointer
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -643,8 +643,7 @@ static uint getTableStructure(char *table, char* db) ...@@ -643,8 +643,7 @@ static uint getTableStructure(char *table, char* db)
if (path) if (path)
{ {
char filename[FN_REFLEN], tmp_path[FN_REFLEN]; char filename[FN_REFLEN], tmp_path[FN_REFLEN];
strmov(tmp_path,path); convert_dirname(tmp_path,path,NullS);
convert_dirname(tmp_path);
sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4), sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME)); O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */ if (!sql_file) /* If file couldn't be opened */
...@@ -716,8 +715,7 @@ static uint getTableStructure(char *table, char* db) ...@@ -716,8 +715,7 @@ static uint getTableStructure(char *table, char* db)
if (path) if (path)
{ {
char filename[FN_REFLEN], tmp_path[FN_REFLEN]; char filename[FN_REFLEN], tmp_path[FN_REFLEN];
strmov(tmp_path,path); convert_dirname(tmp_path,path,NullS);
convert_dirname(tmp_path);
sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4), sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME)); O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */ if (!sql_file) /* If file couldn't be opened */
...@@ -949,8 +947,7 @@ static void dumpTable(uint numFields, char *table) ...@@ -949,8 +947,7 @@ static void dumpTable(uint numFields, char *table)
if (path) if (path)
{ {
char filename[FN_REFLEN], tmp_path[FN_REFLEN]; char filename[FN_REFLEN], tmp_path[FN_REFLEN];
strmov(tmp_path, path); convert_dirname(tmp_path,path,NullS);
convert_dirname(tmp_path);
my_load_path(tmp_path, tmp_path, NULL); my_load_path(tmp_path, tmp_path, NULL);
fn_format(filename, table, tmp_path, ".txt", 4); fn_format(filename, table, tmp_path, ".txt", 4);
my_delete(filename, MYF(0)); /* 'INTO OUTFILE' doesn't work, if my_delete(filename, MYF(0)); /* 'INTO OUTFILE' doesn't work, if
......
This diff is collapsed.
...@@ -453,8 +453,7 @@ typedef SOCKET_SIZE_TYPE size_socket; ...@@ -453,8 +453,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
/* Some things that this system doesn't have */ /* Some things that this system doesn't have */
#define ONLY_OWN_DATABASES /* We are using only databases by monty */ #define ONLY_OWN_DATABASES /* We are using only databases by monty */
#define NO_PISAM /* Not needed anymore */ #define HAVE_ISAM /* TO BE DELETED */
#define NO_MISAM /* Not needed anymore */
#define NO_HASH /* Not needed anymore */ #define NO_HASH /* Not needed anymore */
#ifdef __WIN__ #ifdef __WIN__
#define NO_DIR_LIBRARY /* Not standar dir-library */ #define NO_DIR_LIBRARY /* Not standar dir-library */
......
...@@ -90,6 +90,16 @@ extern int NEAR my_errno; /* Last error in mysys */ ...@@ -90,6 +90,16 @@ extern int NEAR my_errno; /* Last error in mysys */
#define ME_COLOUR2 ((2 << ME_HIGHBYTE)) #define ME_COLOUR2 ((2 << ME_HIGHBYTE))
#define ME_COLOUR3 ((3 << ME_HIGHBYTE)) #define ME_COLOUR3 ((3 << ME_HIGHBYTE))
/* Bits in last argument to fn_format */
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
#define MY_REPLACE_EXT 2 /* replace extension with 'ext' */
#define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */
#define MY_PACK_FILENAME 8 /* Pack name (home -> ~) */
#define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */
#define MY_RETURN_REAL_PATH 32 /* return full path for file */
#define MY_SAFE_PATH 64 /* Return NULL if too long path */
#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */
/* My seek flags */ /* My seek flags */
#define MY_SEEK_SET 0 #define MY_SEEK_SET 0
#define MY_SEEK_CUR 1 #define MY_SEEK_CUR 1
...@@ -469,12 +479,12 @@ extern uint dirname_part(my_string to,const char *name); ...@@ -469,12 +479,12 @@ extern uint dirname_part(my_string to,const char *name);
extern uint dirname_length(const char *name); extern uint dirname_length(const char *name);
#define base_name(A) (A+dirname_length(A)) #define base_name(A) (A+dirname_length(A))
extern int test_if_hard_path(const char *dir_name); extern int test_if_hard_path(const char *dir_name);
extern char *convert_dirname(my_string name); extern char *convert_dirname(char *to, const char *from, const char *from_end);
extern void to_unix_path(my_string name); extern void to_unix_path(my_string name);
extern my_string fn_ext(const char *name); extern my_string fn_ext(const char *name);
extern my_string fn_same(my_string toname,const char *name,int flag); extern my_string fn_same(my_string toname,const char *name,int flag);
extern my_string fn_format(my_string to,const char *name,const char *dsk, extern my_string fn_format(my_string to,const char *name,const char *dir,
const char *form,int flag); const char *form, uint flag);
extern size_s strlength(const char *str); extern size_s strlength(const char *str);
extern void pack_dirname(my_string to,const char *from); extern void pack_dirname(my_string to,const char *from);
extern uint unpack_dirname(my_string to,const char *from); extern uint unpack_dirname(my_string to,const char *from);
......
...@@ -71,6 +71,8 @@ extern char *mysql_unix_port; ...@@ -71,6 +71,8 @@ extern char *mysql_unix_port;
typedef struct st_mysql_field { typedef struct st_mysql_field {
char *name; /* Name of column */ char *name; /* Name of column */
char *table; /* Table of column if column was a field */ char *table; /* Table of column if column was a field */
char *org_table; /* Org table name if table was an alias */
char *db; /* Database for table */
char *def; /* Default value (set by mysql_list_fields) */ char *def; /* Default value (set by mysql_list_fields) */
unsigned long length; /* Width of column */ unsigned long length; /* Width of column */
unsigned long max_length; /* Max width of selected set */ unsigned long max_length; /* Max width of selected set */
...@@ -227,7 +229,7 @@ typedef struct st_mysql_res { ...@@ -227,7 +229,7 @@ typedef struct st_mysql_res {
/* Set up and bring down the server; to ensure that applications will /* Set up and bring down the server; to ensure that applications will
* work when linked against either the standard client library or the * work when linked against either the standard client library or the
* embedded server library, these functions should be called. */ * embedded server library, these functions should be called. */
int mysql_server_init(int argc, const char **argv, const char **groups); int mysql_server_init(int argc, char **argv, char **groups);
void mysql_server_end(void); void mysql_server_end(void);
/* Set up and bring down a thread; these function should be called /* Set up and bring down a thread; these function should be called
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#undef HAVE_DLOPEN /* No udf functions */ #undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_OPENSSL #undef HAVE_OPENSSL
#undef HAVE_VIO #undef HAVE_VIO
#undef HAVE_ISAM
#define DONT_USE_RAID #define DONT_USE_RAID
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
...@@ -70,6 +70,7 @@ extern ulint srv_n_rows_read; ...@@ -70,6 +70,7 @@ extern ulint srv_n_rows_read;
extern ibool srv_print_innodb_monitor; extern ibool srv_print_innodb_monitor;
extern ibool srv_print_innodb_lock_monitor; extern ibool srv_print_innodb_lock_monitor;
extern ibool srv_print_innodb_tablespace_monitor; extern ibool srv_print_innodb_tablespace_monitor;
extern ibool srv_print_verbose_log;
extern ulint srv_n_spin_wait_rounds; extern ulint srv_n_spin_wait_rounds;
extern ulint srv_spin_wait_delay; extern ulint srv_spin_wait_delay;
......
...@@ -2641,9 +2641,11 @@ logs_empty_and_mark_files_at_shutdown(void) ...@@ -2641,9 +2641,11 @@ logs_empty_and_mark_files_at_shutdown(void)
dulint lsn; dulint lsn;
ulint arch_log_no; ulint arch_log_no;
ut_print_timestamp(stderr); if (srv_print_verbose_log)
fprintf(stderr, " InnoDB: Starting shutdown...\n"); {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Starting shutdown...\n");
}
/* Wait until the master thread and all other operations are idle: our /* Wait until the master thread and all other operations are idle: our
algorithm only works if the server is idle at shutdown */ algorithm only works if the server is idle at shutdown */
loop: loop:
...@@ -2732,8 +2734,11 @@ logs_empty_and_mark_files_at_shutdown(void) ...@@ -2732,8 +2734,11 @@ logs_empty_and_mark_files_at_shutdown(void)
fil_flush_file_spaces(FIL_TABLESPACE); fil_flush_file_spaces(FIL_TABLESPACE);
ut_print_timestamp(stderr); if (srv_print_verbose_log)
fprintf(stderr, " InnoDB: Shutdown completed\n"); {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Shutdown completed\n");
}
} }
/********************************************************** /**********************************************************
......
...@@ -120,6 +120,12 @@ ibool srv_print_innodb_monitor = FALSE; ...@@ -120,6 +120,12 @@ ibool srv_print_innodb_monitor = FALSE;
ibool srv_print_innodb_lock_monitor = FALSE; ibool srv_print_innodb_lock_monitor = FALSE;
ibool srv_print_innodb_tablespace_monitor = FALSE; ibool srv_print_innodb_tablespace_monitor = FALSE;
/*
Set the following to 0 if you want InnoDB to write messages on
stderr on startup/shutdown
*/
ibool srv_print_verbose_log = TRUE;
/* The parameters below are obsolete: */ /* The parameters below are obsolete: */
ibool srv_print_parsed_sql = FALSE; ibool srv_print_parsed_sql = FALSE;
......
...@@ -888,9 +888,11 @@ innobase_start_or_create_for_mysql(void) ...@@ -888,9 +888,11 @@ innobase_start_or_create_for_mysql(void)
/* buf_debug_prints = TRUE; */ /* buf_debug_prints = TRUE; */
ut_print_timestamp(stderr); if (srv_print_verbose_log)
fprintf(stderr, " InnoDB: Started\n"); {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Started\n");
}
return((int) DB_SUCCESS); return((int) DB_SUCCESS);
} }
......
...@@ -400,11 +400,7 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -400,11 +400,7 @@ static int examine_log(my_string file_name, char **table_names)
} }
to=isam_file_name; to=isam_file_name;
if (filepath) if (filepath)
{ to=convert_dirname(isam_file_name, filepath, NullS);
strmov(isam_file_name,filepath);
convert_dirname(isam_file_name);
to=strend(isam_file_name);
}
strmov(to,pos); strmov(to,pos);
fn_ext(isam_file_name)[0]=0; /* Remove extension */ fn_ext(isam_file_name)[0]=0; /* Remove extension */
} }
......
...@@ -92,8 +92,8 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, ...@@ -92,8 +92,8 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
const char *from, ulong length); const char *from, ulong length);
int mysql_server_init(int argc __attribute__((unused)), int mysql_server_init(int argc __attribute__((unused)),
const char **argv __attribute__((unused)), char **argv __attribute__((unused)),
const char **groups __attribute__((unused))) char **groups __attribute__((unused)))
{ {
return 0; return 0;
} }
...@@ -873,7 +873,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, ...@@ -873,7 +873,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
for (row=data->data; row ; row = row->next,field++) for (row=data->data; row ; row = row->next,field++)
{ {
field->table= strdup_root(alloc,(char*) row->data[0]); field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]);
field->name= strdup_root(alloc,(char*) row->data[1]); field->name= strdup_root(alloc,(char*) row->data[1]);
field->length= (uint) uint3korr(row->data[2]); field->length= (uint) uint3korr(row->data[2]);
field->type= (enum enum_field_types) (uchar) row->data[3][0]; field->type= (enum enum_field_types) (uchar) row->data[3][0];
......
...@@ -17,27 +17,23 @@ ...@@ -17,27 +17,23 @@
# #
# This file is public domain and comes with NO WARRANTY of any kind # This file is public domain and comes with NO WARRANTY of any kind
MYSQLDATAdir = $(localstatedir) MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir) MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix) MYSQLBASEdir= $(prefix)
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" -DSHAREDIR="\"$(MYSQLSHAREdir)\""
INCLUDES = @MT_INCLUDES@ @bdb_includes@ -I$(srcdir)/../include -I../include \ INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(srcdir)/../include \
-I$(srcdir)/.. -I$(top_srcdir) -I.. -I../sql -I../regex -I../include -I$(srcdir)/.. -I$(top_srcdir) -I.. \
-I../sql -I../regex
noinst_LIBRARIES = libmysqld_int.a
## XXX: should we use client or server LDFLAGS for libmysqld? pkglib_LIBRARIES = libmysqld.a
LDADD = @CLIENT_EXTRA_LDFLAGS@ libmysqld.la
pkglib_LTLIBRARIES = libmysqld.la
SUBDIRS = . examples SUBDIRS = . examples
libmysqld_la_SOURCES= libmysqld.c lib_sql.cc lib_load.cc libmysqld_sources= libmysqld.c lib_sql.cc lib_load.cc
libmysqlsources = errmsg.c get_password.c password.c libmysqlsources = errmsg.c get_password.c password.c
## XXX: we should not have to duplicate info from the sources list
libmysqlobjects = errmsg.lo get_password.lo password.lo
noinst_HEADERS = embedded_priv.h noinst_HEADERS = embedded_priv.h
...@@ -58,37 +54,52 @@ sqlsources = convert.cc derror.cc field.cc field_conv.cc filesort.cc \ ...@@ -58,37 +54,52 @@ sqlsources = convert.cc derror.cc field.cc field_conv.cc filesort.cc \
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \ sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc
## XXX: we should not have to duplicate info from the sources list
sqlobjects = convert.lo derror.lo field.lo field_conv.lo filesort.lo \
ha_innobase.lo ha_berkeley.lo ha_heap.lo ha_isam.lo ha_isammrg.lo \
ha_myisam.lo ha_myisammrg.lo handler.lo sql_handler.lo \
hostname.lo init.lo \
item.lo item_buff.lo item_cmpfunc.lo item_create.lo \
item_func.lo item_strfunc.lo item_sum.lo item_timefunc.lo \
item_uniq.lo key.lo lock.lo log.lo log_event.lo md5.lo \
mini_client.lo net_pkg.lo net_serv.lo opt_ft.lo opt_range.lo \
opt_sum.lo procedure.lo records.lo slave.lo sql_acl.lo \
sql_analyse.lo sql_base.lo sql_cache.lo sql_class.lo \
sql_crypt.lo sql_db.lo sql_delete.lo sql_insert.lo sql_lex.lo \
sql_list.lo sql_manager.lo sql_map.lo sql_parse.lo \
sql_rename.lo sql_repl.lo sql_select.lo sql_show.lo \
sql_string.lo sql_table.lo sql_test.lo sql_udf.lo \
sql_update.lo sql_yacc.lo table.lo thr_malloc.lo time.lo \
unireg.lo uniques.lo stacktrace.lo sql_union.lo hash_filo.lo
EXTRA_DIST = lib_vio.c EXTRA_DIST = lib_vio.c
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources)
# automake misses these # automake misses these
sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy
libmysqld_la_LIBADD = $(sqlobjects) $(libmysqlobjects) # The following libraries should be included in libmysqld.a
INC_LIB= $(top_builddir)/regex/libregex.a \
$(top_builddir)/myisam/libmyisam.a \
$(top_builddir)/myisammrg/libmyisammrg.a \
$(top_builddir)/heap/libheap.a \
@innodb_libs@ @bdb_libs_with_path@ \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/regex/libregex.a
#
# To make it easy for the end user to use the embedded library we
# generate a total libmysqld.a from all library files,
libmysqld.a: libmysqld_int.a $(INC_LIB)
if test ! -d tmp ; then mkdir tmp ; fi
rm -f $@ libmysqld_int2.a tmp/*.o tmp/*.a
cp $(INC_LIB) tmp
cp libmysqld_int.a libmysqld_int2.a ; \
cd tmp ; \
for file in *.a ; do \
bfile=`basename $$file .a` ; \
ar x $$file; \
for obj in *.o ; do mv $$obj $${bfile}_$$obj ; done ; \
ar q ../libmysqld_int2.a *.o ; \
rm *.o ; \
done
mv libmysqld_int2.a libmysqld.a
rm tmp/*
$(RANLIB) libmysqld.a
## XXX: any time the client interface changes, we'll need to bump ## XXX: any time the client interface changes, we'll need to bump
## the version info for libmysqld; however, it's possible for the ## the version info for libmysqld; however, it's possible for the
## libmysqld interface to change without affecting the standard ## libmysqld interface to change without affecting the standard
## libmysqlclient interface. Should we make a separate version ## libmysqlclient interface. Should we make a separate version
## string for the two? ## string for the two?
libmysqld_la_LDFLAGS = -version-info @SHARED_LIB_VERSION@ #libmysqld_la_LDFLAGS = -version-info @SHARED_LIB_VERSION@
CLEANFILES = $(libmysqld_la_LIBADD) libmysqld.la #CLEANFILES = $(libmysqld_la_LIBADD) libmysqld.la
# This is called from the toplevel makefile # This is called from the toplevel makefile
link_sources: link_sources:
......
...@@ -10,20 +10,9 @@ link_sources: ...@@ -10,20 +10,9 @@ link_sources:
DEFS = -DEMBEDDED_LIBRARY DEFS = -DEMBEDDED_LIBRARY
INCLUDES = -I$(top_srcdir)/include $(openssl_includes) \ INCLUDES = -I$(top_srcdir)/include $(openssl_includes) \
-I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/client -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/client
LIBS = @LIBS@ LIBS = @LIBS@
LDADD = $(top_builddir)/libmysqld/libmysqld.la \ LDADD = ../libmysqld.a @innodb_system_libs@ @LIBDL@
$(top_builddir)/isam/libnisam.a \
$(top_builddir)/myisam/libmyisam.a \
$(top_builddir)/heap/libheap.a \
$(top_builddir)/merge/libmerge.a \
$(top_builddir)/myisammrg/libmyisammrg.a \
@innodb_libs@ @bdb_libs@ @pstack_libs@ \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/regex/libregex.a @LIBDL@
mysqltest_DEPENDENCIES = ../libmysqld.la
mysqltest_SOURCES = mysqltest.c mysqltest_SOURCES = mysqltest.c
mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \ mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
......
...@@ -6,26 +6,19 @@ ...@@ -6,26 +6,19 @@
# that will run on all platforms (or incorporate it into the # that will run on all platforms (or incorporate it into the
# standard mysql-test-run). # standard mysql-test-run).
#test_data_dir=/tmp/mysql-data
test_data_dir=../../mysql-test/var/master-data
cd "$test_data_dir" || {
echo "can't cd to $test_data_dir" >&2
exit 1
}
# All paths below must be relative to $test_data_dir # All paths below must be relative to $test_data_dir
#top_builddir=/home/tim/my/4 top_builddir=../..
top_builddir=../../..
mysql_test_dir=$top_builddir/mysql-test mysql_test_dir=$top_builddir/mysql-test
examples=$top_builddir/libmysqld/examples examples=$top_builddir/libmysqld/examples
mysqltest=$examples/mysqltest mysqltest=$examples/mysqltest
testdir=./test datadir=$mysql_test_dir/var/master-data
test_data_dir=test
gdb=0 gdb=0
list=0 list=0
run= run=
tests= tests=
start= start=
clean=1
cr=" cr="
" "
...@@ -35,6 +28,7 @@ usage () { ...@@ -35,6 +28,7 @@ usage () {
cat <<EOF cat <<EOF
usage: $0 [-g|-h|-r] [test-name ...] usage: $0 [-g|-h|-r] [test-name ...]
-C | --noclean Do not remove old innodb and bdb files at start.
-g | --gdb run $mysqltest in gdb -g | --gdb run $mysqltest in gdb
-h | --help show this help -h | --help show this help
-l | --list ) list all available tests -l | --list ) list all available tests
...@@ -58,6 +52,7 @@ do ...@@ -58,6 +52,7 @@ do
-l | --list ) list=1 ; shift ;; -l | --list ) list=1 ; shift ;;
-r | --run ) run="${cr}run"; shift;; -r | --run ) run="${cr}run"; shift;;
--debug) init_args="$init_args --debug" ; shift ;; --debug) init_args="$init_args --debug" ; shift ;;
-C | --noclean) clean=0 ; shift ;;
-s | --start=* ) -s | --start=* )
test $argset -eq 0 && { shift; arg="$1"; } test $argset -eq 0 && { shift; arg="$1"; }
start="$arg" start="$arg"
...@@ -68,25 +63,30 @@ do ...@@ -68,25 +63,30 @@ do
esac esac
done done
test -d "$mysql_test_dir/t" -a -d "$mysql_test_dir/r" -a \ if test ! -d "$datadir/$test_data_dir"
-f $mysqltest -a -d $testdir || { then
echo "bad setup (is '$testdir', from '$test_data_dir', missing?)" >&2 echo "bad setup (is '$datadir/$test_data_dir'', missing ?)" >&2
exit 1 exit 1
} fi
test -n "$tests" || test -n "$tests" ||
tests=`/bin/ls -1 "$mysql_test_dir"/t/*.test | grep -v '^.*/rpl[^/]*$' | \ tests=`/bin/ls -1 "$mysql_test_dir"/t/*.test | grep -v '^.*/rpl[^/]*$' | \
sed -e 's,^.*/,,' -e 's,.test$,,'` sed -e 's,^.*/,,' -e 's,.test$,,'`
echo "cleaning data directory '$test_data_dir'" echo "cleaning data directory '$datadir/$test_data_dir'"
rm -f $test_data_dir/ib_* $test_data_dir/ibdata* log.* if test $clean = 1
echo "cleaning test directory '$testdir'" then
rm -f $testdir/* rm -f $datadir/ib_* $datadir/ibdata*
rm -f $datadir/log.00*
fi
rm -f $datadir/../tmp/*
rm -f test-gdbinit rm -f test-gdbinit
TZ=GMT-3; export TZ TZ=GMT-3; export TZ
# At least one of the tests needs the following environment variable
MYSQL_TEST_DIR=`( cd $mysql_test_dir ; pwd )` ; export MYSQL_TEST_DIR
skip=1 skip=1
test -z "$start" && skip=0 test -z "$start" && skip=0
...@@ -96,16 +96,20 @@ do ...@@ -96,16 +96,20 @@ do
test $skip -eq 1 && test -n "$start" && test "$start" = "$b" && skip=0 test $skip -eq 1 && test -n "$start" && test "$start" = "$b" && skip=0
test $skip -eq 1 && { echo "skipping '$b'"; continue; } test $skip -eq 1 && { echo "skipping '$b'"; continue; }
t="$mysql_test_dir/t/$b.test" t="t/$b.test"
r="$mysql_test_dir/r/$b.result" r="r/$b.result"
c="$mysql_test_dir/r/$b.reject"
# Only test if $t exists; there is no $r for some tests # Only test if $t exists; there is no $r for some tests
test -f $t || { test -f $mysql_test_dir/$t || {
echo "test '$b' doesn't exist" >&2 echo "test '$mysql_test_dir/$t' doesn't exist" >&2
continue continue
} }
args="$init_args -v -S /tmp/mysql.sock -R $r -x $t test" args="$init_args -v --basedir=$mysql_test_dir/ -R $r -x $t --server-arg=--datadir=$datadir"
if test -f "$mysql_test_dir/t/$b-master.opt" ; then
args="$args --server-file=t/$b-master.opt"
fi
args="$args $test_data_dir" # Add database last
echo "set args $args$run" > test-gdbinit echo "set args $args$run" > test-gdbinit
#if false && test -n "$run" #if false && test -n "$run"
if test -n "$run" -o $gdb -eq 1 if test -n "$run" -o $gdb -eq 1
...@@ -129,5 +133,5 @@ do ...@@ -129,5 +133,5 @@ do
res=$? res=$?
fi fi
test $res -eq 0 || echo "!!! error: $res" test $res -eq 0 -o $res -eq 2 || echo "!!! error: $res"
done done
...@@ -296,7 +296,7 @@ extern "C" ...@@ -296,7 +296,7 @@ extern "C"
static my_bool inited, org_my_init_done; static my_bool inited, org_my_init_done;
int mysql_server_init(int argc, const char **argv, const char **groups) int mysql_server_init(int argc, char **argv, char **groups)
{ {
char glob_hostname[FN_REFLEN]; char glob_hostname[FN_REFLEN];
...@@ -306,7 +306,7 @@ int mysql_server_init(int argc, const char **argv, const char **groups) ...@@ -306,7 +306,7 @@ int mysql_server_init(int argc, const char **argv, const char **groups)
char ***argvp; char ***argvp;
int fake_argc = 1; int fake_argc = 1;
char *fake_argv[] = { (char *)"", 0 }; char *fake_argv[] = { (char *)"", 0 };
const char *fake_groups[] = { "server", 0 }; const char *fake_groups[] = { "server", "embedded", 0 };
if (argc) if (argc)
{ {
argcp = &argc; argcp = &argc;
...@@ -318,7 +318,7 @@ int mysql_server_init(int argc, const char **argv, const char **groups) ...@@ -318,7 +318,7 @@ int mysql_server_init(int argc, const char **argv, const char **groups)
argvp = (char ***) &fake_argv; argvp = (char ***) &fake_argv;
} }
if (!groups) if (!groups)
groups = fake_groups; groups = (char**) fake_groups;
my_umask=0660; // Default umask for new files my_umask=0660; // Default umask for new files
my_umask_dir=0700; // Default umask for new directories my_umask_dir=0700; // Default umask for new directories
...@@ -330,7 +330,9 @@ int mysql_server_init(int argc, const char **argv, const char **groups) ...@@ -330,7 +330,9 @@ int mysql_server_init(int argc, const char **argv, const char **groups)
org_my_init_done=my_init_done; org_my_init_done=my_init_done;
} }
if (!org_my_init_done) if (!org_my_init_done)
{
MY_INIT((char *)"mysql_embedded"); // init my_sys library & pthreads MY_INIT((char *)"mysql_embedded"); // init my_sys library & pthreads
}
tzset(); // Set tzname tzset(); // Set tzname
...@@ -357,7 +359,7 @@ int mysql_server_init(int argc, const char **argv, const char **groups) ...@@ -357,7 +359,7 @@ int mysql_server_init(int argc, const char **argv, const char **groups)
strcat(server_version,"-debug"); strcat(server_version,"-debug");
#endif #endif
strcat(server_version,"-embedded"); strcat(server_version,"-embedded");
load_defaults("my", groups, argcp, argvp); load_defaults("my", (const char **) groups, argcp, argvp);
defaults_argv=*argvp; defaults_argv=*argvp;
mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */ mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2)
......
...@@ -79,11 +79,6 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, ...@@ -79,11 +79,6 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
#define set_sigpipe(mysql) #define set_sigpipe(mysql)
#define reset_sigpipe(mysql) #define reset_sigpipe(mysql)
static MYSQL* spawn_init(MYSQL* parent, const char* host,
unsigned int port,
const char* user,
const char* passwd);
/***************************************************************************** /*****************************************************************************
** read a packet from server. Give error message if socket was down ** read a packet from server. Give error message if socket was down
** or packet is an error message ** or packet is an error message
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include
pkglib_LIBRARIES = libmerge.a pkglib_LIBRARIES = libmerge.a
noinst_HEADERS = mrgdef.h noinst_HEADERS = mrg_def.h
libmerge_a_SOURCES = open.c extra.c info.c _locking.c \ libmerge_a_SOURCES = mrg_open.c mrg_extra.c mrg_info.c mrg_locking.c \
rrnd.c update.c delete.c rsame.c panic.c \ mrg_rrnd.c mrg_update.c mrg_delete.c mrg_rsame.c \
close.c create.c static.c mrg_panic.c mrg_close.c mrg_create.c mrg_static.c
OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\
__math.h time.h __time.h unistd.h __unistd.h types.h \ __math.h time.h __time.h unistd.h __unistd.h types.h \
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* close a isam-database */ /* close a isam-database */
#include "mrgdef.h" #include "mrg_def.h"
int mrg_close(register MRG_INFO *info) int mrg_close(register MRG_INFO *info)
{ {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Create a MERGE-file */ /* Create a MERGE-file */
#include "mrgdef.h" #include "mrg_def.h"
/* create file named 'name' and save filenames in it /* create file named 'name' and save filenames in it
table_names should be NULL or a vector of string-pointers with table_names should be NULL or a vector of string-pointers with
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Delete last read record */ /* Delete last read record */
#include "mrgdef.h" #include "mrg_def.h"
int mrg_delete(MRG_INFO *info,const byte *record) int mrg_delete(MRG_INFO *info,const byte *record)
{ {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
record-cache-flags are set in mrg_rrnd when we are changing database. record-cache-flags are set in mrg_rrnd when we are changing database.
*/ */
#include "mrgdef.h" #include "mrg_def.h"
int mrg_extra( int mrg_extra(
MRG_INFO *info, MRG_INFO *info,
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mrgdef.h" #include "mrg_def.h"
ulong mrg_position(MRG_INFO *info) ulong mrg_position(MRG_INFO *info)
{ {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
Lock databases against read or write. Lock databases against read or write.
*/ */
#include "mrgdef.h" #include "mrg_def.h"
int mrg_lock_database(MRG_INFO *info,int lock_type) int mrg_lock_database(MRG_INFO *info,int lock_type)
{ {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* open a MERGE-database */ /* open a MERGE-database */
#include "mrgdef.h" #include "mrg_def.h"
#include <stddef.h> #include <stddef.h>
#include <errno.h> #include <errno.h>
#ifdef VMS #ifdef VMS
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mrgdef.h" #include "mrg_def.h"
/* if flag == HA_PANIC_CLOSE then all misam files are closed */ /* if flag == HA_PANIC_CLOSE then all misam files are closed */
/* if flag == HA_PANIC_WRITE then all misam files are unlocked and /* if flag == HA_PANIC_WRITE then all misam files are unlocked and
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
get by mrg_info(). The next record can be read with pos= -1 */ get by mrg_info(). The next record can be read with pos= -1 */
#include "mrgdef.h" #include "mrg_def.h"
static MRG_TABLE *find_table(MRG_TABLE *start,MRG_TABLE *end,mrg_off_t pos); static MRG_TABLE *find_table(MRG_TABLE *start,MRG_TABLE *end,mrg_off_t pos);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mrgdef.h" #include "mrg_def.h"
int mrg_rsame( int mrg_rsame(
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
#ifndef stdin #ifndef stdin
#include "mrgdef.h" #include "mrg_def.h"
#endif #endif
LIST *mrg_open_list=0; LIST *mrg_open_list=0;
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Update last read record */ /* Update last read record */
#include "mrgdef.h" #include "mrg_def.h"
int mrg_update( int mrg_update(
register MRG_INFO *info, register MRG_INFO *info,
......
...@@ -404,11 +404,7 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -404,11 +404,7 @@ static int examine_log(my_string file_name, char **table_names)
} }
to=isam_file_name; to=isam_file_name;
if (filepath) if (filepath)
{ to=convert_dirname(isam_file_name,filepath,NullS);
strmov(isam_file_name,filepath);
convert_dirname(isam_file_name);
to=strend(isam_file_name);
}
strmov(to,pos); strmov(to,pos);
fn_ext(isam_file_name)[0]=0; /* Remove extension */ fn_ext(isam_file_name)[0]=0; /* Remove extension */
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include
pkglib_LIBRARIES = libmyisammrg.a pkglib_LIBRARIES = libmyisammrg.a
noinst_HEADERS = mymrgdef.h noinst_HEADERS = myrg_def.h
libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \ libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \
myrg_rrnd.c myrg_update.c myrg_delete.c myrg_rsame.c \ myrg_rrnd.c myrg_update.c myrg_delete.c myrg_rsame.c \
myrg_panic.c myrg_close.c myrg_create.c myrg_static.c \ myrg_panic.c myrg_close.c myrg_create.c myrg_static.c \
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* close a isam-database */ /* close a isam-database */
#include "mymrgdef.h" #include "myrg_def.h"
int myrg_close(MYRG_INFO *info) int myrg_close(MYRG_INFO *info)
{ {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Create a MYMERGE_-file */ /* Create a MYMERGE_-file */
#include "mymrgdef.h" #include "myrg_def.h"
/* create file named 'name' and save filenames in it /* create file named 'name' and save filenames in it
table_names should be NULL or a vector of string-pointers with table_names should be NULL or a vector of string-pointers with
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Delete last read record */ /* Delete last read record */
#include "mymrgdef.h" #include "myrg_def.h"
int myrg_delete( int myrg_delete(
MYRG_INFO *info, MYRG_INFO *info,
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
record-cache-flags are set in myrg_rrnd when we are changing database. record-cache-flags are set in myrg_rrnd when we are changing database.
*/ */
#include "mymrgdef.h" #include "myrg_def.h"
int myrg_extra(MYRG_INFO *info,enum ha_extra_function function) int myrg_extra(MYRG_INFO *info,enum ha_extra_function function)
{ {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mymrgdef.h" #include "myrg_def.h"
ulonglong myrg_position(MYRG_INFO *info) ulonglong myrg_position(MYRG_INFO *info)
{ {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
Lock databases against read or write. Lock databases against read or write.
*/ */
#include "mymrgdef.h" #include "myrg_def.h"
int myrg_lock_database( int myrg_lock_database(
MYRG_INFO *info, MYRG_INFO *info,
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* open a MyISAM MERGE table */ /* open a MyISAM MERGE table */
#include "mymrgdef.h" #include "myrg_def.h"
#include <stddef.h> #include <stddef.h>
#include <errno.h> #include <errno.h>
#ifdef VMS #ifdef VMS
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mymrgdef.h" #include "myrg_def.h"
/* if flag == HA_PANIC_CLOSE then all misam files are closed */ /* if flag == HA_PANIC_CLOSE then all misam files are closed */
/* if flag == HA_PANIC_WRITE then all misam files are unlocked and /* if flag == HA_PANIC_WRITE then all misam files are unlocked and
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Read record based on a key */ /* Read record based on a key */
#include "mymrgdef.h" #include "myrg_def.h"
static int queue_key_cmp(void *keyseg, byte *a, byte *b) static int queue_key_cmp(void *keyseg, byte *a, byte *b)
{ {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mymrgdef.h" #include "myrg_def.h"
/* Read first row according to specific key */ /* Read first row according to specific key */
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
#include "mymrgdef.h" #include "myrg_def.h"
/* todo: we could store some additional info to speedup lookups: /* todo: we could store some additional info to speedup lookups:
column (key, keyseg) can be constant per table column (key, keyseg) can be constant per table
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mymrgdef.h" #include "myrg_def.h"
/* Read last row with the same key as the previous read. */ /* Read last row with the same key as the previous read. */
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mymrgdef.h" #include "myrg_def.h"
/* /*
Read next row with the same key as previous read Read next row with the same key as previous read
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mymrgdef.h" #include "myrg_def.h"
/* /*
Read previous row with the same key as previous read Read previous row with the same key as previous read
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
get by myrg_info(). The next record can be read with pos= -1 */ get by myrg_info(). The next record can be read with pos= -1 */
#include "mymrgdef.h" #include "myrg_def.h"
static MYRG_TABLE *find_table(MYRG_TABLE *start,MYRG_TABLE *end,ulonglong pos); static MYRG_TABLE *find_table(MYRG_TABLE *start,MYRG_TABLE *end,ulonglong pos);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
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 */
#include "mymrgdef.h" #include "myrg_def.h"
int myrg_rsame(MYRG_INFO *info,byte *record,int inx) int myrg_rsame(MYRG_INFO *info,byte *record,int inx)
{ {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
#ifndef stdin #ifndef stdin
#include "mymrgdef.h" #include "myrg_def.h"
#endif #endif
LIST *myrg_open_list=0; LIST *myrg_open_list=0;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Update last read record */ /* Update last read record */
#include "mymrgdef.h" #include "myrg_def.h"
int myrg_update(register MYRG_INFO *info,const byte *oldrec, byte *newrec) int myrg_update(register MYRG_INFO *info,const byte *oldrec, byte *newrec)
{ {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Write a row to a MyISAM MERGE table */ /* Write a row to a MyISAM MERGE table */
#include "mymrgdef.h" #include "myrg_def.h"
int myrg_write(register MYRG_INFO *info, byte *rec) int myrg_write(register MYRG_INFO *info, byte *rec)
{ {
......
connect (master,localhost,root,,test,0,mysql-master.sock); connect (master,localhost,root,,test,0,master.sock);
connect (master1,localhost,root,,test,0,mysql-master.sock); connect (master1,localhost,root,,test,0,master.sock);
connect (slave,localhost,root,,test,0,mysql-slave.sock); connect (slave,localhost,root,,test,0,slave.sock);
connect (slave1,localhost,root,,test,0,mysql-slave.sock); connect (slave1,localhost,root,,test,0,slave.sock);
connection slave; connection slave;
!slave stop; !slave stop;
@r/slave-stopped.result show status like 'Slave_running'; @r/slave-stopped.result show status like 'Slave_running';
......
-- require r/not_embedded.require
select version() like "%embedded%" as "have_embedded";
...@@ -789,10 +789,10 @@ run_testcase () ...@@ -789,10 +789,10 @@ run_testcase ()
if [ -f $tf ] ; then if [ -f $tf ] ; then
$RM -f r/$tname.*reject $RM -f r/$tname.*reject
mysql_test_args="-R r/$tname.result $EXTRA_MYSQL_TEST_OPT" mysql_test_args="-R r/$tname.result $EXTRA_MYSQL_TEST_OPT"
if [ -z "$DO_CLIENT_GDB" ] ; then if [ -z "$DO_CLIENT_GDB" ] ; then
mytime=`$TIME -p $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE` mytime=`$TIME -p $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`
else else
do_gdb_test "$mysql_test_args" "$tf" do_gdb_test "$mysql_test_args" "$tf"
fi fi
res=$? res=$?
......
...@@ -9,18 +9,6 @@ a b c ...@@ -9,18 +9,6 @@ a b c
5 5 NULL 5 5 NULL
8 8 8 8 8 8
9 9 9 9 9 9
a b
1 1
5 5
3 3
4 4
6 6
a b c
1 1 NULL
5 5 NULL
3 3 NULL
4 4 NULL
6 6 6
skey sval skey sval
1 hello 1 hello
2 hey 2 hey
......
database() user() database() user() like "%@%"
test root@localhost test 1
version()>="3.23.29" version()>="3.23.29"
1 1
...@@ -8,3 +8,41 @@ Table Op Msg_type Msg_text ...@@ -8,3 +8,41 @@ Table Op Msg_type Msg_text
test.t1 repair status OK test.t1 repair status OK
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
a b
1 1
5 5
3 3
4 4
6 6
a b c
1 1 NULL
5 5 NULL
3 3 NULL
4 4 NULL
6 6 6
Table Op Msg_type Msg_text
test.t1 optimize status OK
Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check error The handler for the table doesn't support check/repair
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair error The handler for the table doesn't support check/repair
Table Op Msg_type Msg_text
test.t2 check error The handler for the table doesn't support check/repair
test.t1 check status OK
Table Op Msg_type Msg_text
test.t2 check error Table 't2' was not locked with LOCK TABLES
test.t1 check status OK
Field Type Null Key Default Extra
a int(11) PRI 0
b int(11) MUL 0
c int(11) 0
Field Type Null Key Default Extra Privileges
a int(11) PRI 0 select,insert,update,references
b int(11) MUL 0 select,insert,update,references
c int(11) 0 select,insert,update,references
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
t1 0 PRIMARY 1 a A 4 NULL NULL
t1 1 b 1 b A 1 NULL NULL
t1 1 b 2 c A 4 NULL NULL
...@@ -4,7 +4,3 @@ Table Op Msg_type Msg_text ...@@ -4,7 +4,3 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t2 check error Table 't2' was not locked with LOCK TABLES test.t2 check error Table 't2' was not locked with LOCK TABLES
n
4
n
1
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status OK
Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check error The handler for the table doesn't support check/repair
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair error The handler for the table doesn't support check/repair
Table Op Msg_type Msg_text
test.t2 check error The handler for the table doesn't support check/repair
test.t1 check status OK
Table Op Msg_type Msg_text
test.t2 check error Table 't2' was not locked with LOCK TABLES
test.t1 check status OK
Field Type Null Key Default Extra
a int(11) PRI 0
b int(11) MUL 0
c int(11) 0
Field Type Null Key Default Extra Privileges
a int(11) PRI 0 select,insert,update,references
b int(11) MUL 0 select,insert,update,references
c int(11) 0 select,insert,update,references
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
t1 0 PRIMARY 1 a A 4 NULL NULL
t1 1 b 1 b A 1 NULL NULL
t1 1 b 2 c A 4 NULL NULL
Table Op Msg_type Msg_text
test.t1 check status Table is already up to date test.t1 check status Table is already up to date
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status Table is already up to date test.t1 check status Table is already up to date
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Test of auto_increment; The test for BDB tables is in bdb.test # Test of auto_increment; The test for BDB tables is in bdb.test
# #
drop table if exists t1;
create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3; create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3;
insert into t1 values (1,1),(NULL,3),(NULL,4); insert into t1 values (1,1),(NULL,3),(NULL,4);
delete from t1 where a=4; delete from t1 where a=4;
...@@ -18,20 +19,6 @@ insert into t1 values (NULL,9,9); ...@@ -18,20 +19,6 @@ insert into t1 values (NULL,9,9);
select * from t1; select * from t1;
drop table t1; drop table t1;
create table t1 (a int not null auto_increment,b int, primary key (a)) type=isam;
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
delete from t1 where a=4 or a=2;
insert into t1 values (NULL,4),(NULL,5),(6,6);
select * from t1;
delete from t1 where a=6;
#show table status like "t1";
replace t1 values (3,1);
replace t1 values (3,3);
ALTER TABLE t1 add c int;
insert into t1 values (NULL,6,6);
select * from t1;
drop table t1;
create table t1 ( create table t1 (
skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY, skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
sval char(20) sval char(20)
......
...@@ -39,9 +39,3 @@ reap; ...@@ -39,9 +39,3 @@ reap;
unlock tables; unlock tables;
connection con1; connection con1;
reap; reap;
-O max_heap_table_size=16384 --set-variable=max_heap_table_size=16384
drop table if exists t1;
create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text); create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text);
insert into t1 values (1,11, 'one','eleven', 'eleven'), insert into t1 values (1,11, 'one','eleven', 'eleven'),
(1,11, 'one','eleven', 'eleven'), (1,11, 'one','eleven', 'eleven'),
...@@ -44,7 +46,7 @@ select count(distinct n1), count(distinct n2) from t1; ...@@ -44,7 +46,7 @@ select count(distinct n1), count(distinct n2) from t1;
select count(distinct n2), n1 from t1 group by n1; select count(distinct n2), n1 from t1 group by n1;
drop table t1; drop table t1;
# test the converstion from tree to MyISAM # test the conversion from tree to MyISAM
create table t1 (n int default NULL); create table t1 (n int default NULL);
let $1=5000; let $1=5000;
while ($1) while ($1)
......
...@@ -25,14 +25,10 @@ drop table if exists t1,t2; ...@@ -25,14 +25,10 @@ drop table if exists t1,t2;
!$1164 create table t1 (a int not null auto_increment,primary key (a)) type=heap; !$1164 create table t1 (a int not null auto_increment,primary key (a)) type=heap;
!$1163 create table t1 (a int not null,b text) type=heap; !$1163 create table t1 (a int not null,b text) type=heap;
!$1171 create table t1 (a int ,primary key(a)) type=heap; !$1171 create table t1 (a int ,primary key(a)) type=heap;
!$1121 create table t1 (a int,b text, index(a)) type=isam;
!$1073 create table t1 (a int,b text, index(b)) type=isam;
drop table if exists t1; drop table if exists t1;
!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam;
!$1164 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap; !$1164 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
!$1171 create table t1 (ordid int(8), primary key (ordid)); !$1171 create table t1 (ordid int(8), primary key (ordid));
!$1121 create table t1 (ordid int(8), unique (ordid)) type=isam;
-- error 1044,1 -- error 1044,1
create table not_existing_database.test (a int); create table not_existing_database.test (a int);
......
# This test doesn't work with the embedded version as this code
# assumes that one query is running while we are doing queries on
# a second connection.
# This would work if mysqltest run would be threaded and handle each
# connection in a separate thread.
#
-- source include/not_embedded.inc
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con1; connection con1;
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
# system functions # system functions
# #
select database(),user(); select database(),user() like "%@%";
select version()>="3.23.29"; select version()>="3.23.29";
-- source include/have_isam.inc
drop table if exists t1,t2;
# #
# Test possible problem with rows that are about 65535 bytes long # Test possible problem with rows that are about 65535 bytes long
# #
...@@ -17,3 +21,48 @@ check table t1; ...@@ -17,3 +21,48 @@ check table t1;
repair table t1; repair table t1;
check table t1; check table t1;
drop table t1; drop table t1;
#
# Test of auto_increment; The test for BDB tables is in bdb.test
#
create table t1 (a int not null auto_increment,b int, primary key (a)) type=isam;
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
delete from t1 where a=4 or a=2;
insert into t1 values (NULL,4),(NULL,5),(6,6);
select * from t1;
delete from t1 where a=6;
#show table status like "t1";
replace t1 values (3,1);
replace t1 values (3,3);
ALTER TABLE t1 add c int;
insert into t1 values (NULL,6,6);
select * from t1;
drop table t1;
#
# Test of some CREATE TABLE's that should fail
#
!$1121 create table t1 (a int,b text, index(a)) type=isam;
!$1073 create table t1 (a int,b text, index(b)) type=isam;
!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam;
!$1121 create table t1 (ordid int(8), unique (ordid)) type=isam;
drop table if exists t1;
#
# Test of some show commands
#
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
create table t2 type=isam select * from t1;
optimize table t1;
check table t1,t2;
repair table t1,t2;
check table t2,t1;
lock tables t1 write;
check table t2,t1;
show columns from t1;
show full columns from t1;
show index from t1;
drop table t1,t2;
# This test doesn't work with the embedded version as this code
# assumes that one query is running while we are doing queries on
# a second connection.
# This would work if mysqltest run would be threaded and handle each
# connection in a separate thread.
#
-- source include/not_embedded.inc
connect (con1, localhost, root,,); connect (con1, localhost, root,,);
connect (con2, localhost, root,,); connect (con2, localhost, root,,);
......
...@@ -53,45 +53,3 @@ lock tables t1 write; ...@@ -53,45 +53,3 @@ lock tables t1 write;
check table t2; check table t2;
unlock tables; unlock tables;
drop table t1,t2; drop table t1,t2;
#test to see if select will get the lock ahead of low priority update
connect (locker,localhost,root,,);
connect (reader,localhost,root,,);
connect (writer,localhost,root,,);
connection locker;
create table t1(n int);
insert into t1 values (1);
lock tables t1 write;
connection writer;
send update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
connection locker;
--sleep 2
unlock tables;
connection writer;
reap;
connection reader;
reap;
drop table t1;
connection locker;
create table t1(n int);
insert into t1 values (1);
lock tables t1 read;
connection writer;
send update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
connection locker;
--sleep 2
unlock tables;
connection writer;
reap;
connection reader;
reap;
drop table t1;
# This test doesn't work with the embedded version as this code
# assumes that one query is running while we are doing queries on
# a second connection.
# This would work if mysqltest run would be threaded and handle each
# connection in a separate thread.
#
-- source include/not_embedded.inc
#test to see if select will get the lock ahead of low priority update
connect (locker,localhost,root,,);
connect (reader,localhost,root,,);
connect (writer,localhost,root,,);
connection locker;
create table t1(n int);
insert into t1 values (1);
lock tables t1 write;
connection writer;
send update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
connection locker;
--sleep 2
unlock tables;
connection writer;
reap;
connection reader;
reap;
drop table t1;
connection locker;
create table t1(n int);
insert into t1 values (1);
lock tables t1 read;
connection writer;
send update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
connection locker;
--sleep 2
unlock tables;
connection writer;
reap;
connection reader;
reap;
drop table t1;
-O sort_buffer=0 --set-variable=sort_buffer=0
connect (master,localhost,root,,test,0,mysql-master.sock); connect (master,localhost,root,,test,0,master.sock);
connect (slave,localhost,root,,test,0, mysql-slave.sock); connect (slave,localhost,root,,test,0, slave.sock);
connection master; connection master;
reset master; reset master;
show master status; show master status;
......
connect (master,localhost,root,,test,0,mysql-master.sock); connect (master,localhost,root,,test,0,master.sock);
connect (slave,localhost,root,,test,0,mysql-slave.sock); connect (slave,localhost,root,,test,0,slave.sock);
system cat /dev/null > var/slave-data/master.info; system cat /dev/null > var/slave-data/master.info;
system chmod 000 var/slave-data/master.info; system chmod 000 var/slave-data/master.info;
connection slave; connection slave;
......
connect (master,localhost,root,,test,0,mysql-master.sock); connect (master,localhost,root,,test,0,master.sock);
connect (slave,localhost,root,,test,0,mysql-slave.sock); connect (slave,localhost,root,,test,0,slave.sock);
connection master; connection master;
reset master; reset master;
grant file on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant file on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
......
connect (master,localhost,root,,test,0,mysql-master.sock); connect (master,localhost,root,,test,0,master.sock);
connect (slave,localhost,root,,test,0,mysql-slave.sock); connect (slave,localhost,root,,test,0,slave.sock);
connection slave; connection slave;
reset slave; reset slave;
slave start; slave start;
......
# #
# Test of some show commands # Test of some show commands
# #
drop table if exists t1,t2;
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
create table t2 type=isam select * from t1;
optimize table t1;
check table t1,t2;
repair table t1,t2;
check table t2,t1;
lock tables t1 write;
check table t2,t1;
show columns from t1;
show full columns from t1;
show index from t1;
drop table t1,t2;
drop table if exists t1,t2;
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
check table t1 type=fast; check table t1 type=fast;
......
# This test doesn't work with the embedded version as this code
# assumes that one query is running while we are doing queries on
# a second connection.
# This would work if mysqltest run would be threaded and handle each
# connection in a separate thread.
#
-- source include/not_embedded.inc
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Test of lock tables # Test of lock tables
# #
drop table if exists t1,t2;
create table t1 ( n int auto_increment primary key); create table t1 ( n int auto_increment primary key);
lock tables t1 write; lock tables t1 write;
insert into t1 values(NULL); insert into t1 values(NULL);
...@@ -36,12 +37,10 @@ drop table t1; ...@@ -36,12 +37,10 @@ drop table t1;
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
lock tables t1 write,t1 as b write, t2 write, t2 as c read; lock tables t1 write,t1 as b write, t2 write, t2 as c read;
drop table t1; drop table t1,t2;
drop table t2;
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
lock tables t1 write,t1 as b write, t2 write, t2 as c read; lock tables t1 write,t1 as b write, t2 write, t2 as c read;
drop table t2; drop table t2,t1;
drop table t1;
unlock tables; unlock tables;
...@@ -34,7 +34,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ ...@@ -34,7 +34,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_error.c errors.c my_div.c my_messnc.c \ my_error.c errors.c my_div.c my_messnc.c \
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
my_symlink.c my_symlink2.c \ my_symlink.c my_symlink2.c \
mf_pack.c mf_pack2.c mf_unixpath.c mf_stripp.c \ mf_pack.c mf_unixpath.c mf_stripp.c \
mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \ mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \
mf_qsort.c mf_qsort2.c mf_sort.c \ mf_qsort.c mf_qsort2.c mf_sort.c \
ptr_cmp.c mf_radix.c queues.c \ ptr_cmp.c mf_radix.c queues.c \
......
...@@ -103,7 +103,7 @@ char *get_charsets_dir(char *buf) ...@@ -103,7 +103,7 @@ char *get_charsets_dir(char *buf)
strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR, strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR,
NullS); NullS);
} }
convert_dirname(buf); convert_dirname(buf,buf,NullS);
DBUG_PRINT("info",("charsets dir='%s'", buf)); DBUG_PRINT("info",("charsets dir='%s'", buf));
DBUG_RETURN(strend(buf)); DBUG_RETURN(strend(buf));
} }
......
...@@ -231,11 +231,10 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, ...@@ -231,11 +231,10 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
return 0; /* Ignore wrong paths */ return 0; /* Ignore wrong paths */
if (dir) if (dir)
{ {
strmov(name,dir); end=convert_dirname(name, dir, NullS);
convert_dirname(name);
if (dir[0] == FN_HOMELIB) /* Add . to filenames in home */ if (dir[0] == FN_HOMELIB) /* Add . to filenames in home */
strcat(name,"."); *end++='.';
strxmov(strend(name),config_file,ext,NullS); strxmov(end,config_file,ext,NullS);
} }
else else
{ {
...@@ -369,16 +368,18 @@ void print_defaults(const char *conf_file, const char **groups) ...@@ -369,16 +368,18 @@ void print_defaults(const char *conf_file, const char **groups)
#endif #endif
for (dirs=default_directories ; *dirs; dirs++) for (dirs=default_directories ; *dirs; dirs++)
{ {
const char *pos;
char *end;
if (**dirs) if (**dirs)
strmov(name,*dirs); pos= *dirs;
else if (defaults_extra_file) else if (defaults_extra_file)
strmov(name,defaults_extra_file); pos= defaults_extra_file;
else else
continue; continue;
convert_dirname(name); end=convert_dirname(name, pos, NullS);
if (name[0] == FN_HOMELIB) /* Add . to filenames in home */ if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
strcat(name,"."); *end++='.';
strxmov(strend(name),conf_file,default_ext," ",NullS); strxmov(end,conf_file,default_ext," ",NullS);
fputs(name,stdout); fputs(name,stdout);
} }
puts(""); puts("");
......
...@@ -50,57 +50,69 @@ uint dirname_part(my_string to, const char *name) ...@@ -50,57 +50,69 @@ uint dirname_part(my_string to, const char *name)
DBUG_PRINT("enter",("'%s'",name)); DBUG_PRINT("enter",("'%s'",name));
length=dirname_length(name); length=dirname_length(name);
(void) strmake(to,(char*) name,min(length,FN_REFLEN-2)); convert_dirname(to, name, name+length);
convert_dirname(to); /* Convert chars */
DBUG_RETURN(length); DBUG_RETURN(length);
} /* dirname */ } /* dirname */
/* convert dirname to use under this system */ /*
/* If MSDOS converts '/' to '\' */ Convert directory name to use under this system
/* If VMS converts '<' to '[' and '>' to ']' */ If MSDOS converts '/' to '\'
/* Adds a '/' to end if there isn't one and the last isn't a dev_char */ If VMS converts '<' to '[' and '>' to ']'
/* ARGSUSED */ Adds a FN_LIBCHAR to end if the result string if there isn't one
and the last isn't dev_char.
Copies data from 'from' until ASCII(0) for until from == from_end
If you want to use the whole 'from' string, just send NullS as the
last argument.
If the result string is larger than FN_REFLEN -1, then it's cut.
Returns pointer to end \0
*/
#ifndef FN_DEVCHAR #ifndef FN_DEVCHAR
#define FN_DEVCHAR '\0' /* For easier code */ #define FN_DEVCHAR '\0' /* For easier code */
#endif #endif
char *convert_dirname(my_string to) char *convert_dirname(char *to, const char *from, const char *from_end)
{ {
reg1 char *pos; char *to_org=to;
#ifdef FN_UPPER_CASE
caseup_str(to); /* We use -2 here, becasue we need place for the last FN_LIBCHAR */
#endif if (!from_end || (from_end - from) > FN_REFLEN-2)
#ifdef FN_LOWER_CASE from_end=from+FN_REFLEN -2;
casedn_str(to);
#endif #if FN_LIBCHAR != '/' || defined(FN_C_BEFORE_DIR_2)
#if FN_LIBCHAR != '/'
{
pos=to-1; /* Change from '/' */
while ((pos=strchr(pos+1,'/')) != 0)
*pos=FN_LIBCHAR;
}
#endif
#ifdef FN_C_BEFORE_DIR_2
{ {
for (pos=to ; *pos ; pos++) while (*from && *from != end)
{ {
if (*pos == FN_C_BEFORE_DIR_2) if (*from == '/')
*pos=FN_C_BEFORE_DIR; *to++= FN_LIBCHAR;
if (*pos == FN_C_AFTER_DIR_2) #ifdef FN_C_BEFORE_DIR_2
*pos=FN_C_AFTER_DIR; else if (*from == FN_C_BEFORE_DIR_2)
*to++= FN_C_BEFORE_DIR;
else if (*from == FN_C_AFTER_DIR_2)
*to++= FN_C_AFTER_DIR;
#endif
else
*to++= *from++;
} }
} }
#else #else
{ /* Append FN_LIBCHAR if not there */ /* This is ok even if to == from, becasue we need to cut the string */
pos=strend(to); to= strmake(to, from, (uint) (from_end-from));
if (pos != to && (pos[-1] != FN_LIBCHAR && pos[-1] != FN_DEVCHAR)) #endif
{
*pos++=FN_LIBCHAR; /* Add FN_LIBCHAR to the end of directory path */
*pos=0; if (to != to_org && (to[-1] != FN_LIBCHAR && to[-1] != FN_DEVCHAR))
} {
*to++=FN_LIBCHAR;
*to=0;
} }
#ifdef FN_UPPER_CASE
caseup_str(to_org);
#endif
#ifdef FN_LOWER_CASE
casedn_str(to_org);
#endif #endif
return pos; /* Pointer to end of dir */ return to; /* Pointer to end of dir */
} /* convert_dirname */ } /* convert_dirname */
...@@ -18,64 +18,68 @@ ...@@ -18,64 +18,68 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include <m_string.h> #include <m_string.h>
/* format a filename with replace of library and extension */ /*
/* params to and name may be identicall */ Formats a filename with possible replace of directory of extension
/* function doesn't change name if name != to */ Function can handle the case where 'to' == 'name'
/* Flag may be: 1 replace filenames library with 'dsk' */ For a description of the flag values, consult my_sys.h
/* 2 replace extension with 'form' */ The arguments should be in unix format.
/* 4 Unpack filename (replace ~ with home) */ */
/* 8 Pack filename as short as possibly */
/* 16 Resolve symbolic links for filename */
/* 32 Resolve filename to full path */
/* 64 Return NULL if too long path */
my_string fn_format(my_string to, const char *name, const char *dsk, my_string fn_format(my_string to, const char *name, const char *dir,
const char *form, int flag) const char *extension, uint flag)
{ {
reg1 uint length; reg1 uint length;
char dev[FN_REFLEN], buff[FN_REFLEN], *pos, *startpos; char dev[FN_REFLEN], buff[FN_REFLEN], *pos, *startpos;
const char *ext; const char *ext;
DBUG_ENTER("fn_format"); DBUG_ENTER("fn_format");
DBUG_PRINT("enter",("name: %s dsk: %s form: %s flag: %d", DBUG_PRINT("enter",("name: %s dir: %s extension: %s flag: %d",
name,dsk,form,flag)); name,dir,extension,flag));
/* Kopiera & skippa enheten */ /* Copy and skip directory */
name+=(length=dirname_part(dev,(startpos=(my_string) name))); name+=(length=dirname_part(dev,(startpos=(my_string) name)));
if (length == 0 || flag & 1) if (length == 0 || (flag & MY_REPLACE_DIR))
{
/* Use given directory */
convert_dirname(dev,dir,NullS); /* Fix to this OS */
}
else if ((flag & MY_RELATIVE_PATH) && !test_if_hard_path(name))
{ {
(void) strmake(dev,dsk, sizeof(dev) - 2); /* Put 'dir' before the given path */
/* Use given directory */ strmake(buff,dev,sizeof(buff)-1);
convert_dirname(dev); /* Fix to this OS */ pos=convert_dirname(dev,dir,NullS);
strmake(pos,buff,sizeof(buff)-1- (int) (pos-dev));
} }
if (flag & 8)
if (flag & MY_PACK_FILENAME)
pack_dirname(dev,dev); /* Put in ./.. and ~/.. */ pack_dirname(dev,dev); /* Put in ./.. and ~/.. */
if (flag & 4) if (flag & MY_UNPACK_FILENAME)
(void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */ (void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */
if ((pos=(char*)strchr(name,FN_EXTCHAR)) != NullS) if ((pos= (char*) strchr(name,FN_EXTCHAR)) != NullS)
{ {
if ((flag & 2) == 0) /* Skall vi byta extension ? */ if ((flag & MY_REPLACE_EXT) == 0) /* If we should keep old ext */
{ {
length=strlength(name); /* Old extension */ length=strlength(name); /* Use old extension */
ext = ""; ext = "";
} }
else else
{ {
length=(uint) (pos-(char*) name); /* Change extension */ length=(uint) (pos-(char*) name); /* Change extension */
ext= form; ext= extension;
} }
} }
else else
{ {
length=strlength(name); /* Har ingen ext- tag nya */ length=strlength(name); /* No ext, use the now one */
ext=form; ext=extension;
} }
if (strlen(dev)+length+strlen(ext) >= FN_REFLEN || length >= FN_LEN ) if (strlen(dev)+length+strlen(ext) >= FN_REFLEN || length >= FN_LEN )
{ /* To long path, return original */ {
/* To long path, return original or NULL */
uint tmp_length; uint tmp_length;
if (flag & 64) if (flag & MY_SAFE_PATH)
return 0; return NullS;
tmp_length=strlength(startpos); tmp_length=strlength(startpos);
DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %d",dev,ext,length)); DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %d",dev,ext,length));
(void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1)); (void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1));
...@@ -96,9 +100,14 @@ my_string fn_format(my_string to, const char *name, const char *dsk, ...@@ -96,9 +100,14 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
#endif #endif
(void) strmov(pos,ext); /* Don't convert extension */ (void) strmov(pos,ext); /* Don't convert extension */
} }
if (flag & 32) /*
(void) my_realpath(to, to, MYF(flag & 32 ? 0 : MY_RESOLVE_LINK)); If MY_RETURN_REAL_PATH and MY_RESOLVE_SYMLINK is given, only do
else if (flag & 16) realpath if the file is a symbolic link
*/
if (flag & MY_RETURN_REAL_PATH)
(void) my_realpath(to, to, MYF(flag & MY_RESOLVE_SYMLINKS ?
MY_RESOLVE_LINK: 0));
else if (flag & MY_RESOLVE_SYMLINKS)
{ {
strmov(buff,to); strmov(buff,to);
(void) my_readlink(to, buff, MYF(0)); (void) my_readlink(to, buff, MYF(0));
......
...@@ -459,8 +459,7 @@ my_string intern_filename(my_string to, const char *from) ...@@ -459,8 +459,7 @@ my_string intern_filename(my_string to, const char *from)
my_string pos,from_pos,to_pos,end_pos; my_string pos,from_pos,to_pos,end_pos;
char buff[FN_REFLEN]; char buff[FN_REFLEN];
(void) strmov(buff,from); convert_dirname(buff,from,NullS); /* change '<>' to '[]' */
convert_dirname(buff); /* change '<>' to '[]' */
from_pos=buff; from_pos=buff;
if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */ if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */
{ {
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
#include "mysys_priv.h"
#include <m_string.h>
/* Pack a filename for output on screen */
/* Changes long paths to .../ */
/* Removes pathname and extension */
/* If not possibly to pack returns '?' in to and returns 1*/
int pack_filename(my_string to, const char *name, size_s max_length)
/* to may be name */
{
int i;
char buff[FN_REFLEN];
if (strlen(fn_format(to,name,"","",0)) <= max_length)
return 0;
if (strlen(fn_format(to,name,"","",8)) <= max_length)
return 0;
if (strlen(fn_format(buff,name,".../","",1)) <= max_length)
{
VOID(strmov(to,buff));
return 0;
}
for (i= 0 ; i < 3 ; i++)
{
if (strlen(fn_format(buff,to,"","", i == 0 ? 2 : i == 1 ? 1 : 3 ))
<= max_length)
{
VOID(strmov(to,buff));
return 0;
}
}
to[0]='?'; to[1]=0; /* Can't pack filename */
return 1;
} /* pack_filename */
...@@ -101,8 +101,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, ...@@ -101,8 +101,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
errno=my_errno= ENAMETOOLONG; errno=my_errno= ENAMETOOLONG;
return 1; return 1;
} }
strmov(to,dir); strmov(convert_dirname(to,dir,NullS),prefix_buff);
strmov(convert_dirname(to),prefix_buff);
org_file=mkstemp(to); org_file=mkstemp(to);
file=my_register_filename(org_file, to, FILE_BY_MKSTEMP, file=my_register_filename(org_file, to, FILE_BY_MKSTEMP,
EE_CANTCREATEFILE, MyFlags); EE_CANTCREATEFILE, MyFlags);
......
...@@ -28,6 +28,7 @@ bin_SCRIPTS = @server_scripts@ \ ...@@ -28,6 +28,7 @@ bin_SCRIPTS = @server_scripts@ \
mysql_find_rows \ mysql_find_rows \
mysqlhotcopy \ mysqlhotcopy \
mysqldumpslow \ mysqldumpslow \
mysql_explain_log \
mysqld_multi mysqld_multi
EXTRA_SCRIPTS = make_binary_distribution.sh \ EXTRA_SCRIPTS = make_binary_distribution.sh \
...@@ -43,6 +44,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \ ...@@ -43,6 +44,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
mysql_find_rows.sh \ mysql_find_rows.sh \
mysqlhotcopy.sh \ mysqlhotcopy.sh \
mysqldumpslow.sh \ mysqldumpslow.sh \
mysql_explain_log.sh \
mysqld_multi.sh \ mysqld_multi.sh \
mysqld_safe.sh mysqld_safe.sh
...@@ -95,6 +97,8 @@ SUFFIXES = .sh ...@@ -95,6 +97,8 @@ SUFFIXES = .sh
-e 's!@''CXXFLAGS''@!@SAVE_CXXFLAGS@!'\ -e 's!@''CXXFLAGS''@!@SAVE_CXXFLAGS@!'\
-e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\ -e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\
-e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \ -e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \
-e 's!@''LIBS''@!@LIBS@!' \
-e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \
-e 's!@''VERSION''@!@VERSION@!' \ -e 's!@''VERSION''@!@VERSION@!' \
-e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \ -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
-e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \ -e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \
......
...@@ -31,16 +31,18 @@ client_libs='@CLIENT_LIBS@' ...@@ -31,16 +31,18 @@ client_libs='@CLIENT_LIBS@'
libs="$ldflags -L'$pkglibdir' -lmysqlclient $client_libs" libs="$ldflags -L'$pkglibdir' -lmysqlclient $client_libs"
cflags="-I'$pkgincludedir'" cflags="-I'$pkgincludedir'"
embedded_libs="$ldflags -L'$pkglibdir' -lmysqld @LIBS@ @innodb_system_libs@"
usage () { usage () {
cat <<EOF cat <<EOF
Usage: $0 [OPTIONS] Usage: $0 [OPTIONS]
Options: Options:
--cflags [$cflags] --cflags [$cflags]
--libs [$libs] --libs [$libs]
--socket [$socket] --socket [$socket]
--port [$port] --port [$port]
--version [$version] --version [$version]
--libmysqld-libs [$embedded_libs]
EOF EOF
exit 1 exit 1
} }
...@@ -54,6 +56,7 @@ while test $# -gt 0; do ...@@ -54,6 +56,7 @@ while test $# -gt 0; do
--socket) echo "$socket" ;; --socket) echo "$socket" ;;
--port) echo "$port" ;; --port) echo "$port" ;;
--version) echo "$version" ;; --version) echo "$version" ;;
--embedded-libs | --embedded | libmysqld-libs) echo "$embedded_libs" ;;
*) usage ;; *) usage ;;
esac esac
......
This diff is collapsed.
...@@ -29,7 +29,7 @@ WRAPLIBS= @WRAPLIBS@ ...@@ -29,7 +29,7 @@ WRAPLIBS= @WRAPLIBS@
SUBDIRS = share SUBDIRS = share
libexec_PROGRAMS = mysqld libexec_PROGRAMS = mysqld
noinst_PROGRAMS = gen_lex_hash noinst_PROGRAMS = gen_lex_hash
gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@ gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@
LDADD = ../isam/libnisam.a \ LDADD = ../isam/libnisam.a \
../merge/libmerge.a \ ../merge/libmerge.a \
../myisam/libmyisam.a \ ../myisam/libmyisam.a \
...@@ -43,7 +43,7 @@ LDADD = ../isam/libnisam.a \ ...@@ -43,7 +43,7 @@ LDADD = ../isam/libnisam.a \
mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \ mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@bdb_libs@ @innodb_libs@ @pstack_libs@ \ @bdb_libs@ @innodb_libs@ @pstack_libs@ \
@gemini_libs@ \ @gemini_libs@ @innodb_system_libs@ \
$(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ @openssl_libs@ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ @openssl_libs@
noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
item_strfunc.h item_timefunc.h item_uniq.h \ item_strfunc.h item_timefunc.h item_uniq.h \
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment