• 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: Core Data with ODBC databases?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data with ODBC databases?


  • Subject: Re: Core Data with ODBC databases?
  • From: Noah Desch <email@hidden>
  • Date: Fri, 18 Oct 2013 12:59:49 -0400

I'm not sure why you need access to the NSSaveChangesRequest "transactions" at the application layer?

In your optimistic locking example, your NSIncrementalStore gets a save request at step 5. It tries to commit the changes to the server, but the server comes back and says "transaction back out". Your incremental store constructs an NSError describing the problem and returns nil from -executeRequest:withContext:error:. Your controller code that called -save sees the error, recognizes what it means, and starts the user back at step 1 (presumably by calling refreshObject:mergeChanges: on all the edited objects).

Maybe I'm being naive but this seems to complete your scenario. Where did I go wrong?

-Noah



On Oct 18, 2013, at 9:12 AM, Mikael Hakman <email@hidden> wrote:

> Both of you, Jens and Chris, are right. Core Data uses transactions internally for each NSFetchRequest and NSSaveChanges request. However, the transactions are not available in the user application. Let's consider the above mentioned banking application - a clerk making a withdrawal or deposit on an account. If your database uses optimistic transaction control then it will do the following:
>
> 1. Start a transaction.
>
> 2. Fetch account balance from the database.
>
> 3. Display balance to the clerk.
>
> 4. Let the clerk add or subtract an amount.
>
> 5. Update balance in database.
>
> 6. Commit transaction.
>
> 7. Check transaction error code.
>
> 8. if error code is "Transaction back out" or alike then the application should:
>
> 9. Inform the clerk.
>
> 10. Start all over again from 1 above.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Core Data with ODBC databases?
      • From: Mikael Hakman <email@hidden>
References: 
 >Re: Core Data with ODBC databases? (From: Flavio Donadio <email@hidden>)
 >Re: Core Data with ODBC databases? (From: Jens Alfke <email@hidden>)
 >Re: Core Data with ODBC databases? (From: Alex Kac <email@hidden>)
 >Re: Core Data with ODBC databases? (From: Kyle Sluder <email@hidden>)
 >Re: Core Data with ODBC databases? (From: Brad Gibbs <email@hidden>)
 >Re: Core Data with ODBC databases? (From: Andrew Satori <email@hidden>)
 >Re: Core Data with ODBC databases? (From: Brad Gibbs <email@hidden>)
 >Re: Core Data with ODBC databases? (From: Chris Hanson <email@hidden>)
 >Re: Core Data with ODBC databases? (From: Mikael Hakman <email@hidden>)

  • Prev by Date: Re: C functions
  • Next by Date: Re: C functions
  • Previous by thread: Re: Core Data with ODBC databases?
  • Next by thread: Re: Core Data with ODBC databases?
  • Index(es):
    • Date
    • Thread