28 #ifndef UNIV_INNOCHECKSUM
41 #ifndef UNIV_HOTBACKUP
44 # include "mysql_com.h"
55 #define WIN_TO_UNIX_DELTA_USEC ((ib_int64_t) 11644473600000000ULL)
76 GetSystemTimeAsFileTime(&ft);
78 tm = (ib_int64_t) ft.dwHighDateTime << 32;
79 tm |= ft.dwLowDateTime;
88 tm -= WIN_TO_UNIX_DELTA_USEC;
90 tv->tv_sec = (long) (tm / 1000000L);
91 tv->tv_usec = (long) (tm % 1000000L);
98 #define ut_gettimeofday gettimeofday
113 #ifndef UNIV_HOTBACKUP
129 int errno_gettimeofday;
132 for (i = 0; i < 10; i++) {
137 errno_gettimeofday = errno;
139 fprintf(stderr,
" InnoDB: gettimeofday(): %s\n",
140 strerror(errno_gettimeofday));
142 errno = errno_gettimeofday;
149 *sec = (ulint) tv.tv_sec;
150 *ms = (ulint) tv.tv_usec;
172 us = (ullint) tv.tv_sec * 1000000 + tv.tv_usec;
195 return((ulint) tv.tv_sec * 1000 + tv.tv_usec / 1000);
209 return(difftime(time2, time1));
224 #ifndef UNIV_INNOCHECKSUM
231 GetLocalTime(&cal_tm);
233 fprintf(file,
"%d-%02d-%02d %02d:%02d:%02d %lx",
238 (
int) cal_tm.wMinute,
239 (
int) cal_tm.wSecond,
242 struct tm* cal_tm_ptr;
245 #ifdef HAVE_LOCALTIME_R
248 localtime_r(&tm, &cal_tm);
249 cal_tm_ptr = &cal_tm;
252 cal_tm_ptr = localtime(&tm);
254 fprintf(file,
"%d-%02d-%02d %02d:%02d:%02d %lx",
255 cal_tm_ptr->tm_year + 1900,
256 cal_tm_ptr->tm_mon + 1,
265 #ifndef UNIV_INNOCHECKSUM
278 GetLocalTime(&cal_tm);
280 sprintf(buf,
"%02d%02d%02d %2d:%02d:%02d",
281 (
int) cal_tm.wYear % 100,
285 (
int) cal_tm.wMinute,
286 (
int) cal_tm.wSecond);
288 struct tm* cal_tm_ptr;
291 #ifdef HAVE_LOCALTIME_R
294 localtime_r(&tm, &cal_tm);
295 cal_tm_ptr = &cal_tm;
298 cal_tm_ptr = localtime(&tm);
300 sprintf(buf,
"%02d%02d%02d %2d:%02d:%02d",
301 cal_tm_ptr->tm_year % 100,
302 cal_tm_ptr->tm_mon + 1,
310 #ifdef UNIV_HOTBACKUP
316 ut_sprintf_timestamp_without_extra_chars(
323 GetLocalTime(&cal_tm);
325 sprintf(buf,
"%02d%02d%02d_%2d_%02d_%02d",
326 (
int) cal_tm.wYear % 100,
330 (
int) cal_tm.wMinute,
331 (
int) cal_tm.wSecond);
333 struct tm* cal_tm_ptr;
336 #ifdef HAVE_LOCALTIME_R
339 localtime_r(&tm, &cal_tm);
340 cal_tm_ptr = &cal_tm;
343 cal_tm_ptr = localtime(&tm);
345 sprintf(buf,
"%02d%02d%02d_%2d_%02d_%02d",
346 cal_tm_ptr->tm_year % 100,
347 cal_tm_ptr->tm_mon + 1,
359 ut_get_year_month_day(
368 GetLocalTime(&cal_tm);
370 *year = (ulint) cal_tm.wYear;
371 *month = (ulint) cal_tm.wMonth;
372 *day = (ulint) cal_tm.wDay;
374 struct tm* cal_tm_ptr;
377 #ifdef HAVE_LOCALTIME_R
380 localtime_r(&tm, &cal_tm);
381 cal_tm_ptr = &cal_tm;
384 cal_tm_ptr = localtime(&tm);
386 *year = (ulint) cal_tm_ptr->tm_year + 1900;
387 *month = (ulint) cal_tm_ptr->tm_mon + 1;
388 *day = (ulint) cal_tm_ptr->tm_mday;
393 #ifndef UNIV_HOTBACKUP
408 for (i = 0; i < delay * 50; i++) {
434 UNIV_MEM_ASSERT_RW(buf, len);
436 fprintf(file,
" len %lu; hex ", len);
438 for (data = (
const byte*) buf, i = 0; i < len; i++) {
439 fprintf(file,
"%02lx", (ulong)*data++);
442 fputs(
"; asc ", file);
444 data = (
const byte*) buf;
446 for (i = 0; i < len; i++) {
447 int c = (int) *data++;
448 putc(isprint(c) ? c :
' ', file);
516 #ifndef UNIV_HOTBACKUP
553 char buf[3 * NAME_LEN];
561 fwrite(buf, 1, bufend - buf, f);
579 ulint formatted_size)
582 switch (formatted_size) {
593 name, strlen(name), NULL, is_table);
597 if ((ulint) (end - formatted) == formatted_size) {
601 ut_a((ulint) (end - formatted) < formatted_size);
617 long len = ftell(src);
622 size_t maxs = len < (long)
sizeof buf
625 size_t size = fread(buf, 1, maxs, src);
626 fwrite(buf, 1, size, dest);
653 _vsnprintf(str, size, fmt, ap);
654 str[size - 1] =
'\0';
678 res = _vscprintf(fmt, ap1);
682 _vsnprintf(str, size, fmt, ap2);
684 if ((
size_t) res >= size) {
685 str[size - 1] =
'\0';
710 return(
"Success, record lock created");
712 return(
"Generic error");
714 return(
"Read only transaction");
716 return(
"Operation interrupted");
717 case DB_OUT_OF_MEMORY:
718 return(
"Cannot allocate memory");
719 case DB_OUT_OF_FILE_SPACE:
720 return(
"Out of disk space");
727 case DB_DUPLICATE_KEY:
728 return(
"Duplicate key");
729 case DB_QUE_THR_SUSPENDED:
730 return(
"The queue thread has been suspended");
732 return(
"Required history data has been deleted");
733 case DB_CLUSTER_NOT_FOUND:
734 return(
"Cluster not found");
735 case DB_TABLE_NOT_FOUND:
736 return(
"Table not found");
738 return(
"More file space needed");
739 case DB_TABLE_IS_BEING_USED:
740 return(
"Table is being used");
742 return(
"Record too big");
744 return(
"Index columns size too big");
746 return(
"Lock wait timeout");
748 return(
"Referenced key value not found");
750 return(
"Row is referenced");
752 return(
"Cannot add constraint");
754 return(
"Data structure corruption");
756 return(
"Cannot drop constraint");
758 return(
"No such savepoint");
760 return(
"Tablespace already exists");
762 return(
"Tablespace deleted or being deleted");
763 case DB_TABLESPACE_NOT_FOUND:
764 return(
"Tablespace not found");
766 return(
"Lock structs have exhausted the buffer pool");
768 return(
"Foreign key activated with duplicate keys");
770 return(
"Foreign key cascade delete/update exceeds max depth");
772 return(
"Too many concurrent transactions");
774 return(
"Unsupported");
776 return(
"NULL value encountered in NOT NULL column");
778 return(
"Persistent statistics do not exist");
780 return(
"Failed, retry may succeed");
786 return(
"Failed, retry will not succeed");
787 case DB_ZIP_OVERFLOW:
788 return(
"Zip overflow");
789 case DB_RECORD_NOT_FOUND:
790 return(
"Record not found");
792 return(
"No index on referencing keys in referencing table");
794 return(
"No index on referenced keys in referenced table");
795 case DB_FTS_INVALID_DOCID:
796 return(
"FTS Doc ID cannot be zero");
798 return(
"Index corrupted");
800 return(
"Undo record too big");
801 case DB_END_OF_INDEX:
802 return(
"End of index");
805 case DB_TABLE_IN_FK_CHECK:
806 return(
"Table is being used in foreign key check");
808 return(
"data mismatch");
810 return(
"schema not locked");
814 return(
"Log size exceeded during online index creation");
816 return(
"Table dictionary has changed");
818 return(
"Identifier name is too long");
820 return(
"FTS query exceeds result cache limit");
832 return(
"Unknown error");