01: package com.teamkonzept.webman.mainint.db.queries;
02:
03: import java.sql.*;
04:
05: import com.teamkonzept.db.*;
06:
07: /**
08: *
09: * TKDBSiteDocGetHeretable
10: * This query has to be implemented
11: * database-specifically in a subpackage (oracle,sybase,postgresql, ...)
12: * @author $Author: markus $
13: * @version $Revision: 1.17 $
14: */
15: public class TKDBSiteDocGetHeretable extends TKPrepQuery {
16:
17: public final static boolean ISPREPARED = true;
18: public final static String[] PARAMORDER = { "SITE_NODE_ID",
19: "SITE_NODE_ID" };
20: public final static Object[][] PARAMTYPES = null;
21: public final static boolean[] SETRELEVANTS = { true };
22:
23: public boolean execute() {
24: throw new RuntimeException(
25: "datenbank-spezifische Query im jeweiligen Sub-Package fehlt!");
26: }
27:
28: public void initQuery(Connection con) {
29: super .initQuery(con, ISPREPARED, PARAMORDER, PARAMTYPES,
30: SETRELEVANTS, null);
31: }
32: }
33:
34: /* CREATE TABLE #PATH ( SITE_NODE_ID int, LEFT_NR int, RIGHT_NR int,SITE_NODE_DOC_IDX int null,PRESENTATION_ID int null,DOCUMENT_NAME varchar(254) null,DOCUMENT_SHORTNAME varchar(80) null,INHERITABLE int null,DOCUMENT_TYPE int null,EXTERNAL_URL varchar(254) null,INHERIT_BEGIN_LEVEL int null,INHERIT_END_LEVEL int null)
35:
36: INSERT INTO #PATH SELECT S_T.SITE_NODE_ID, S_T.LEFT_NR, S_T.RIGHT_NR, S_D.SITE_NODE_DOC_IDX, S_D.PRESENTATION_ID, S_D.DOCUMENT_NAME, S_D.DOCUMENT_SHORTNAME, S_D.INHERITABLE, S_D.DOCUMENT_TYPE, S_D.EXTERNAL_URL, S_D.INHERIT_BEGIN_LEVEL, S_D.INHERIT_END_LEVEL FROM SITE_TREE S_T, SITE_DOCUMENT S_D WHERE S_T.SITE_NODE_ID *= S_D.SITE_NODE_ID AND LEFT_NR < (SELECT LEFT_NR FROM SITE_TREE WHERE SITE_NODE_ID = 2 ) AND RIGHT_NR > (SELECT RIGHT_NR FROM SITE_TREE WHERE SITE_NODE_ID = 2 )
37:
38: SELECT OUTER.*, P.PRESENTATION_NAME FROM #PATH OUTER, PRESENTATION P WHERE NOT EXISTS (SELECT 1 FROM #PATH INNER WHERE INNER.DOCUMENT_SHORTNAME = OUTER.DOCUMENT_SHORTNAME AND INNER.LEFT_NR > OUTER.LEFT_NR ) AND INHERIT_BEGIN_LEVEL <= ( SELECT COUNT(SITE_NODE_ID) FROM #PATH COUNTER WHERE COUNTER.LEFT_NR > OUTER.LEFT_NR ) AND ( INHERIT_END_LEVEL = -1 OR INHERIT_END_LEVEL >=(SELECT COUNT(SITE_NODE_ID) FROM #PATH COUNTER WHERE COUNTER.LEFT_NR > OUTER.LEFT_NR) ) AND OUTER.PRESENTATION_ID *= P.PRESENTATION_ID
39: */
|