AW: Delete a table content
AW: Delete a table content
- Subject: AW: Delete a table content
- From: Helge Staedtler <email@hidden>
- Date: Mon, 05 Sep 2005 15:53:50 +0200
Title: AW: Delete a table content
Sorry, but what the heck is SQL?
You will just need this kind of machine-oriented-language if you use something like e.g.
http://wocode.com/cgi-bin/WebObjects/WOCode.woa/wa/ShareCodeItem?itemId=424
I would prefer to not write even ONE SQL-statement by hand as long as I can avoid it because I know that I make errors. EOF produces SQL using its own rules usually errorfree. If the performance is not enough for you, you should perhaps try to explain WHERE exactly you miss performance. I think deleting a Table is something that is clearly not the typical usage pattern of a database for a web-app. deleting rows, okay, but tables?
if your deletion of the table uses up too much time you could think about taking a WOLongResponse page for the time waiting until the stuff has finished. ;-)
just my 2 cents,
helge
Am 01.09.2005 14:53 Uhr schrieb "Fabrice Pipart" unter <email@hidden>:
Finlly I used "delete from TABLE_NAME".
And wow it IS 100 times faster than using EOs !
Great !
Thanks for the tip !
And this gave me an idea, why not do raw SQL updates when I have to update one field on a large data set?
And in fact it works, 100 times faster again.
But is there any drawback doing it this way?
Will the EOs I fetch after that, in sync with the database?
It seems that it is not the case :-(
Fabrice
On Aug 30, 2005, at 6:10 PM, Nathan Walker wrote:
I believe this is what you're looking for, Use this:
sqlSelect = "truncate table yourtablename"; // NOTE: I use TRUNCATE here to delete all rows AND RESET Auto-Increment Fields
EOUtilities.rawRowsForSQL(YourEC,"YourEOModelName",sqlSelect);
You could also use "delete table..." there too, but that does not reset any auto-increment fields if you have any...
That method is lightning FAST !
On Aug 30, 2005, at 8:06 AM, Fabrice Pipart wrote:
Hi list !
I have a question that seems rather simple :
is there a way to delete all the rows of a table without fetching all of them?
I have a table that is rather large and to avoid wasting a lot of memory I did not find a better way than using a fetchLimit and deleting each object until the table is empty...
Any idea?
Regards
Fabrice Pipart
www.icconsulting.mc
International Corporate Consulting
25, Boulevard de Belgique
MC - 98000 Monaco
T. +377 97982104 (direct)
F. +377 97708807
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
www.icconsulting.mc
International Corporate Consulting
25, Boulevard de Belgique
MC - 98000 Monaco
T. +377 97982104 (direct)
F. +377 97708807
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Helge Städtler
- Expect and Respect.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden