summaryrefslogtreecommitdiff
path: root/innobase/os
diff options
context:
space:
mode:
authorunknown <osku@127.(none)>2005-09-23 16:22:27 +0300
committerunknown <osku@127.(none)>2005-09-23 16:22:27 +0300
commit3e7edb2b5bb900fe813605f1895a650e18131fbb (patch)
tree43f72da6760864b8d20d6e9cdf26fd07d9b15b08 /innobase/os
parentdba6991085bfeef3e0d9388ef65369fde38cbb7a (diff)
downloadmariadb-git-3e7edb2b5bb900fe813605f1895a650e18131fbb.tar.gz
Fix bug #3443, better foreign key error messsages.
innobase/dict/dict0dict.c: Add 'add_newline' parameter to dict_print_info_on_foreign_key_in_create_format. innobase/include/dict0dict.h: Add 'add_newline' parameter to dict_print_info_on_foreign_key_in_create_format. innobase/include/os0file.h: Add os_file_read_string. innobase/include/trx0trx.h: Add trx_set_detailed_error and trx_set_detailed_error_from_file functions and a detailed_error field to trx_struct. innobase/include/ut0mem.h: Add ut_strlcpy. innobase/os/os0file.c: Add os_file_read_string. innobase/row/row0ins.c: Add row_ins_set_detailed function and call it when needed. Adapt to changes in dict_print_info_on_foreign_key_in_create_format. innobase/trx/trx0trx.c: Add trx_set_detailed_error and trx_set_detailed_error_from_file. Clear trx->detailed_error in trx_create. innobase/ut/ut0mem.c: Add ut_strlcpy. mysql-test/r/innodb.result: Add new tests, adapt existing ones whose output was changed. mysql-test/t/innodb.test: Add new tests, adapt existing ones whose output was changed. sql/ha_innodb.cc: Add get_error_message. Clear trx->detailed_error in start_stmt and external_lock. sql/ha_innodb.h: Add get_error_message. sql/handler.cc: Add special case code in print_error for HA_ERR_ROW_IS_REFERENCED and HA_ERR_NO_REFERENCED_ROW. Change SETMSG to point to new error messages. sql/share/errmsg.txt: Add ER_ROW_IS_REFERENCED_2 and ER_NO_REFERENCED_ROW_2.
Diffstat (limited to 'innobase/os')
-rw-r--r--innobase/os/os0file.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 9c87b59f018..20a3303d12d 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -2249,6 +2249,29 @@ error_handling:
}
/***********************************************************************
+Rewind file to its start, read at most size - 1 bytes from it to str, and
+NUL-terminate str. All errors are silently ignored. This function is
+mostly meant to be used with temporary files. */
+
+void
+os_file_read_string(
+/*================*/
+ FILE* file, /* in: file to read from */
+ char* str, /* in: buffer where to read */
+ ulint size) /* in: size of buffer */
+{
+ size_t flen;
+
+ if (size == 0) {
+ return;
+ }
+
+ rewind(file);
+ flen = fread(str, 1, size - 1, file);
+ str[flen] = '\0';
+}
+
+/***********************************************************************
Requests a synchronous write operation. */
ibool