KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > acl > db > queries > sybase > TaskInsert


1 package de.webman.acl.db.queries.sybase;
2
3 import java.sql.Connection JavaDoc;
4 import java.sql.Types JavaDoc;
5 import com.teamkonzept.db.TKPrepQuery;
6
7 /**
8  * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/queries/sybase/TaskInsert.java,v 1.1 2001/09/19 12:02:02 markus Exp $
9  *
10  * @version 0.10
11  * @since 0.10
12  * @author © 2000 Team-Konzept
13  */

14 public class TaskInsert
15     extends TKPrepQuery
16 {
17
18     // Constants
19

20     public static final String JavaDoc[] ORDER =
21     {
22         "NAME",
23         "WM_CONTEXT_ID"
24     };
25
26     public static final Object JavaDoc[][] TYPES =
27     {
28         {"NAME", new Integer JavaDoc(Types.VARCHAR)},
29         {"WM_CONTEXT_ID", new Integer JavaDoc(Types.INTEGER)}
30     };
31
32     public static final boolean[] RELEVANTS =
33     {
34         true
35     };
36
37     public static final String JavaDoc SQL = (new StringBuffer JavaDoc()).append("DECLARE @ID INT ")
38                                                          .append("SELECT @ID = ISNULL(MAX(WM_TASK_ID) + 1, 1) FROM WM_TASK ")
39                                                          .append("INSERT INTO WM_TASK (WM_TASK_ID, NAME, WM_CONTEXT_ID) VALUES (@ID, ?, ?) ")
40                                                          .append("SELECT * FROM WM_TASK WHERE WM_TASK_ID = @ID")
41                                                          .toString();
42
43
44     // Method implementations
45

46     public void initQuery (Connection JavaDoc connection)
47     {
48         super.initQuery(connection,
49                         true,
50                         ORDER,
51                         TYPES,
52                         RELEVANTS,
53                         SQL);
54     }
55
56 }
57
Popular Tags