• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Binary primary keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binary primary keys


  • Subject: Re: Binary primary keys
  • From: Jeff Dunnett <email@hidden>
  • Date: Tue, 1 Dec 2009 10:41:28 -0500



------------------------------

Message: 7
Date: Thu, 26 Nov 2009 18:32:52 +0100
From: Anjo Krank <email@hidden>
Subject: Re: Binary primary keys
To: WebObjects-Dev Apple <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=us-ascii

Am 26.11.2009 um 18:26 schrieb Lachlan Deck:

String hexString = new String(nsdata.bytes(), "UTF-8");

This won't work. There are a lot of invalid UTF-8 combinations, so you will get exceptions - if your DB accepts the syntax in the first place. Use bind variables. And why are you using SQL and not a simple fetch spec?

Cheers, Anjo


Anjo,

Well the idea is to select a single primary key and then yes it to quickly delete a large number of records from a table.  

Using SQL query like this: 

DELETE FROM "cms"."ms_contestant" WHERE contest_id = (SELECT contest_id FROM "cms"."ms_contestant" WHERE contest_event = '2009 Contest');

Rather then WebObjects code like this:

NSArray contestants = contest.contestants();

for(int i = 0; i < contestants.count(); i++){
Contestant contesant = (Contestant)contestants.objectAtIndex(i);

ec.deleteObject(contestant);

}

ec.saveChanges();

From what I can tell the raw SQL is fast.  Unless my ignorance is hurting me in this situation.

Regards,
Jeff

 _______________________________________________
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

  • Follow-Ups:
    • Re: Binary primary keys
      • From: David Avendasora <email@hidden>
  • Prev by Date: Re: [OT] Leaving WO
  • Next by Date: Re: Binary primary keys
  • Previous by thread: Re: [OT] Leaving WO
  • Next by thread: Re: Binary primary keys
  • Index(es):
    • Date
    • Thread