public class Query
extends java.lang.Object
Description: Represents an individual SQL statement. For BasicQuery this is both the SQL statement and the mode (select or update) that is used when executing the statement.
Copyright: Copyright (c) 2004-2014, David Read
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Modifier and Type | Field and Description |
---|---|
private int |
mode
The mode for this statement
|
static int |
MODE_DESCRIBE
Represents a select-type statement (e.g.
|
static int |
MODE_QUERY
Represents a select-type statement (e.g.
|
static int |
MODE_UPDATE
Represents and update-type statement (e.g.
|
private java.lang.String |
rawSqlStatement
The raw statement (e.g.
|
private java.lang.String |
sqlStatement
The SQL statement
|
Constructor and Description |
---|
Query(java.lang.String aRawSql)
Constructs a Query
Assumes the mode is a select statement (returns result set)
|
Query(java.lang.String aRawSql,
int aMode)
Constructs a Query to perform the operation specified by the mode
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object) |
boolean |
equals(Query query)
Check whether this Query instance is equavalent to another.
|
int |
getMode()
Returns the Query Mode
|
java.lang.String |
getRawSql()
The Raw SQL statement as entered, potentially contains carriage returns
|
java.lang.String |
getSql()
Returns the SQL string
|
int |
hashCode() |
boolean |
isCommented()
Is the statement commented out
|
void |
setMode(int aMode)
Set the mode value to aMode depending on whether the user
wants to update,describe or query
|
private void |
setSql(java.lang.String aRawSql)
Set the SQL statement for this query to wrap
|
java.lang.String |
toString()
Returns the SQL statement as a string
|
public static final int MODE_QUERY
public static final int MODE_UPDATE
public static final int MODE_DESCRIBE
private java.lang.String sqlStatement
private int mode
private java.lang.String rawSqlStatement
public Query(java.lang.String aRawSql)
aRawSql
- The String to be queriedpublic Query(java.lang.String aRawSql, int aMode)
aRawSql
- The SQL statementaMode
- The mode valuepublic void setMode(int aMode)
aMode
- The mode value that is setprivate void setSql(java.lang.String aRawSql)
aRawSql
- The SQL statementpublic java.lang.String getSql()
public boolean isCommented()
public java.lang.String getRawSql()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public boolean equals(Query query)
query
- A query to compare to this querypublic int hashCode()
hashCode
in class java.lang.Object
public int getMode()
public java.lang.String toString()
toString
in class java.lang.Object