~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/ut/ut0ut.c

  • Committer: Brian Aker
  • Date: 2010-02-14 01:56:51 UTC
  • mto: (1273.16.5 fix_is)
  • mto: This revision was merged to the branch mainline in revision 1300.
  • Revision ID: brian@gaz-20100214015651-ror9j0xu7dccz0ct
Two fixes for "make dist"

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
4
4
Copyright (c) 2009, Sun Microsystems, Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
18
18
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19
19
 
20
20
You should have received a copy of the GNU General Public License along with
21
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
22
 
St, Fifth Floor, Boston, MA 02110-1301 USA
 
21
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
22
Place, Suite 330, Boston, MA 02111-1307 USA
23
23
 
24
24
*****************************************************************************/
25
25
 
148
148
        return(time(NULL));
149
149
}
150
150
 
151
 
#ifndef UNIV_HOTBACKUP
152
151
/**********************************************************//**
153
152
Returns system time.
154
153
Upon successful completion, the value 0 is returned; otherwise the
217
216
}
218
217
 
219
218
/**********************************************************//**
220
 
Returns the number of milliseconds since some epoch.  The
221
 
value may wrap around.  It should only be used for heuristic
222
 
purposes.
223
 
@return ms since epoch */
224
 
UNIV_INTERN
225
 
ulint
226
 
ut_time_ms(void)
227
 
/*============*/
228
 
{
229
 
        struct timeval  tv;
230
 
 
231
 
        ut_gettimeofday(&tv, NULL);
232
 
 
233
 
        return((ulint) tv.tv_sec * 1000 + tv.tv_usec / 1000);
234
 
}
235
 
#endif /* !UNIV_HOTBACKUP */
236
 
 
237
 
/**********************************************************//**
238
219
Returns the difference of two times in seconds.
239
220
@return time2 - time1 expressed in seconds */
240
221
UNIV_INTERN
641
622
        return(res);
642
623
}
643
624
#endif /* __WIN__ */
644
 
 
645
 
/*************************************************************//**
646
 
Convert an error number to a human readable text message. The
647
 
returned string is static and should not be freed or modified.
648
 
@return string, describing the error */
649
 
UNIV_INTERN
650
 
const char*
651
 
ut_strerr(
652
 
/*======*/
653
 
        enum db_err     num)    /*!< in: error number */
654
 
{
655
 
        switch (num) {
656
 
        case DB_SUCCESS:
657
 
                return("Success");
658
 
        case DB_SUCCESS_LOCKED_REC:
659
 
                return("Success, record lock created");
660
 
        case DB_ERROR:
661
 
                return("Generic error");
662
 
        case DB_INTERRUPTED:
663
 
                return("Operation interrupted");
664
 
        case DB_OUT_OF_MEMORY:
665
 
                return("Cannot allocate memory");
666
 
        case DB_OUT_OF_FILE_SPACE:
667
 
                return("Out of disk space");
668
 
        case DB_LOCK_WAIT:
669
 
                return("Lock wait");
670
 
        case DB_DEADLOCK:
671
 
                return("Deadlock");
672
 
        case DB_ROLLBACK:
673
 
                return("Rollback");
674
 
        case DB_DUPLICATE_KEY:
675
 
                return("Duplicate key");
676
 
        case DB_QUE_THR_SUSPENDED:
677
 
                return("The queue thread has been suspended");
678
 
        case DB_MISSING_HISTORY:
679
 
                return("Required history data has been deleted");
680
 
        case DB_CLUSTER_NOT_FOUND:
681
 
                return("Cluster not found");
682
 
        case DB_TABLE_NOT_FOUND:
683
 
                return("Table not found");
684
 
        case DB_MUST_GET_MORE_FILE_SPACE:
685
 
                return("More file space needed");
686
 
        case DB_TABLE_IS_BEING_USED:
687
 
                return("Table is being used");
688
 
        case DB_TOO_BIG_RECORD:
689
 
                return("Record too big");
690
 
        case DB_LOCK_WAIT_TIMEOUT:
691
 
                return("Lock wait timeout");
692
 
        case DB_NO_REFERENCED_ROW:
693
 
                return("Referenced key value not found");
694
 
        case DB_ROW_IS_REFERENCED:
695
 
                return("Row is referenced");
696
 
        case DB_CANNOT_ADD_CONSTRAINT:
697
 
                return("Cannot add constraint");
698
 
        case DB_CORRUPTION:
699
 
                return("Data structure corruption");
700
 
        case DB_COL_APPEARS_TWICE_IN_INDEX:
701
 
                return("Column appears twice in index");
702
 
        case DB_CANNOT_DROP_CONSTRAINT:
703
 
                return("Cannot drop constraint");
704
 
        case DB_NO_SAVEPOINT:
705
 
                return("No such savepoint");
706
 
        case DB_TABLESPACE_ALREADY_EXISTS:
707
 
                return("Tablespace already exists");
708
 
        case DB_TABLESPACE_DELETED:
709
 
                return("No such tablespace");
710
 
        case DB_LOCK_TABLE_FULL:
711
 
                return("Lock structs have exhausted the buffer pool");
712
 
        case DB_FOREIGN_DUPLICATE_KEY:
713
 
                return("Foreign key activated with duplicate keys");
714
 
        case DB_FOREIGN_EXCEED_MAX_CASCADE:
715
 
                return("Foreign key cascade delete/update exceeds max depth");
716
 
        case DB_TOO_MANY_CONCURRENT_TRXS:
717
 
                return("Too many concurrent transactions");
718
 
        case DB_UNSUPPORTED:
719
 
                return("Unsupported");
720
 
        case DB_PRIMARY_KEY_IS_NULL:
721
 
                return("Primary key is NULL");
722
 
        case DB_STATS_DO_NOT_EXIST:
723
 
                return("Persistent statistics do not exist");
724
 
        case DB_FAIL:
725
 
                return("Failed, retry may succeed");
726
 
        case DB_OVERFLOW:
727
 
                return("Overflow");
728
 
        case DB_UNDERFLOW:
729
 
                return("Underflow");
730
 
        case DB_STRONG_FAIL:
731
 
                return("Failed, retry will not succeed");
732
 
        case DB_ZIP_OVERFLOW:
733
 
                return("Zip overflow");
734
 
        case DB_RECORD_NOT_FOUND:
735
 
                return("Record not found");
736
 
        case DB_END_OF_INDEX:
737
 
                return("End of index");
738
 
        /* do not add default: in order to produce a warning if new code
739
 
        is added to the enum but not added here */
740
 
        }
741
 
 
742
 
        /* we abort here because if unknown error code is given, this could
743
 
        mean that memory corruption has happened and someone's error-code
744
 
        variable has been overwritten with bogus data */
745
 
        ut_error;
746
 
 
747
 
        /* NOT REACHED */
748
 
        return("Unknown error");
749
 
}