01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU General Public License as published by the
09: * Free Software Foundation; either version 2 of the License, or (at your option)
10: * any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15: * for more details.
16: *
17: * You should have received a copy of the GNU General Public License along with
18: * this program; if not, write to the Free Software Foundation, Inc.,
19: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: *
21: *
22: * $Id: JdbcStatement.java 9560 2007-10-15 06:56:24Z lzheng $
23: */
24:
25: package com.bostechcorp.cbesb.runtime.jdbc;
26:
27: import java.util.Vector;
28:
29: public class JdbcStatement {
30:
31: private String sqlStatement;
32: private Vector<JdbcVar> vars;
33:
34: public JdbcStatement() {
35: sqlStatement = null;
36: vars = new Vector<JdbcVar>();
37: }
38:
39: public void finalize() {
40: vars.clear();
41: vars = null;
42: }
43:
44: /**
45: * @return the sqlStatement
46: */
47: public String getSqlStatement() {
48: return sqlStatement;
49: }
50:
51: /**
52: * @param sqlStatement the sqlStatement to set
53: */
54: public void setSqlStatement(String sqlStatement) {
55: this .sqlStatement = sqlStatement;
56: }
57:
58: public int getBindVarCount() {
59: if (vars == null) {
60: return 0;
61: } else {
62: return vars.size();
63: }
64: }
65:
66: public JdbcVar getBindVar(int index) {
67: JdbcVar var = null;
68: if (vars != null) {
69: if (index >= 0 && index < vars.size())
70: var = vars.get(index);
71: }
72: return var;
73: }
74:
75: public void addBindVar(JdbcVar var) {
76: if (vars == null) {
77: vars = new Vector<JdbcVar>();
78: }
79: vars.add(var);
80: }
81:
82: public void addBindVars(Vector<JdbcVar> vars) {
83: if (this .vars == null) {
84: this .vars = new Vector<JdbcVar>();
85: }
86: this .vars.addAll(vars);
87: }
88:
89: public Vector<JdbcVar> getVars() {
90: return this.vars;
91: }
92:
93: }
|