summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/Makefile.am2
-rw-r--r--sql/gen_lex_hash.cc12
-rw-r--r--sql/ha_myisammrg.cc23
-rw-r--r--sql/handler.h8
-rw-r--r--sql/lex.h1
-rw-r--r--sql/mini_client.cc2
-rw-r--r--sql/mysql_embed.h26
-rw-r--r--sql/net_serv.cc1
-rw-r--r--sql/sql_show.cc1
-rw-r--r--sql/sql_yacc.yy11
10 files changed, 48 insertions, 39 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am
index f6d7888691d..ea29aa2e5a7 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -57,7 +57,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
sql_select.h structs.h table.h sql_udf.h hash_filo.h\
lex.h lex_symbol.h sql_acl.h sql_crypt.h md5.h \
log_event.h mini_client.h sql_repl.h slave.h \
- stacktrace.h sql_sort.h mysql_embed.h
+ stacktrace.h sql_sort.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index 722f5226980..cfd859acf06 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -216,7 +216,7 @@ you have to change 'main' to print out the new function\n");
return(1);
}
- if (opt_verbose)
+ if (opt_verbose > 1)
fprintf (stderr,"Info: Possible add values: %d\n",found-type_count);
for (prime=primes; (function_mod=*prime) ; prime++)
@@ -376,7 +376,7 @@ static int get_options(int argc, char **argv)
opt_search=1;
break;
case 'v':
- opt_verbose=1;
+ opt_verbose++;
break;
case 'V': usage(1); exit(0);
case 'I':
@@ -473,7 +473,7 @@ int main(int argc,char **argv)
MY_INIT(argv[0]);
- start_value=2250933L; best_t1=2721579L; best_t2=4627039L; best_type=3; /* mode=4567 add=4 type: 0 */
+ start_value=4198729L; best_t1=6245075L; best_t2=3686256L; best_type=4; /* mode=5839 add=1 type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
@@ -493,7 +493,7 @@ int main(int argc,char **argv)
printf("start_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; /* mode=%d add=%d type: %d */\n",
start_value, best_t1,best_t2,best_type,best_mod,best_add,
best_functype);
-
+ best_start_value=start_value;
for (uint i=1 ; i <= opt_count ; i++)
{
if (i % 10 == 0)
@@ -516,6 +516,10 @@ int main(int argc,char **argv)
best_start_value,best_t1,best_t2,best_type,best_mod,best_add,
best_functype);
}
+ if (opt_verbose && (i % 20000) == 0)
+ printf("\nstart_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; /* mode=%d add=%d type: %d */\n",
+ best_start_value,best_t1,best_t2,best_type,best_mod,best_add,
+ best_functype);
}
}
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index abcf81806ad..92c1372a7a1 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -66,7 +66,13 @@ int ha_myisammrg::close(void)
int ha_myisammrg::write_row(byte * buf)
{
- return (my_errno=HA_ERR_WRONG_COMMAND);
+ statistic_increment(ha_write_count,&LOCK_status);
+ if (table->time_stamp)
+ update_timestamp(buf+table->time_stamp-1);
+ if (table->next_number_field && buf == table->record[0])
+ return (my_errno=HA_ERR_WRONG_COMMAND);
+ // update_auto_increment(); - [phi] have to check this before allowing it
+ return myrg_write(file,buf);
}
int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
@@ -217,6 +223,7 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
{
+ // [phi] auto_increment stuff is missing (but currently not needed)
DBUG_ENTER("ha_myisammrg::update_create_info");
if (!(create_info->used_fields & HA_CREATE_USED_UNION))
{
@@ -241,6 +248,10 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
}
*create_info->merge_list.next=0;
}
+ if (!(create_info->used_fields & HA_CREATE_USED_INSERT_METHOD))
+ {
+ create_info->merge_insert_method = file->merge_insert_method;
+ }
DBUG_VOID_RETURN;
err:
@@ -263,12 +274,20 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
*pos++= tables->real_name;
*pos=0;
DBUG_RETURN(myrg_create(fn_format(buff,name,"","",2+4+16),
- (const char **) table_names, (my_bool) 0));
+ (const char **) table_names,
+ create_info->merge_insert_method,
+ (my_bool) 0));
}
void ha_myisammrg::append_create_info(String *packet)
{
char buff[FN_REFLEN];
+ if (file->merge_insert_method != MERGE_INSERT_DISABLED)
+ {
+ packet->append(" INSERT_METHOD=",15);
+ const char *tmp = get_type(&merge_insert_method,file->merge_insert_method);
+ packet->append(tmp);
+ }
packet->append(" UNION=(",8);
MYRG_TABLE *table,*first;
diff --git a/sql/handler.h b/sql/handler.h
index 5cf39daeadf..dee71e8ebda 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -120,9 +120,10 @@ enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC,
/* struct to hold information about the table that should be created */
/* Bits in used_fields */
-#define HA_CREATE_USED_AUTO 1
-#define HA_CREATE_USED_RAID 2
-#define HA_CREATE_USED_UNION 4
+#define HA_CREATE_USED_AUTO 1
+#define HA_CREATE_USED_RAID 2
+#define HA_CREATE_USED_UNION 4
+#define HA_CREATE_USED_INSERT_METHOD 8
typedef struct st_thd_trans {
void *bdb_tid;
@@ -150,6 +151,7 @@ typedef struct st_ha_create_information
bool if_not_exists;
ulong used_fields;
SQL_LIST merge_list;
+ uint merge_insert_method;
} HA_CREATE_INFO;
diff --git a/sql/lex.h b/sql/lex.h
index ca797e5b894..5decf089e68 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -178,6 +178,7 @@ static SYMBOL symbols[] = {
{ "INNODB", SYM(INNOBASE_SYM),0,0},
{ "INSERT", SYM(INSERT),0,0},
{ "INSERT_ID", SYM(INSERT_ID),0,0},
+ { "INSERT_METHOD", SYM(INSERT_METHOD),0,0},
{ "INT", SYM(INT_SYM),0,0},
{ "INTEGER", SYM(INT_SYM),0,0},
{ "INTERVAL", SYM(INTERVAL_SYM),0,0},
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index 1afe4c97b8e..d60a3bce880 100644
--- a/sql/mini_client.cc
+++ b/sql/mini_client.cc
@@ -22,7 +22,6 @@
in case we decide to make them external at some point
*/
-#define DONT_USE_RAID
#if defined(__WIN__)
#include <winsock.h>
#include <odbcinst.h>
@@ -41,6 +40,7 @@ inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __a
#endif
#include <my_global.h>
+#include <mysql_embed.h>
#include <mysql_com.h>
#include <violite.h>
#include <my_sys.h>
diff --git a/sql/mysql_embed.h b/sql/mysql_embed.h
deleted file mode 100644
index 4bfaca547a8..00000000000
--- a/sql/mysql_embed.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Defines that are unique to the embedded version of MySQL */
-
-#ifdef EMBEDDED_LIBRARY
-
-/* Things we don't need in the embedded version of MySQL */
-
-#undef HAVE_PSTACK /* No stacktrace */
-#undef HAVE_DLOPEN /* No udf functions */
-
-#endif /* EMBEDDED_LIBRARY */
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 43650f365bb..59fee295b60 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -31,6 +31,7 @@
#include <winsock.h>
#endif
#include <my_global.h>
+#include "mysql_embed.h"
#include <mysql_com.h>
#include <violite.h>
#include <my_sys.h>
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b51e9ab5a73..67713b85720 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -17,7 +17,6 @@
/* Function with list databases, tables or fields */
-#include "my_global.h"
#include "mysql_priv.h"
#include "sql_select.h" // For select_describe
#include "sql_acl.h"
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 6d80234082d..1995c1295f1 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -27,6 +27,7 @@
#include "sql_acl.h"
#include "lex_symbol.h"
#include <myisam.h>
+#include <myisammrg.h>
extern void yyerror(const char*);
int yylex(void *yylval);
@@ -390,6 +391,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token IDENTIFIED_SYM
%token IF
%token INSERT_ID
+%token INSERT_METHOD
%token INTERVAL_SYM
%token LAST_INSERT_ID
%token LEFT
@@ -490,7 +492,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
table_option opt_if_not_exists
%type <ulong_num>
- ULONG_NUM raid_types
+ ULONG_NUM raid_types merge_insert_types
%type <ulonglong_number>
ulonglong_num
@@ -796,6 +798,7 @@ create_table_option:
table_list->next=0;
lex->create_info.used_fields|= HA_CREATE_USED_UNION;
}
+ | INSERT_METHOD EQ merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;}
| DATA_SYM DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.data_file_name= $4.str; }
| INDEX DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.index_file_name= $4.str; }
@@ -819,6 +822,11 @@ raid_types:
| RAID_0_SYM { $$= RAID_TYPE_0; }
| ULONG_NUM { $$=$1;}
+merge_insert_types:
+ NO_SYM { $$= MERGE_INSERT_DISABLED; }
+ | FIRST_SYM { $$= MERGE_INSERT_TO_FIRST; }
+ | LAST_SYM { $$= MERGE_INSERT_TO_LAST; }
+
opt_select_from:
/* empty */
| select_from select_lock_type
@@ -2862,6 +2870,7 @@ keyword:
| ISAM_SYM {}
| ISSUER_SYM {}
| INNOBASE_SYM {}
+ | INSERT_METHOD {}
| LAST_SYM {}
| LEVEL_SYM {}
| LOCAL_SYM {}