pl.mbdev.mysql
Class SqlQuery

java.lang.Object
  extended by pl.mbdev.mysql.SqlQuery
Direct Known Subclasses:
SqlConnectedQuery

public class SqlQuery
extends java.lang.Object

 Copyright 2011 Mateusz Bysiek,
     mb@mbdev.pl, http://mbdev.pl/
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
     http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 

Author:
Mateusz Bysiek

Constructor Summary
SqlQuery(pl.mbdev.mysql.SqlQuery.QueryType type, java.lang.String statement)
          Creates new, fully prepared SQL query.
SqlQuery(java.lang.String statement)
          Creates new
 
Method Summary
static boolean createTable(SqlConnection connection, java.lang.String statement)
           
static boolean deleteFrom(SqlConnection connection, java.lang.String statement)
           
static boolean dropTable(SqlConnection connection, java.lang.String statement)
           
 java.lang.Object executeOn(SqlConnection connection)
           
static boolean insertInto(SqlConnection connection, java.lang.String statement)
           
static java.sql.ResultSet select(SqlConnection connection, java.lang.String statement)
           
 void setQueryType(pl.mbdev.mysql.SqlQuery.QueryType type)
           
static boolean update(SqlConnection connection, java.lang.String statement)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlQuery

public SqlQuery(java.lang.String statement)
Creates new

Parameters:
statement -

SqlQuery

public SqlQuery(pl.mbdev.mysql.SqlQuery.QueryType type,
                java.lang.String statement)
Creates new, fully prepared SQL query.

Parameters:
type -
statement -
Method Detail

setQueryType

public void setQueryType(pl.mbdev.mysql.SqlQuery.QueryType type)
Parameters:
type -

executeOn

public java.lang.Object executeOn(SqlConnection connection)
Parameters:
connection -
Returns:
result of the query

select

public static java.sql.ResultSet select(SqlConnection connection,
                                        java.lang.String statement)
Parameters:
connection -
statement -
Returns:
result set

insertInto

public static boolean insertInto(SqlConnection connection,
                                 java.lang.String statement)
Parameters:
connection -
statement -
Returns:
true if success

createTable

public static boolean createTable(SqlConnection connection,
                                  java.lang.String statement)
Parameters:
connection -
statement -
Returns:
true if success

deleteFrom

public static boolean deleteFrom(SqlConnection connection,
                                 java.lang.String statement)
Parameters:
connection -
statement -
Returns:
true if success

update

public static boolean update(SqlConnection connection,
                             java.lang.String statement)
Parameters:
connection -
statement -
Returns:
true if success

dropTable

public static boolean dropTable(SqlConnection connection,
                                java.lang.String statement)
Parameters:
connection -
statement -
Returns:
true if success