transactions

rails object in rescue after transaction failure is saved

i have a transaction to ensure two models get saved at the same time. begin Recipe.transaction do @recipe.save! if @dish @dish.save! end end rescue #save failed flash[:notice] = "recipe.saved = #{@recipe.new_record?}" render 'form' else #save worked flash[:notice] = 'Recipe added.' redirect_to(@recip...

What is the mechanism for Transaction Rollback in sql server?

What is the mechanism for Transaction Rollback in sql server? ...

How to download paypal transactions using some API

Is it possible to download my paypal transactions using some kind of API? Scenario: I own a paypal account and don't want to download the files using the website export. Instead I want to download and process the transcations of my paypal account automatically. ...

TransactionScope problem with Message queues

I'm facing the next problem. I have a piece of code that goes like this: DoSomething(){ using (TransactionScope scope = new TransactionScope()) { InsertSomething(); InsertSomethingElse(); InsertYetAnotherThing(); ProcessDataRelatedWithThePreviousInserts(); scope.Complete() } } In ProcessDataRela...

SQL Transaction Oddity with concurrent processes from C#

We have a C# system throwing up an oddity we can't get to the bottom of with SQL (SQL2k5). The situation is that we have two seperate processes running simultaneously looking at the same table, both running inside their own transaction in two different serviced COM+ components on two different clusters. Both are talking to Order and Ord...

Optimum size of transaction in Postgres?

I'm running a process that does a lot of updates (> 100,000) to a table. I have the choice between putting all the updates in a single transaction or committing transactions every 1000 or so. Ignore for the moment the case where a transaction fails and is aborted. I'm interested in the best size of transaction for memory and speed effi...

Renaming Indexes and asking about the new name in Sys.Indexes in same transaction.

Hey guys, I am trying to work on the upgrade component in our program. This requires changing an index's name EXEC sp_rename N'Sig_Summary1Index.IX_Sig_Summary1Index_StartTime', N'Sig_Summary3Index.IX_Sig_Summary1Index1_StartTime', N'INDEX'; (we need to remain compatible with SQL SERVER 2005) and then check if it exists in the same...

Creating an audit table in SQL Server not affected by Transaction rollbacks

Hello All, I'm new to SQL. I have a large number of stored procedures in my production database. I planned to write an audit table that would be used by these stored procedures to keep track of changes ( these stored procedures would write to this audit table ). But the issue is that when a transaction rolls back, the rows inserted into...

delete inner a transaction?

My test Code UserAccount.transaction do MyModel.delete(1) a = 1/ 0 end I find the delete will not rollback. how to fix this problem? is there anyway to disable the transaction in delete method? ...

Hibernate: Transaction not successfully started (Threaded webapp) Problem!!

Hello Everyone, I am having this serious problem in a web-app that is using a thread to listen on a port for packets and process those packets. Processing of a packet involves database transactions, so basically it is like : Thread: run () { try { ... fireMessageEvent(data); ... } catch (Exception e) { } } fireMe...

Sip Error - Response does not belong to this transaction.

I was wondering has anyone come across thos error in SIP before? WARN/System.err(4623): javax.sip.SipException: Response does not belong to this transaction. I get it after I get an invite, I then send back 100 trying followed by 180 ringing. Then the user can either press Reject or accept on the screen. If they press reject I s...

Save new or update with LinqToSql, transactions?

I have a table with hit statistics for some items in another table. This table is defined like this ID (Primary key) ItemId (Foreign key) Date Hits Giving me have a record pr. item pr day. The database is used in a multithreaded environment, so two users might make the first hit at the same time causing two records to be created, w...

What happens when LINQ updates fail?

Here's the scenario: Process 1 (P1) - reads in various flat files one consequence of which is deleting or adding photos URLs to a database table to indicate that these need to be downloaded Process 2 (P2) - Looks up the photo URLs that need to be downloaded, actually performs the download, then marks the record as downloaded P1 and P...

If transactions over REST are unachievable, how can REST ever be really useful?

When looking into REST one of the first things probably anybody will notice is there isn't any transaction semantics defined, some say this is implicitly against what REST is, whilst others say any attempt to do so would result in 'tainting' the REST systems. But lets say for arguments sake that REST did become a popular 'api' choice, a...

Two quick question on transaction behaviour

I have code that looks like this: function foobar(array& $objects, $con = null) { if (is_null($con)) $con = DbSingleton::getConnectio(); $con->beginTransaction(); // <- question 1 try { foreach($objects as $object) { // allocate memory for new object $new_obj = new MyShiningNewObject(); ...

Oracle DDL in autonomous transaction

I need to execute a bunch of (up to ~1000000) sql statements on an Oracle database. These statements should result in a referentially consistent state at the end, and all the statements should be rolled back if an error occurs. These statements do not come in a referential order. So if foreign key constraints are enabled, one of the stat...

insert several row in order to satisfy a constraint

hello, I have two table: deck(id) and card(deck,color,value) deck have those constraints: CHECK (fifty_two_cards_deck(id)) PRIMARY KEY (id) CREATE FUNCTION fifty_two_cards_deck(deck integer) RETURNS boolean LANGUAGE sql STABLE STRICT AS $_$ SELECT COUNT(*)=52 FROM card WHERE deck=$1 $_$; and card have those constraints: ...

Google app engine transactional inserts in java

I have tried to insert/update multiple entites on a single transaction but no avail. It always throws IllegalArgumentException. I wanted to do something like this. Transaction tx = pm.currentTransaction(); tx.begin(); for(int i=0;i<10;i++) { SampleEntity entity = new SampleEntity(i); pm.makePersistent(entity); } tx.commit();...

@Transactional not working with spring and hibernate

I am trying to do spring transactions with @Transactional without any success. Excerpt from my applicationContext.xml: <context:annotation-config /> <context:component-scan base-package="hibex" /> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" p:driverClassName="org.postgresql.Driver"...

Get "next" row from SQL Server database and flag it in single transaction

I have a SQL Server table that I'm using as a queue, and it's being processed by a multi-threaded (and soon to be multi-server) application. I'd like a way for a process to claim the next row from the queue, flagging it as "in-process", without the possibility that multiple threads (or multiple servers) will claim the same row at the sam...