Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Trying to empty a table.
Wed, May 30 2018 3:45 AMPermanent Link

Ian Branch

Avatar

Hi Team,
I am trying to empty a table prior to doing a data import.
As TEDBTable.EmptyTable isn't available I thought I would use a TEDBQuery with the SQL of "Delete from rbItem"
So with new form, I added An Engine, Session, Database & Query.
Connected them all to the right place.
Made the SQL "select * from rbItem" just to make sure all was good.  Yep.
Changed the SQL to "delete from rbItem" and I get an error..
"Error creating table handle."
Thoughts/Suggestions (polite) on what is happening and how to fix it?

Regards & TIA,
Ian
Wed, May 30 2018 5:27 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


First - use the sql command EMPTY TABLE tablename rather than DELETE FROM Tablename - its lots faster

Second bit - have a look at the extensions newsgroup at my subclassed table component - it has EmptyTable bolted on

Third - your "Error creating table handle." problem all I can think of is that something somewhere has one or more of the table files locked in someway - have you opened it exclusively somewhere or has the dreaded AV grabbed it?

From your post this is in your code - have you tried the SQL bit in EDBManager? Its just a Delphi program so if it works there its your fault (somehow). Was that polite enough?

What's the version of ElevateDB just in case it has any bearing?

Roy Lambert
Wed, May 30 2018 6:14 AMPermanent Link

Ian Branch

Avatar

>>First - use the sql command EMPTY TABLE tablename rather than DELETE FROM Tablename - its lots faster
IB - Like it.

>>  Second bit - have a look at the extensions newsgroup at my subclassed table component - it has
EmptyTable bolted on
IB - Will do.

>>  Third - your "Error creating table handle." problem all I can think of is that something somewhere has one or more of the table files locked in someway - have you opened it exclusively somewhere or has the dreaded AV grabbed it?
IB - Got the same error in my bare bones app as for 'delete from' Frown Turend AV off, no difference.

>>  From your post this is in your code - have you tried the SQL bit in EDBManager? Its just a Delphi program so if it works there its your fault (somehow).
IB -  Tried the empty table in EDBMgr - worked fine. Smile& Frown Leaves me wondering what is wrong/different in my bare bones app.

>>Was that polite enough?
IB - Absolutely. Smile

>>  What's the version of ElevateDB just in case it has any bearing?
IB - 2.28 downloaded yesterday.

I have attached a .pdf with images of the properties for each of the components on the form.  Additionally there is a button that Opens the Query.  The Query has the sql now of "empty table rbItam"

Regards & tks for your support.
Ian



Attachments: Ians Test App.pdf
Wed, May 30 2018 7:04 AMPermanent Link

Ian Branch

Avatar

Roy Lambert wrote:
>>Second bit - have a look at the extensions newsgroup at my subclassed table component - it has EmptyTable bolted on

IB - Downloaded it and updated/installed.  EmptyTable works perfectly replacing the TEDBQuery on my test app.  Not sure my changes for D10.2.3 & EDB v 2.28 are correct but it works!
Still be good to know why the TEDBQuery doesn't work/causes the error.

Regards,
Ian
Wed, May 30 2018 8:23 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


>IB - Downloaded it and updated/installed. EmptyTable works perfectly replacing the TEDBQuery on my test app. Not sure my changes for D10.2.3 & EDB v 2.28 are correct but it works!

I'm on the latest from Tim but still at D2006 (or more correctly RAD Studio 2006) and unlikely to upgrade. What changes were needed?

>Still be good to know why the TEDBQuery doesn't work/causes the error.

I just did a quick google (its alright no-one was looking) and found

https://www.elevatesoft.com/forums?action=view&category=dbisam&id=dbisam_general&page=8&msg=65256

Roy
Wed, May 30 2018 9:25 AMPermanent Link

Adam Brett

Orixa Systems

Ian

I think what is happening here is that the TEDBQuery Component expects a SELECT statement which generates a dataset.

When I am calling UPDATES and DELETES I usually call them from

MySession.Execute(' SQL Statement ');

This is a useful shortcut. You don't even need a query / table component.
Wed, May 30 2018 5:02 PMPermanent Link

Ian Branch

Avatar

Hi Roy,

>IB - Downloaded it and updated/installed. EmptyTable works perfectly replacing the TEDBQuery on my test app. Not sure my changes for D10.2.3 & EDB v 2.28 are correct but it works!

I'm on the latest from Tim but still at D2006 (or more correctly RAD Studio 2006) and unlikely to upgrade. What changes were needed?

IB -  IIRC -
1.  The parameters for DataEvent have changed, now "DataEvent(Event: TDataEvent; Info: TEDBIntPtr); override;"
2.  TEDBStrings is no more, just Strings.

>Still be good to know why the TEDBQuery doesn't work/causes the error.

I just did a quick google (its alright no-one was looking) and found

https://www.elevatesoft.com/forums?action=view&category=dbisam&id=dbisam_general&page=8&msg=65256
IB - Yes, "ExecSQL". would seem to be the way to go.

Regards,
Ian
Mon, Jun 4 2018 2:57 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ian,

<< Changed the SQL to "delete from rbItem" and I get an error.. >>

Use ExecSQL when you're using SQL that won't return a result set.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Jun 4 2018 5:05 PMPermanent Link

Ian Branch

Avatar

Noted.  Tks.
Image