diff options
author | unknown <joreland@mysql.com> | 2005-01-19 07:37:42 +0100 |
---|---|---|
committer | unknown <joreland@mysql.com> | 2005-01-19 07:37:42 +0100 |
commit | 7cbe4d19e4f152fcb5c7b0e2cb3da116132b8aef (patch) | |
tree | f254fa19624bbd4b2781b2a8bf2cf8433c04a84e /sql/ha_innodb.cc | |
parent | 0eb1a8107f2b245b6bbcdc78d0a49a78996df3c9 (diff) | |
parent | bfe74e69903583f1bb9b4ad803c137d6487afa74 (diff) | |
download | mariadb-git-7cbe4d19e4f152fcb5c7b0e2cb3da116132b8aef.tar.gz |
Merge mysql.com:/home/jonas/src/mysql-5.0
into mysql.com:/home/jonas/src/mysql-5.0-ndb
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/mysqld.cc:
Auto merged
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r-- | sql/ha_innodb.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index d49f1c1ad46..18ab6f42d28 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2425,6 +2425,8 @@ build_template( templ->mysql_col_len = (ulint) field->pack_length(); templ->type = get_innobase_type_from_mysql_type(field); + templ->charset = dtype_get_charset_coll_noninline( + index->table->cols[i].type.prtype); templ->is_unsigned = (ulint) (field->flags & UNSIGNED_FLAG); if (templ->type == DATA_BLOB) { @@ -4092,6 +4094,48 @@ ha_innobase::discard_or_import_tablespace( } /********************************************************************* +Deletes all rows of an InnoDB table. */ + +int +ha_innobase::delete_all_rows(void) +/*==============================*/ + /* out: error number */ +{ + row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt; + int error; + trx_t* trx; + THD* thd = current_thd; + + DBUG_ENTER("ha_innobase::delete_all_rows"); + + if (thd->lex->sql_command != SQLCOM_TRUNCATE) { + fallback: + /* We only handle TRUNCATE TABLE t as a special case. + DELETE FROM t will have to use ha_innobase::delete_row(). */ + DBUG_RETURN(my_errno=HA_ERR_WRONG_COMMAND); + } + + /* Get the transaction associated with the current thd, or create one + if not yet created */ + + trx = check_trx_exists(thd); + + /* Truncate the table in InnoDB */ + + error = row_truncate_table_for_mysql(prebuilt->table, trx); + if (error == DB_ERROR) { + /* Cannot truncate; resort to ha_innobase::delete_row() */ + goto fallback; + } + + innobase_commit_low(trx); + + error = convert_error_code_to_mysql(error, NULL); + + DBUG_RETURN(error); +} + +/********************************************************************* Drops a table from an InnoDB database. Before calling this function, MySQL calls innobase_commit to commit the transaction of the current user. Then the current user cannot have locks set on the table. Drop table |