summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-03-29 17:57:07 +0300
committerunknown <monty@mysql.com>2004-03-29 17:57:07 +0300
commit33c669fdde6940deebb9be0d19019d886c33cd74 (patch)
tree99c0257fe8779ed78345d81aa4c907abe076bf82 /sql/sql_insert.cc
parenteb023e70e2cb448da773d3704f08a394b0466335 (diff)
downloadmariadb-git-33c669fdde6940deebb9be0d19019d886c33cd74.tar.gz
Disable INSERT DELAYED for embedded library
sql-bench/crash-me.sh: Fixed typo sql/mysql_priv.h: Moved things for embedded library into one section sql/sql_string.cc: Simple optimization
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc26
1 files changed, 20 insertions, 6 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index a9b947505f0..928afa66916 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -112,14 +112,13 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
List<Item> &update_values,
enum_duplicates duplic)
{
- int error;
+ int error, res;
/*
log_on is about delayed inserts only.
By default, both logs are enabled (this won't cause problems if the server
runs without --log-update or --log-bin).
*/
int log_on= DELAYED_LOG_UPDATE | DELAYED_LOG_BIN ;
-
bool transactional_table, log_delayed, bulk_insert;
uint value_count;
ulong counter = 1;
@@ -148,15 +147,20 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
if we are told to replace duplicates, the insert cannot be concurrent
delayed insert changed to regular in slave thread
*/
+#ifdef EMBEDDED_LIBRARY
+ if (lock_type == TL_WRITE_DELAYED)
+ lock_type=TL_WRITE;
+#else
if ((lock_type == TL_WRITE_DELAYED &&
((specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) ||
thd->slave_thread || !thd->variables.max_insert_delayed_threads)) ||
(lock_type == TL_WRITE_CONCURRENT_INSERT && duplic == DUP_REPLACE) ||
(duplic == DUP_UPDATE))
lock_type=TL_WRITE;
+#endif
table_list->lock_type= lock_type;
- int res;
+#ifndef EMBEDDED_LIBRARY
if (lock_type == TL_WRITE_DELAYED)
{
if (thd->locked_tables)
@@ -185,6 +189,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
}
}
else
+#endif /* EMBEDDED_LIBRARY */
res= open_and_lock_tables(thd, table_list);
if (res)
DBUG_RETURN(-1);
@@ -302,12 +307,14 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
break;
}
}
+#ifndef EMBEDDED_LIBRARY
if (lock_type == TL_WRITE_DELAYED)
{
error=write_delayed(thd,table,duplic,query, thd->query_length, log_on);
query=0;
}
else
+#endif
error=write_record(table,&info);
if (error)
break;
@@ -328,6 +335,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
Now all rows are inserted. Time to update logs and sends response to
user
*/
+#ifndef EMBEDDED_LIBRARY
if (lock_type == TL_WRITE_DELAYED)
{
if (!error)
@@ -339,6 +347,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
query_cache_invalidate3(thd, table_list, 1);
}
else
+#endif
{
if (bulk_insert)
{
@@ -435,8 +444,10 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
DBUG_RETURN(0);
abort:
+#ifndef EMBEDDED_LIBRARY
if (lock_type == TL_WRITE_DELAYED)
end_delayed_insert(thd);
+#endif
free_underlaid_joins(thd, &thd->lex->select_lex);
table->insert_values=0;
DBUG_RETURN(-1);
@@ -608,6 +619,8 @@ static int check_null_fields(THD *thd __attribute__((unused)),
A thread is created for each table that one uses with the DELAYED attribute.
*****************************************************************************/
+#ifndef EMBEDDED_LIBRARY
+
class delayed_row :public ilink {
public:
char *record,*query;
@@ -1396,8 +1409,7 @@ bool delayed_insert::handle_inserts(void)
pthread_mutex_lock(&mutex);
DBUG_RETURN(1);
}
-
-
+#endif /* EMBEDDED_LIBRARY */
/***************************************************************************
Store records in INSERT ... SELECT *
@@ -1674,7 +1686,9 @@ void select_create::abort()
#ifdef __GNUC__
template class List_iterator_fast<List_item>;
+#ifndef EMBEDDED_LIBRARY
template class I_List<delayed_insert>;
template class I_List_iterator<delayed_insert>;
template class I_List<delayed_row>;
-#endif
+#endif /* EMBEDDED_LIBRARY */
+#endif /* __GNUC__ */