Debian Codegraph @

src/main/org/h2/command/ddl/PrepareProcedure.java

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