play.db
Class DB

java.lang.Object
  extended by play.db.DB

public class DB
extends java.lang.Object

Database connection utilities.


Field Summary
static javax.sql.DataSource datasource
          The loaded datasource.
static java.lang.String destroyMethod
          The method used to destroy the datasource
 
Constructor Summary
DB()
           
 
Method Summary
static void close()
          Close the connection opened for the current thread.
static void destroy()
          Destroy the datasource
static boolean execute(java.lang.String SQL)
          Execute an SQL update
static java.sql.ResultSet executeQuery(java.lang.String SQL)
          Execute an SQL query
static java.sql.Connection getConnection()
          Open a connection for the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

datasource

public static javax.sql.DataSource datasource
The loaded datasource.


destroyMethod

public static java.lang.String destroyMethod
The method used to destroy the datasource

Constructor Detail

DB

public DB()
Method Detail

close

public static void close()
Close the connection opened for the current thread.


getConnection

public static java.sql.Connection getConnection()
Open a connection for the current thread.

Returns:
A valid SQL connection

execute

public static boolean execute(java.lang.String SQL)
Execute an SQL update

Parameters:
SQL -
Returns:
false if update failed

executeQuery

public static java.sql.ResultSet executeQuery(java.lang.String SQL)
Execute an SQL query

Parameters:
SQL -
Returns:
The query resultSet

destroy

public static void destroy()
Destroy the datasource



Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly