01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: TestDropSequence.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.database.queries;
09:
10: import com.uwyn.rife.database.Datasource;
11: import com.uwyn.rife.database.DbConnection;
12: import com.uwyn.rife.database.exceptions.DatabaseException;
13:
14: public abstract class TestDropSequence extends TestQuery {
15: public TestDropSequence(String name) {
16: super (name);
17: }
18:
19: public void execute(Datasource datasource, DropSequence query) {
20: try {
21: DbConnection connection = datasource.getConnection();
22: connection.beginTransaction();
23: CreateSequence create_sequence = new CreateSequence(
24: datasource);
25: create_sequence.name(query.getName());
26: connection.createStatement().executeUpdate(create_sequence);
27:
28: connection.createStatement().executeUpdate(query);
29: connection.rollback();
30: } catch (DatabaseException e) {
31: throw new RuntimeException(e);
32: }
33: }
34: }
|