org.brains2b.data.sql
Class SqlDataHelper

java.lang.Object
  extended by org.brains2b.data.sql.SqlDataHelper

public class SqlDataHelper
extends java.lang.Object

Class with static functions to help with SQL datatypes

Oracle has no support for boolean types and those are usually implemented as VARCHAR2(1) containing either Y or N. two functions getYesNo(boolean) and getBoolean(String) are implemented to make that conversion

Version:
0.11 [16-01-2008]
Author:
dennis@brains2b.nl

Constructor Summary
SqlDataHelper()
           
 
Method Summary
static boolean getBoolean(java.lang.String yesNo)
          Function getBoolean, returns true if the String consist of the letter Y or y and return false in all other cases.
static java.lang.String getYesNo(boolean b)
          Function getYesNo returns the character 'Y' for boolean true and 'N' for boolean false
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlDataHelper

public SqlDataHelper()
Method Detail

getYesNo

public static final java.lang.String getYesNo(boolean b)
Function getYesNo returns the character 'Y' for boolean true and 'N' for boolean false

Parameters:
b - boolean value,
Returns:
String of length one containing either 'Y' or 'N'

getBoolean

public static final boolean getBoolean(java.lang.String yesNo)
Function getBoolean, returns true if the String consist of the letter Y or y and return false in all other cases. Whitespace is ignored in the evaluation.

Parameters:
yesNo - String, that needs to be evaluated to true or false
Returns:
boolean, true if String consist of 'Y' or 'y' and false in all other cases
Throws:
java.lang.NullPointerException - if String is null