savepoints

Jdbc check for capability - savepoint release

痞子三分冷 提交于 2020-01-30 05:06:36
问题 I have generic jdbc code that works with all kinds of databases. I have some apis that work with transactions and savepoints. The problem is that some databases require you to release the savepoint manually conn.releaseSavepoint(savepoint1) and some just throw an exeption when you do a manual release (most notably Oracle). How can I check at run-time if the db has automatic savepoint release or if I need to do it manually. And pls, I have some nice apis. I don't want to catch the exception,

Jdbc check for capability - savepoint release

孤人 提交于 2020-01-30 05:03:09
问题 I have generic jdbc code that works with all kinds of databases. I have some apis that work with transactions and savepoints. The problem is that some databases require you to release the savepoint manually conn.releaseSavepoint(savepoint1) and some just throw an exeption when you do a manual release (most notably Oracle). How can I check at run-time if the db has automatic savepoint release or if I need to do it manually. And pls, I have some nice apis. I don't want to catch the exception,

Usage ROLLBACK TO SAVEPOINT with condition

我的未来我决定 提交于 2020-01-24 13:22:24
问题 Is it possible to ROLLBACK TO SAVEPOINT with CASE? My query is BEGIN; SAVEPOINT my_savepoint; INSERT INTO DPoint (uuid) VALUES ('5547f4b7-00b3-4aac-8ceb-c9ca163a0214') ON CONFLICT (uuid) DO NOTHING; WITH ins1 AS (INSERT INTO Point (latitude, longitude, srid) VALUES (37.251667, 14.917222, 4326) RETURNING id), ins2 as (INSERT INTO SPoint (idPt, uuiddpt) VALUES ((SELECT id FROM ins1), '5547f4b7-00b3-4aac-8ceb-c9ca163a0214') RETURNING id), ins3 as (INSERT INTO Distance (idSpt, uuiddpt) VALUES (

Django + MySQL - Admin Site - Add User - OperationalError - SAVEPOINT does not exist

和自甴很熟 提交于 2020-01-02 18:39:20
问题 We're trying to have a custom User model and behaviors, but then we noticed that even the default Django installation has issue when adding a new User via the Django Admin: The issue happens even in other Django versions (tried it in Django 1.8 , and w/ the latest one, Django 1.11.3 ). Surprisingly, the issue does not happen when using SQLite or PostgreSQL databases. Also, adding user via $./manage.py createuser and programmatically will work. Editing existing uses like the previously created

how to manage nested transaction with try catch

[亡魂溺海] 提交于 2019-12-23 05:23:04
问题 --Drop Table Tab1 Begin Transaction TR1; Save Transaction TR1; Create Table Tab1(f1 decimal(10,0)); Begin Transaction TR2 Save Transaction TR2 insert into Tab1 values(1); Begin Transaction TR3; Save Transaction TR3; insert into Tab1 values(2); Begin Try insert into Tab1 values('OK'); Commit Transaction TR3; END TRY BEGIN Catch print 'catch' RollBack Transaction TR3; End Catch insert into Tab1 values(3); Commit Transaction TR2 insert into Tab1 values(4); Commit Transaction TR1; --Commit

Using savepoints in python sqlite3

孤街浪徒 提交于 2019-12-10 14:07:27
问题 I'm attempting to use savepoints with the sqlite3 module built into python 2.6. Every time I try to release or rollback a savepoint, I always recieve an OperationalError: no such savepoint . What am I missing? python version: 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) [GCC 4.0.1 (Apple Inc. build 5493)] PySQLite version: 2.4.1 sqlite3 version: 3.6.11 Traceback (most recent call last): File "spDemo.py", line 21, in <module> conn.execute("release savepoint spTest;") sqlite3.OperationalError: no

How to use savepoints in oracle procedure

假如想象 提交于 2019-12-10 09:37:21
问题 I have multiple updates and insert statements in a procedure. Please refer below example: Procedure Example --code Update 1 insert 1 Update 2 Update 3 --Suppose exception occurs Now i want to rollback to before 1st update statement means no update or insert affects. 回答1: BEGIN Savepoint do_update_1; Update 1; insert 1; Update 2; Update 3; --Suppose exception occurs EXCEPTION WHEN some_exception THEN Rollback To do_update_1; END; ====== edit ========== Working example: http://sqlfiddle.com/#!4

How to use Hibernate Session.doWork(…) for savepoints / nested transactions?

半世苍凉 提交于 2019-12-08 09:54:28
问题 I'm using JavaEE/JPA managed transactions with Oracle DB und Hibernate and need to achieve some kind of nested transaction. As far as I've learned such thing is not supported out of the box but I should be able to use savepoints for that purpose. As suggested by https://stackoverflow.com/a/7626387/173689 I've tried the following: @Transactional(value = TxType.REQUIRES_NEW) public boolean doImport(Import importer, Row row) throws ImportRowFailedException { // stripped code ... // We need to

Savepoint using Hibernate

旧街凉风 提交于 2019-12-07 14:34:03
问题 The issue is i m using save or update in hibernate on temporary base... now when i finally fire update it will store it in DB permanently otherwise rollback it.. how to make save point using hibernate base is spring. like HibernateTemplate hibernateTemplateObj = getHibernateTemplate(); hibernateTemplateObj.saveOrUpdateAll(userList); now i would like to add savepoint in connection before save or update. Any help would be appriciate.. Thanks in adv. 回答1: Use this code hibernateConection

Django + MySQL - Admin Site - Add User - OperationalError - SAVEPOINT does not exist

不羁的心 提交于 2019-12-06 06:12:59
We're trying to have a custom User model and behaviors, but then we noticed that even the default Django installation has issue when adding a new User via the Django Admin: The issue happens even in other Django versions (tried it in Django 1.8 , and w/ the latest one, Django 1.11.3 ). Surprisingly, the issue does not happen when using SQLite or PostgreSQL databases. Also, adding user via $./manage.py createuser and programmatically will work. Editing existing uses like the previously created admin superuser via terminal will also work. CRUD mechanisms for Group work as intended, hence only