• 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: Delete statement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delete statement


  • Subject: Re: Delete statement
  • From: Chuck Hill <email@hidden>
  • Date: Wed, 4 Apr 2007 14:26:30 -0700

On Apr 4, 2007, at 2:19 PM, Frank Stock wrote:

I did try this with the locking. But perhaps I am doing something wrong, but it doesn't seem to do anything.
My SQL-staments are just like before. Shouldn't I see a 'select for update'?

Select for update usually indicates bad value types in the model or incorrect jdcb2info in the connection dictionary.


Next thing to check is if you are violating any of the EOF commandments or if your are not locking someplace else in your app.

Chuck



Op 4-apr-07, om 21:10 heeft email@hidden het volgende geschreven:


Send Webobjects-dev mailing list submissions to
	email@hidden

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.apple.com/mailman/listinfo/webobjects-dev
or, via email, send a message with subject or body 'help' to
	email@hidden

You can reach the person managing the list at
	email@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Webobjects-dev digest..."


Today's Topics:

   1. Re: Delete statement (Ken Anderson)
   2. Re: Delete statement (Chuck Hill)


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


Message: 1
Date: Wed, 4 Apr 2007 12:56:42 -0400
From: Ken Anderson <email@hidden>
Subject: Re: Delete statement
To: Frank Stock <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset="us-ascii"

Frank,

Upon first glance, your code looks OK, except for the fact that
you're not locking your editing context.  Since you're allocating a
new one, you need to lock it.  I suggest you do this:

ec.lock();
try {
// current code
} finally {
ec.unlock();
}

Since your problem is intermittent, it is likely that this is the
problem.

Ken


On Apr 4, 2007, at 12:45 PM, Frank Stock wrote:

Hi,

I use SOAP-calls to WO and I get strange effects in the following
routine:

public void deleteWebtextValue (String webtext, String language) {

		EOEditingContext ec = new EOEditingContext();
		EOQualifier aQual;
		NSMutableArray qbind;
		EOFetchSpecification fs;

		LanguageWebtext lwObject;
		qbind=new NSMutableArray();
		qbind.addObject(webtext);
		qbind.addObject(language);
		aQual = EOQualifier.qualifierWithQualifierFormat
("(webtext.webtext=%@) and (language.language=%@)",qbind);
		fs = new EOFetchSpecification("LanguageWebtext",aQual,null);
		NSArray arLanguageWebtext = ec.objectsWithFetchSpecification(fs);
		// should only be 1
		for (int i=0;i< arLanguageWebtext.count();i++) {
			lwObject = (LanguageWebtext)arLanguageWebtext.objectAtIndex(i);
			ec.deleteObject(lwObject);
		}
		ec.saveChanges();

	}

Most of the time this results in a delete-statement:
delete from languagewebtext where languagewebtext_id=8788;

but sometimes I get a (strange) update-statement:

update languagewebtext set language_id = NULL, webtext_id = NULL
where languagewebtext_id=8898;
Both can't be NULL;
This results in currupting the database!

I don't understand that!


Thanks for helping, Frank Stock _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: 40anderhome.com

This email sent to email@hidden

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/pipermail/webobjects-dev/attachments/ 20070404/5dee1d9e/attachment.html


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

Message: 2
Date: Wed, 4 Apr 2007 10:09:29 -0700
From: Chuck Hill <email@hidden>
Subject: Re: Delete statement
To: WebObjects Dev Apple <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

I can almost guarantee this is the problem.  :-)

Chuck


On Apr 4, 2007, at 9:56 AM, Ken Anderson wrote:

Frank,

Upon first glance, your code looks OK, except for the fact that
you're not locking your editing context.  Since you're allocating a
new one, you need to lock it.  I suggest you do this:

ec.lock();
try {
// current code
} finally {
ec.unlock();
}

Since your problem is intermittent, it is likely that this is the
problem.

Ken


On Apr 4, 2007, at 12:45 PM, Frank Stock wrote:

Hi,

I use SOAP-calls to WO and I get strange effects in the following
routine:

public void deleteWebtextValue (String webtext, String language) {

		EOEditingContext ec = new EOEditingContext();
		EOQualifier aQual;
		NSMutableArray qbind;
		EOFetchSpecification fs;

		LanguageWebtext lwObject;
		qbind=new NSMutableArray();
		qbind.addObject(webtext);
		qbind.addObject(language);
		aQual = EOQualifier.qualifierWithQualifierFormat
("(webtext.webtext=%@) and (language.language=%@)",qbind);
		fs = new EOFetchSpecification("LanguageWebtext",aQual,null);
		NSArray arLanguageWebtext = ec.objectsWithFetchSpecification(fs);
		// should only be 1
		for (int i=0;i< arLanguageWebtext.count();i++) {
			lwObject = (LanguageWebtext)arLanguageWebtext.objectAtIndex(i);
			ec.deleteObject(lwObject);
		}
		ec.saveChanges();

	}

Most of the time this results in a delete-statement:
delete from languagewebtext where languagewebtext_id=8788;

but sometimes I get a (strange) update-statement:

update languagewebtext set language_id = NULL, webtext_id = NULL
where languagewebtext_id=8898;
Both can't be NULL;
This results in currupting the database!

I don't understand that!


Thanks for helping, Frank Stock _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: 40anderhome.com

This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: 40global-village.net

This email sent to email@hidden

--

Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects







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

_______________________________________________
Webobjects-dev mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/webobjects-dev

End of Webobjects-dev Digest, Vol 4, Issue 212
**********************************************


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden


--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
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


References: 
 >Re: Delete statement (From: Frank Stock <email@hidden>)

  • Prev by Date: Re: WOForm Question
  • Next by Date: Re: WOForm Question
  • Previous by thread: Re: Delete statement
  • Next by thread: How to Retrieve Session User?
  • Index(es):
    • Date
    • Thread