1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 ***************************************************************************/
18 int DebugDM_Alloc
= 0;
19 int DebugDM_VarAlloc
= 0;
21 int DebugDM_Transaction
= 0;
22 int DebugDM_UndoLog
= 0;
23 int DebugDM_RedoLog
= 0;
24 int DebugDM_HashIndex
= 0;
25 int DebugDM_SystemDatabase
= 0;
26 int DebugDM_Database
= 0;
27 int DebugDM_Table
= 0;
28 int DebugDM_TableIterator
= 0;
31 int printError1(DbRetVal val
, char* fname
, int lno
, char *format
, ...)
36 sprintf(mesgBuf
, "%d:%lu:%s:%d:",
37 os::getpid(), os::getthrid(), fname
, lno
);
38 os::write(1, mesgBuf
, strlen(mesgBuf
));
42 int err
= ::vsnprintf(mesgBuf
, sizeof(mesgBuf
), format
,ap
);
46 os::write(1, mesgBuf
, strlen(mesgBuf
));
48 os::write(1, mesgBuf
, strlen(mesgBuf
));
55 int printDebug1(int module
, char *fname
, int lno
, char *format
, ...)
58 case DM_Alloc
: { if (!DebugDM_Alloc
) return 1; break; }
59 case DM_VarAlloc
: { if (!DebugDM_VarAlloc
) return 1; break; }
60 case DM_Lock
: { if (!DebugDM_Lock
) return 1; break; }
61 case DM_Transaction
: { if (!DebugDM_Transaction
) return 1; break; }
62 case DM_UndoLog
: { if (!DebugDM_UndoLog
) return 1; break; }
63 case DM_RedoLog
: { if (!DebugDM_RedoLog
) return 1; break; }
64 case DM_HashIndex
: { if (!DebugDM_HashIndex
) return 1; break; }
65 case DM_SystemDatabase
: { if (!DebugDM_SystemDatabase
) return 1; break; }
66 case DM_Database
: { if (!DebugDM_Database
) return 1; break; }
67 case DM_Table
: { if (!DebugDM_Table
) return 1; break; }
68 case DM_Iterator
: { if (!DebugDM_TableIterator
) return 1; break; }
74 sprintf(mesgBuf
, "D:%s:%d:%lu:%s:%d:", moduleNames
[module
],
75 os::getpid(), os::getthrid(), fname
, lno
);
76 os::write(1, mesgBuf
, strlen(mesgBuf
));
80 int err
= ::vsnprintf(mesgBuf
, sizeof(mesgBuf
), format
,ap
);
84 os::write(1, mesgBuf
, strlen(mesgBuf
));
86 os::write(1, mesgBuf
, strlen(mesgBuf
));