pl.mbdev.mysql
Class SqlConnectedQuery

java.lang.Object
  extended by pl.mbdev.mysql.SqlQuery
      extended by pl.mbdev.mysql.SqlConnectedQuery

public class SqlConnectedQuery
extends SqlQuery

 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
SqlConnectedQuery(SqlConnection connection)
           
SqlConnectedQuery(SqlConnection connection, pl.mbdev.mysql.SqlQuery.QueryType type, java.lang.String statement)
           
SqlConnectedQuery(SqlConnection connection, java.lang.String statement)
           
 
Method Summary
 boolean createTable(java.lang.String statement)
          CREATE TABLE [IF NOT EXISTS] 'Table' ('column1' INT, 'column2' VARCHAR(50))
 boolean deleteFrom(java.lang.String statement)
          DELETE FROM 'Table' WHERE column = 'value'
 boolean dropTable(java.lang.String statement)
          DROP [TEMPORARY] TABLE [IF EXISTS] 'table1', 'table2'
 java.lang.Object execute()
           
 boolean insertInto(java.lang.String statement)
          INSERT INTO 'Table' (column1, column2) VALUES (row1val1, row1val2),(row2val1, row2val2)
 java.sql.ResultSet select(java.lang.String statement)
          SELECT * FROM 'Table' WHERE column = 'value'
 boolean update(java.lang.String statement)
          UPDATE 'Table' SET column1 = value, column2 = value WHERE column = 'value'
 
Methods inherited from class pl.mbdev.mysql.SqlQuery
createTable, deleteFrom, dropTable, executeOn, insertInto, select, setQueryType, update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlConnectedQuery

public SqlConnectedQuery(SqlConnection connection)
Parameters:
connection -

SqlConnectedQuery

public SqlConnectedQuery(SqlConnection connection,
                         java.lang.String statement)
Parameters:
connection -
statement -

SqlConnectedQuery

public SqlConnectedQuery(SqlConnection connection,
                         pl.mbdev.mysql.SqlQuery.QueryType type,
                         java.lang.String statement)
Parameters:
connection -
type -
statement -
Method Detail

execute

public java.lang.Object execute()
Returns:
result of the query

select

public java.sql.ResultSet select(java.lang.String statement)
SELECT * FROM 'Table' WHERE column = 'value'

Parameters:
statement -
Returns:
result set

insertInto

public boolean insertInto(java.lang.String statement)
INSERT INTO 'Table' (column1, column2) VALUES (row1val1, row1val2),(row2val1, row2val2)

Parameters:
statement -
Returns:
true if success

createTable

public boolean createTable(java.lang.String statement)
CREATE TABLE [IF NOT EXISTS] 'Table' ('column1' INT, 'column2' VARCHAR(50))

Parameters:
statement -
Returns:
true if success

deleteFrom

public boolean deleteFrom(java.lang.String statement)
DELETE FROM 'Table' WHERE column = 'value'

Parameters:
statement -
Returns:
true if success

update

public boolean update(java.lang.String statement)
UPDATE 'Table' SET column1 = value, column2 = value WHERE column = 'value'

Parameters:
statement -
Returns:
true if success

dropTable

public boolean dropTable(java.lang.String statement)
DROP [TEMPORARY] TABLE [IF EXISTS] 'table1', 'table2'

Parameters:
statement -
Returns:
true if success