01: package de.webman.acl.db.queries.sybase;
02:
03: import java.sql.Connection;
04: import java.sql.Types;
05: import com.teamkonzept.db.TKPrepQuery;
06:
07: /**
08: * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/queries/sybase/ProfileInsert.java,v 1.1 2001/09/19 11:58:54 markus Exp $
09: *
10: * @version 0.10
11: * @since 0.10
12: * @author © 2000 Team-Konzept
13: */
14: public class ProfileInsert extends TKPrepQuery {
15:
16: // Constants
17:
18: public static final String[] ORDER = { "WM_PROFILE_ID",
19: "WM_USER_ID" };
20:
21: public static final Object[][] TYPES = {
22: { "WM_PROFILE_ID", new Integer(Types.INTEGER) },
23: { "WM_USER_ID", new Integer(Types.INTEGER) } };
24:
25: public static final boolean[] RELEVANTS = { true };
26:
27: public static final String SQL = (new StringBuffer())
28: .append("DECLARE @ID INT ")
29: .append("DECLARE @PRIO INT ")
30: .append("SELECT @ID = ? ")
31: .append(
32: "SELECT @PRIO = ISNULL(MAX(PRIORITY) + 1, 1) FROM WM_PROFILE WHERE WM_PROFILE_ID = @ID ")
33: .append(
34: "INSERT INTO WM_PROFILE (WM_USER_ID, WM_PROFILE_ID, PRIORITY) VALUES (?, @ID, @PRIO)")
35: .toString();
36:
37: // Method implementations
38:
39: public void initQuery(Connection connection) {
40: super .initQuery(connection, true, ORDER, TYPES, RELEVANTS, SQL);
41: }
42:
43: }
|