01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/webman/mainint/db/queries/sybase/Attic/TKDBPresInsert.java,v 1.2 2001/08/15 12:50:09 markus Exp $
03: *
04: */
05: /**
06: * Jedes Selectstatement erhaelt eine eigene Klasse
07: */package com.teamkonzept.webman.mainint.db.queries.sybase;
08:
09: import java.sql.*;
10:
11: import com.teamkonzept.db.*;
12:
13: /*
14: * TKDBPresInsert
15: * input "PRESENTATION_NAME", "PRESENTATION_SHORTNAME",
16: "TEMPLATE_ID",
17: * ouptut neu erzeugter DS
18: *
19: * erzeugt neuen Eintrag in PRESENTATION
20: */
21: public class TKDBPresInsert extends TKPrepQuery {
22:
23: public final static boolean isPrepared = true;
24:
25: public final static String[] paramOrder = { "PRESENTATION_NAME",
26: "PRESENTATION_SHORTNAME", "TEMPLATE_ID" };
27:
28: public final static Object[][] paramTypes = {
29: { "PRESENTATION_NAME", new Integer(Types.VARCHAR) },
30: { "PRESENTATION_SHORTNAME", new Integer(Types.VARCHAR) } };
31:
32: public final static boolean[] setRelevants = { true };
33:
34: public final static String sqlString = "DECLARE @PID int "
35: +
36:
37: "BEGIN TRANSACTION "
38: +
39:
40: "SELECT "
41: + " @PID=ISNULL(MAX(PRESENTATION_ID)+1, 0) "
42: + "FROM "
43: + " PRESENTATION "
44: +
45:
46: "INSERT INTO "
47: + " PRESENTATION "
48: + " (PRESENTATION_ID, PRESENTATION_NAME, PRESENTATION_SHORTNAME, "
49: + " TEMPLATE_ID) " + "VALUES " + " (@PID, ?, ?, ?) " +
50:
51: "SELECT " + " * " + "FROM " + " PRESENTATION " + "WHERE "
52: + " PRESENTATION_ID = @PID " +
53:
54: "COMMIT ";
55:
56: public void initQuery(Connection con) {
57: super.initQuery(con, isPrepared, paramOrder, paramTypes,
58: setRelevants, sqlString);
59: }
60: }
|