01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/webman/mainint/db/queries/sybase/Attic/TKDBSiteDocUpdatePres.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: * TKDBSiteDocUpdatePres
13: * input -> PK: SITE_NODE_ID, SITE_NODE_DOC_IDX
14: * input -> update: der Resr
15: * ouput none
16: */
17: public class TKDBSiteDocUpdatePres extends TKPrepQuery {
18:
19: public final static boolean isPrepared = true;
20:
21: public final static String[] paramOrder = { "SITE_NODE_ID",
22: "SITE_NODE_DOC_IDX", "PRESENTATION_ID", "DOCUMENT_NAME",
23: "DOCUMENT_SHORTNAME", "INHERITABLE", "DOCUMENT_TYPE",
24: "EXTERNAL_URL", "INHERIT_END_LEVEL", "INHERIT_BEGIN_LEVEL" };
25:
26: public final static Object[][] paramTypes = { { "EXTERNAL_URL",
27: new Integer(Types.VARCHAR) } };
28:
29: public final static boolean[] setRelevants = { false };
30:
31: public final static String sqlString = "DECLARE @ID int "
32: + "DECLARE @IDX int " +
33:
34: "SELECT @ID = ? " + "SELECT @IDX = ? " +
35:
36: "CREATE TABLE #temp (SELECTION_ID int) " +
37:
38: "BEGIN TRANSACTION " +
39:
40: "DELETE FROM " + " DOCUMENT_REFERENCE " + "WHERE " + " ( "
41: + " SRC_SITE_NODE_ID = @ID " + " AND "
42: + " SRC_SITE_NODE_DOC_IDX = @IDX " + " ) " +
43:
44: "INSERT INTO " + " #temp " + " (SELECTION_ID) " + "SELECT "
45: + " SELECTION_ID " + "FROM " + " DOCUMENT_CONTENT "
46: + "WHERE " + " SITE_NODE_ID = @ID " + "AND "
47: + " SITE_NODE_DOC_IDX = @IDX " + "AND "
48: + " SELECTION_ID IS NOT NULL " +
49:
50: "DELETE FROM " + " DOCUMENT_CONTENT " + "WHERE "
51: + " SITE_NODE_ID = @ID " + "AND "
52: + " SITE_NODE_DOC_IDX = @IDX " +
53:
54: "DELETE FROM " + " CONTENT_SELECTION " + "WHERE "
55: + " SELECTION_ID IN ( " + "SELECT " + " SELECTION_ID "
56: + "FROM " + " #temp " + ") " +
57:
58: "UPDATE " + " SITE_DOCUMENT " + "SET "
59: + " PRESENTATION_ID = ?," + " DOCUMENT_NAME = ?,"
60: + " DOCUMENT_SHORTNAME = ?," + " INHERITABLE = ?, "
61: + " DOCUMENT_TYPE = ?, " + " EXTERNAL_URL = ?, "
62: + " INHERIT_END_LEVEL = ?, " + " INHERIT_BEGIN_LEVEL = ? "
63: + "WHERE " + " SITE_NODE_ID = @ID " + "AND "
64: + " SITE_NODE_DOC_IDX = @IDX " +
65:
66: "COMMIT TRANSACTION " +
67:
68: "DROP TABLE #temp ";
69:
70: public void initQuery(Connection con) {
71: super.initQuery(con, isPrepared, paramOrder, paramTypes,
72: setRelevants, sqlString);
73: }
74: }
|