Source code: javatools/db/DbLiteral.java
1 /*
2 Javatools (modified version) - Some useful general classes.
3 Copyright (C) 2002-2003 Chris Bitmead (original) Antonio Petrelli (modified)
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Contact me at: brenmcguire@users.sourceforge.net
20 */
21 package javatools.db;
22 import java.sql.*;
23 import java.util.*;
24
25 /**
26 * Inserts a piece of literal text within the SQL expression. This can be
27 * useful for non-portable hacks into the SQL code.
28 *
29 * @author pcguest
30 * @created October 18, 2001
31 * @version 0.7
32 * @commentedby Antonio Petrelli
33 */
34
35 public class DbLiteral extends DbExpr {
36 /** The literal string that represents the expression.
37 */
38 String str;
39
40
41 /**
42 * Constructor for the DbLiteral object
43 *
44 * @param db The database that will be used.
45 * @param s The string representing the expression.
46 */
47 public DbLiteral(DbDatabase db, String s) {
48 super(db);
49 str = s;
50 }
51
52
53 /**
54 * Sets the sqlValues attribute of the DbLiteral object
55 *
56 * @param ps The statement.
57 * @param i The new sqlValues value
58 * @return An index (obscure)
59 * @exception java.sql.SQLException If something goes wrong.
60 * @exception javatools.db.DbException If something goes wrong.
61 */
62 public int setSqlValues(PreparedStatement ps, int i) throws java.sql.SQLException, javatools.db.DbException {
63 return i;
64 }
65
66
67 /**
68 * Gets the queryString attribute of the DbLiteral object
69 *
70 *@return The queryString value
71 */
72 public String getQueryString() {
73 return str;
74 }
75 }