org.jwarp.service.connectionpool
Class SQLHelper

java.lang.Object
  |
  +--org.jwarp.service.connectionpool.SQLHelper

public class SQLHelper
extends java.lang.Object

This is extension of AAction with added database functionalities.

Version:
1.0
Author:
Anatole Tresch, Martin Schaefer
See Also:
AAction

Method Summary
protected static java.lang.String convertForSQL(java.lang.String source)
          Replaces all occurences of ' by ´
static boolean execute(java.lang.String pool, java.lang.String query)
          This method executes any SQL command, results are ignored
static java.sql.ResultSet executeQuery(java.lang.String pool, java.lang.String query)
          This method executes an SQL query (SELECT)
static java.lang.Object executeSingleRowQuery(java.lang.String pool, java.lang.String query)
          Deprecated. This method is deprecated, since it should be implemented in a separate helper class.
static int executeUpdate(java.lang.String pool, java.lang.String query)
          This method executes an SQL update (INSERT, UPDATE or DELETE)
static java.lang.String removeSpaces(java.lang.String source)
          Produces a string with tabs and spaces replaced by unnderscores
static java.lang.String replace(java.lang.String source, java.lang.String pattern, java.lang.String replacement)
          Replaces all occurences of a pattern in a string with some other text
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

executeSingleRowQuery

public static java.lang.Object executeSingleRowQuery(java.lang.String pool,
                                                     java.lang.String query)
Deprecated. This method is deprecated, since it should be implemented in a separate helper class.

This method is a utility method which is used in some JSP pages for simple queries to the data.
Returns:
Object as returned by the SQL query or an empty string if the query failed.
Since:
1.5.00

executeQuery

public static java.sql.ResultSet executeQuery(java.lang.String pool,
                                              java.lang.String query)
This method executes an SQL query (SELECT)
Parameters:
query - The SQL string to be executed
Returns:
ResultSet The result from the SQL query or null if an error occurs
See Also:
ResultSet, Statement

executeUpdate

public static int executeUpdate(java.lang.String pool,
                                java.lang.String query)
                         throws java.sql.SQLException
This method executes an SQL update (INSERT, UPDATE or DELETE)
Parameters:
query - The SQL string to be executed
Returns:
int The number of db rows affected or -1 if an error occured
See Also:
Statement

execute

public static boolean execute(java.lang.String pool,
                              java.lang.String query)
                       throws java.sql.SQLException
This method executes any SQL command, results are ignored
Parameters:
query - The SQL string to be executed
Returns:
true if SQL command was successful false if some error occurs
See Also:
Statement

removeSpaces

public static java.lang.String removeSpaces(java.lang.String source)
Produces a string with tabs and spaces replaced by unnderscores
Parameters:
source - The source string
Returns:
String that is identical to source without tabs and spaces replaced by underscores

replace

public static java.lang.String replace(java.lang.String source,
                                       java.lang.String pattern,
                                       java.lang.String replacement)
Replaces all occurences of a pattern in a string with some other text
Parameters:
source - The original string (if ==null empty string is returned)
pattern - The old text to be replaced (if ==null no replacement is done)
replacement - The new text (if ==null old text is just removed)
Returns:
String with all occurences of pattern in source replaced by replacement

convertForSQL

protected static java.lang.String convertForSQL(java.lang.String source)
Replaces all occurences of ' by ´
Parameters:
source - The original string
Returns:
String with ' replaced by ´ or empty string if source==null

©   O R C A   S y s t e m s