Home » U++ Library support » U++ SQL » Overflow error in bool Sql::Fetch()
Overflow error in bool Sql::Fetch() [message #14083] |
Sat, 09 February 2008 15:01 |
zsolt
Messages: 698 Registered: December 2005 Location: Budapest, Hungary
|
Contributor |
|
|
SQL apps, running on a PC booted weeks ago start dumping a lot of SQL logfiles.
The problem is, that session.traceslow is a very big number and result of this GetTickCount() arithmetic overflows. It is not a good idea to compare TickCount values.
The current code:
bool Sql::Fetch() {
SqlSession& session = GetSession();
session.PassStatus(ActivityStatus::FETCHING);
int t0 = GetTickCount();
bool b = cn->Fetch();
int t = GetTickCount();
if(!b) {
session.GetStatus().Time(t - cn->starttime);
session.PassStatus(ActivityStatus::END_FETCHING);
}
if(t - session.traceslow > cn->starttime)
BugLog() << t - cn->starttime << " ms: " << cn->statement << '\n';
else
if(t - t0 > session.traceslow)
BugLog() << t - t0 << " ms further fetch: " << cn->statement << '\n';
cn->starttime = INT_MAX;
return b;
}
should be patched:
bool Sql::Fetch() {
SqlSession& session = GetSession();
session.PassStatus(ActivityStatus::FETCHING);
int t0 = GetTickCount();
bool b = cn->Fetch();
int t = GetTickCount();
if(!b) {
session.GetStatus().Time(t - cn->starttime);
session.PassStatus(ActivityStatus::END_FETCHING);
}
if(t - session.traceslow - cn->starttime > 0)
BugLog() << t - cn->starttime << " ms: " << cn->statement << '\n';
else
if(t - t0 - session.traceslow > 0)
BugLog() << t - t0 << " ms further fetch: " << cn->statement << '\n';
cn->starttime = INT_MAX;
return b;
}
|
|
|
|
Goto Forum:
Current Time: Fri Jun 07 22:23:24 CEST 2024
Total time taken to generate the page: 0.02387 seconds
|