summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-09-02 13:47:00 +0300
committerunknown <monty@hundin.mysql.fi>2001-09-02 13:47:00 +0300
commitb67d11e17ca6ae8b4b0a0d5a5b5fccceff641a26 (patch)
treee5581eaf73302fbd721a4c17983fb6fdfca266d0 /sql/sql_insert.cc
parentfc14066488c52252779495a411fee6de2e478192 (diff)
downloadmariadb-git-b67d11e17ca6ae8b4b0a0d5a5b5fccceff641a26.tar.gz
Changed DB_TYPE_INNOBASE to DB_TYPE_INNODB
Fix that DROP DATABASE works with all table types Use BULK_INSERT when inserting more than one row Better TRUNCATE TABLE BitKeeper/deleted/.del-compilation_finished.au.gz~70bd14095a918139: Delete: sounds/compilation_finished.au.gz BUILD/FINISH.sh: Removed 'finished' sound as this isn't a general solution. Docs/manual.texi: Added upgrading from 3.23 configure.in: Fixed version number sql/ha_innobase.cc: Default creation of InnoDB tables. sql/ha_myisam.cc: Disable BULK_INSERT of using safe mode sql/handler.cc: Changed DB_TYPE_INNOBASE to DB_TYPE_INNODB sql/handler.h: Changed DB_TYPE_INNOBASE to DB_TYPE_INNODB sql/lock.cc: Added lock_and_wait_for_table_name sql/mysql_priv.h: Better TRUNCATE TABLE sql/sql_db.cc: Fix that DROP DATABASE works with all table types sql/sql_delete.cc: Better TRUNCATE TABLE sql/sql_insert.cc: Use BULK_INSERT when inserting more than one row sql/sql_load.cc: Small bug fix. sql/sql_parse.cc: Better TRUNCATE TABLE sql/sql_select.cc: Change INNOBASE -> INNODB sql/sql_table.cc: Better TRUNCATE TABLE sql/sql_yacc.yy: INNOBASE -> INNODB sql/thr_malloc.cc: Fix for replication
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc30
1 files changed, 28 insertions, 2 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index c21e7668a02..f53dd12016b 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -103,7 +103,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
int error;
bool log_on= ((thd->options & OPTION_UPDATE_LOG) ||
!(thd->master_access & PROCESS_ACL));
- bool using_transactions;
+ bool using_transactions, bulk_insert=0;
uint value_count;
uint save_time_stamp;
ulong counter = 1;
@@ -193,6 +193,14 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
thd->proc_info="update";
if (duplic == DUP_IGNORE || duplic == DUP_REPLACE)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
+ if ((bulk_insert= (values_list.elements > 1 &&
+ lock_type != TL_WRITE_DELAYED &&
+ !(specialflag & SPECIAL_SAFE_MODE))))
+ {
+ table->file->extra(HA_EXTRA_WRITE_CACHE);
+ table->file->extra(HA_EXTRA_BULK_INSERT_BEGIN);
+ }
+
while ((values = its++))
{
if (fields.elements || !value_count)
@@ -257,6 +265,25 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
}
else
{
+ if (bulk_insert)
+ {
+ if (table->file->extra(HA_EXTRA_NO_CACHE))
+ {
+ if (!error)
+ {
+ table->file->print_error(my_errno,MYF(0));
+ error=1;
+ }
+ }
+ if (table->file->extra(HA_EXTRA_BULK_INSERT_END))
+ {
+ if (!error)
+ {
+ table->file->print_error(my_errno,MYF(0));
+ error=1;
+ }
+ }
+ }
if (id && values_list.elements != 1)
thd->insert_id(id); // For update log
else if (table->next_number_field)
@@ -289,7 +316,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
thd->next_insert_id=0; // Reset this if wrongly used
if (duplic == DUP_IGNORE || duplic == DUP_REPLACE)
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
-
if (error)
goto abort;