File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\command\ddl\PrepareProcedure.java.html

1 /*
2 * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,
3 * Version 1.0, and under the Eclipse Public License, Version 1.0
4 * (http://h2database.com/html/license.html).
5 * Initial Developer: H2 Group
6 */
7 package org.h2.command.ddl;
8
9 import java.util.ArrayList;
10 import org.h2.command.CommandInterface;
11 import org.h2.command.Prepared;
12 import org.h2.engine.Procedure;
13 import org.h2.engine.Session;
14 import org.h2.expression.Parameter;
15 import org.h2.util.New;
16
17 /**
18 * This class represents the statement
19 * PREPARE
20 */
21 public class PrepareProcedure extends DefineCommand {
22
23 private String procedureName;
24 private Prepared prepared;
25
26 public PrepareProcedure(Session session) {
27 super(session);
28 }
29
30 public void checkParameters() {
31 // no not check parameters
32 }
33
34 public int update() {
35 Procedure proc = new Procedure(procedureName, prepared);
36 prepared.setParameterList(parameters);
37 prepared.setPrepareAlways(prepareAlways);
38 prepared.prepare();
39 session.addProcedure(proc);
40 return 0;
41 }
42
43 public void setProcedureName(String name) {
44 this.procedureName = name;
45 }
46
47 public void setPrepared(Prepared prep) {
48 this.prepared = prep;
49 }
50
51 public ArrayList<Parameter> getParameters() {
52 return New.arrayList();
53 }
54
55 public int getType() {
56 return CommandInterface.PREPARE;
57 }
58
59 }
60