01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/webman/mainint/db/queries/sybase/Attic/TKDBDocContentPut.java,v 1.2 2001/08/15 12:50:09 markus Exp $
03: *
04: */
05: package com.teamkonzept.webman.mainint.db.queries.sybase;
06:
07: import java.sql.*;
08:
09: import com.teamkonzept.db.*;
10:
11: /*
12: * TKDBDocContentPut
13: * Schreibt einen DS fuer einen Document_Content
14: *
15: * Input: Kompl. DS
16: * Output: none
17: */
18: public class TKDBDocContentPut extends TKPrepQuery {
19:
20: public final static boolean isPrepared = true;
21:
22: public final static String[] paramOrder = { "SELECTION_TYPE",
23: "SELECTION_DATA", "SITE_NODE_ID", "SITE_NODE_DOC_IDX",
24: "PRESENTATION_COMPONENT_IDX", "CONTENT_NODE_ID" };
25:
26: public final static Object[][] paramTypes = { { "SELECTION_TYPE",
27: new Integer(Types.VARCHAR) } };
28:
29: public final static boolean[] setRelevants = { false };
30:
31: public final static String sqlString =
32:
33: "DECLARE @ST VARCHAR(80) " + "DECLARE @SID INT " +
34:
35: "SELECT @ST = ? " + "SELECT @SID = NULL " +
36:
37: "BEGIN TRANSACTION " +
38:
39: "IF ( @ST IS NOT NULL ) " + "BEGIN " + "SELECT "
40: + " @SID = ISNULL(MAX(SELECTION_ID) + 1,0) " + "FROM "
41: + " CONTENT_SELECTION " +
42:
43: "INSERT INTO " + " CONTENT_SELECTION "
44: + " (SELECTION_ID, SELECTION_TYPE, SELECTION_DATA) "
45: + "VALUES " + " (@SID, @ST, ?) " + "END " +
46:
47: "INSERT INTO " + " DOCUMENT_CONTENT "
48: + " (SITE_NODE_ID, SITE_NODE_DOC_IDX, "
49: + " PRESENTATION_COMPONENT_IDX, CONTENT_NODE_ID, "
50: + " SELECTION_ID ) " + "VALUES " + "(?,?,?,?, @SID) " +
51:
52: "COMMIT TRANSACTION ";
53:
54: public void initQuery(Connection con) {
55: super.initQuery(con, isPrepared, paramOrder, paramTypes,
56: setRelevants, sqlString);
57: }
58: }
|