Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread LongInt Exception
Fri, Jul 31 2015 1:47 PMPermanent Link

Shedden

Hi All,

I have a data table with a longInt for a key. Dbsys handles it just fine, but I'm having difficulty with a query.

It seems to be this function in the engine (dbIsamlb.pas) that doesn't like me:

function IsAnInteger(const Value: AnsiString): Boolean;
begin
  Result:=True;
  try
     StrToInteger(Value);
  except
     Result:=False;
  end;
end;

I'm using Rad Studio XE in C++ and did kludge my code as such:

void TfrmMain::execSql(String q)
{
__int64 i=2400000000;
i=StrToInteger("2400000000");

copyToClipboard(q);
qry->SQL->Clear();
qry->SQL->Add(q);
qry->ExecSQL();
qry->Close();
}

The function fails on "StrToInteger". The initial longint assignment seems to be friendly.

The problematic query string would be:

select patnum into "C:\TCAP18\Private\_timeSum" from patient p where
(p.recordDate in ('2015_06','2015_05','2014_12','2014_06','2013_12','2013_06','2012_12','2012_06','2011_12','2011_06','2010_12','2010_06')) and
((p.patnum between 2400000000 and 2499999999) or (p.patnum between 1600000000 and 1699999999) or (p.patnum between 1700000000 and 1799999999))

I would appreciate any help, and thanks in advance.

Best Regards,
Jim Shedden
Sat, Aug 1 2015 6:40 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

James,

<< It seems to be this function in the engine (dbIsamlb.pas) that doesn't like me: >>

Are you running in the IDE under the debugger ?  If so, then just ignore the exception and continue execution.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Aug 1 2015 11:16 AMPermanent Link

Shedden

Tim Young [Elevate Software] wrote:

James,

<< It seems to be this function in the engine (dbIsamlb.pas) that doesn't like me: >>

Are you running in the IDE under the debugger ?  If so, then just ignore the exception and continue execution.

Tim Young
Elevate Software
www.elevatesoft.com

Hi Tim,

Perfecto!

Yes, I was running in the debugger. It's nice that the IDE allows us to put advanced breakpoints around a function call and tell it to ignore exceptions before that point and restore exceptions after.

I don't know if this has any merit, but it works:

bool isInt=false;
__int64 i;
int j;

isInt=TryStrToInt("2400000000",j) || TryStrToInt64("2400000000",i);

I'm more than happy not to touch the code that you have written so well! I have a lot of folks happily running your product. Your support is fantastic as well.You've saved me hours and it's nice outside.I can hear the grill calling now.

Regards,
Jim Shedden
Image