01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.command.ddl;
07:
08: import java.sql.SQLException;
09:
10: import org.h2.command.Prepared;
11: import org.h2.engine.Procedure;
12: import org.h2.engine.Session;
13:
14: /**
15: * This class represents the statement
16: * PREPARE
17: */
18: public class PrepareProcedure extends DefineCommand {
19:
20: private String procedureName;
21: private Prepared prepared;
22:
23: public PrepareProcedure(Session session) {
24: super (session);
25: }
26:
27: public void checkParameters() {
28: // no not check parameters
29: }
30:
31: public int update() throws SQLException {
32: Procedure proc = new Procedure(procedureName, prepared);
33: prepared.setParameterList(parameters);
34: prepared.setPrepareAlways(prepareAlways);
35: prepared.prepare();
36: session.addProcedure(proc);
37: return 0;
38: }
39:
40: public void setProcedureName(String name) {
41: this .procedureName = name;
42: }
43:
44: public void setPrepared(Prepared prep) {
45: this.prepared = prep;
46: }
47:
48: }
|