org.nuiton.wikitty.jdbc
Class WikittyJDBCUtil

java.lang.Object
  extended by org.nuiton.wikitty.jdbc.WikittyJDBCUtil

public class WikittyJDBCUtil
extends java.lang.Object

Version:
$Revision: 444 $ Last update: $Date: 2010-10-21 16:32:50 +0200 (jeu., 21 oct. 2010) $ by : $Author: bpoussin $
Author:
morin

Field Summary
static java.lang.String COL_BOOLEAN_VALUE
          boolean value column in the wikitty_data table
static java.lang.String COL_DATE_VALUE
          date value column in the wikitty_data table
static java.lang.String COL_DELETION_DATE
          deletion date column in wikitty_admin table
static java.lang.String COL_EXTENSION
          extension list column in the wikitty_admin table
static java.lang.String COL_FIELDNAME
          field name column in the data tables
static java.lang.String COL_FIELDTYPE
          field type column in the extension_data table
static java.lang.String COL_ID
          id column in all the tables
static java.lang.String COL_NAME
          name column in the extension_admin table
static java.lang.String COL_NUMBER_VALUE
          number value column in the wikitty_data table
static java.lang.String COL_REQUIRES
          requires column in the extension_admin table
static java.lang.String COL_TAGVALUES
          tagvalues column in the extension_admin table
static java.lang.String COL_TEXT_VALUE
          text value column in the wikitty_data table
static java.lang.String COL_VERSION
          version column in the admin tables
protected static java.lang.String JDBC_DRIVER
          JDBC JDBC_DRIVER property name
protected static java.lang.String JDBC_HOST
          JDBC_HOST property name
protected static java.lang.String JDBC_PASSWORD
          JDBC_PASSWORD property name
protected static java.lang.String JDBC_USER_NAME
          JDBC_USER_NAME property name
protected static java.lang.String JDBC_XADATASOURCE
          JDBC_XADATASOURCE property name
static java.lang.String QUERY_CLEAR_EXTENSION
          clear extension query property name
static java.lang.String QUERY_CLEAR_WIKITTY
          clear wikitty query property name
static java.lang.String QUERY_CREATION_EXTENSION_ADMIN
           
static java.lang.String QUERY_CREATION_EXTENSION_ADMIN_TEST
          extension_admin table creation query property name
static java.lang.String QUERY_CREATION_EXTENSION_DATA
           
static java.lang.String QUERY_CREATION_EXTENSION_DATA_TEST
          extension_data table creation query property name
static java.lang.String QUERY_CREATION_WIKITTY_ADMIN
           
static java.lang.String QUERY_CREATION_WIKITTY_ADMIN_TEST
          wikitty_admin table creation query property name
static java.lang.String QUERY_CREATION_WIKITTY_DATA
           
static java.lang.String QUERY_CREATION_WIKITTY_DATA_TEST
          wikitty_admin table creation query property name
static java.lang.String QUERY_DELETE_WIKITTY_ADMIN
          deletion in the admin table query property name
static java.lang.String QUERY_DELETE_WIKITTY_DATA
          deletion in the data table query property name
static java.lang.String QUERY_INSERT_EXTENSION_ADMIN
          insertion in the admin table query property name
static java.lang.String QUERY_INSERT_EXTENSION_DATA
          insertion in the data table query property name
static java.lang.String QUERY_INSERT_WIKITTY_ADMIN
          insertion in the admin table query property name
static java.lang.String QUERY_INSERT_WIKITTY_DATA
          insertion in the data table query property name
static java.lang.String QUERY_SELECT
          basic selection without where clause query property name
static java.lang.String QUERY_SELECT_NOTDELETED
          basic selection without where clause query property name
static java.lang.String QUERY_SELECT_TWO_WHERE
          basic selection with where clause query property name
static java.lang.String QUERY_SELECT_WHERE
          basic selection with where clause query property name
static java.lang.String QUERY_SELECT_WHERE_NOTDELETED
          not deleted data selection with where clause query property name
static java.lang.String QUERY_UPDATE_WIKITTY_ADMIN
          update in the admin table query property name
protected static java.lang.String TABLE_EXTENSION_ADMIN
          admin table name
protected static java.lang.String TABLE_EXTENSION_DATA
          data table name
protected static java.lang.String TABLE_WIKITTY_ADMIN
          admin table name
protected static java.lang.String TABLE_WIKITTY_DATA
          data table name
 
Constructor Summary
WikittyJDBCUtil()
           
 
Method Summary
static void closeQuietly(java.sql.Connection connection)
          Closes a connection.
static void commitJDBCConnection(java.sql.Connection connection)
          Closes a connection (i.e. transaction) and commit data.
static void doQuery(java.sql.Connection connection, java.lang.String query, java.lang.Object... args)
          Execute query.
static java.sql.Connection getConnection(java.util.Properties conf)
          Get a new connection instance (i.e. it opens a new transaction) plug on JTA.
static java.sql.Connection getJDBCConnection(java.util.Properties conf)
          Get a new connection instance (i.e. it opens a new transaction).
static java.util.Properties loadProperties(java.util.Properties properties)
          Loads the properties in the wikitty-jdbc-config.properties file.
static void rollbackJDBCConnection(java.sql.Connection connection)
          Closes a connection (i.e. transaction) and rollback data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COL_EXTENSION

public static final java.lang.String COL_EXTENSION
extension list column in the wikitty_admin table

See Also:
Constant Field Values

COL_VERSION

public static final java.lang.String COL_VERSION
version column in the admin tables

See Also:
Constant Field Values

COL_ID

public static final java.lang.String COL_ID
id column in all the tables

See Also:
Constant Field Values

COL_NAME

public static final java.lang.String COL_NAME
name column in the extension_admin table

See Also:
Constant Field Values

COL_REQUIRES

public static final java.lang.String COL_REQUIRES
requires column in the extension_admin table

See Also:
Constant Field Values

COL_TAGVALUES

public static final java.lang.String COL_TAGVALUES
tagvalues column in the extension_admin table

See Also:
Constant Field Values

COL_FIELDNAME

public static final java.lang.String COL_FIELDNAME
field name column in the data tables

See Also:
Constant Field Values

COL_FIELDTYPE

public static final java.lang.String COL_FIELDTYPE
field type column in the extension_data table

See Also:
Constant Field Values

COL_BOOLEAN_VALUE

public static final java.lang.String COL_BOOLEAN_VALUE
boolean value column in the wikitty_data table

See Also:
Constant Field Values

COL_NUMBER_VALUE

public static final java.lang.String COL_NUMBER_VALUE
number value column in the wikitty_data table

See Also:
Constant Field Values

COL_TEXT_VALUE

public static final java.lang.String COL_TEXT_VALUE
text value column in the wikitty_data table

See Also:
Constant Field Values

COL_DATE_VALUE

public static final java.lang.String COL_DATE_VALUE
date value column in the wikitty_data table

See Also:
Constant Field Values

COL_DELETION_DATE

public static final java.lang.String COL_DELETION_DATE
deletion date column in wikitty_admin table

See Also:
Constant Field Values

QUERY_SELECT

public static final java.lang.String QUERY_SELECT
basic selection without where clause query property name

See Also:
Constant Field Values

QUERY_SELECT_NOTDELETED

public static final java.lang.String QUERY_SELECT_NOTDELETED
basic selection without where clause query property name

See Also:
Constant Field Values

QUERY_SELECT_WHERE

public static final java.lang.String QUERY_SELECT_WHERE
basic selection with where clause query property name

See Also:
Constant Field Values

QUERY_SELECT_TWO_WHERE

public static final java.lang.String QUERY_SELECT_TWO_WHERE
basic selection with where clause query property name

See Also:
Constant Field Values

QUERY_SELECT_WHERE_NOTDELETED

public static final java.lang.String QUERY_SELECT_WHERE_NOTDELETED
not deleted data selection with where clause query property name

See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_ADMIN_TEST

public static final java.lang.String QUERY_CREATION_WIKITTY_ADMIN_TEST
wikitty_admin table creation query property name

See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_ADMIN

public static final java.lang.String QUERY_CREATION_WIKITTY_ADMIN
See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_DATA_TEST

public static final java.lang.String QUERY_CREATION_WIKITTY_DATA_TEST
wikitty_admin table creation query property name

See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_DATA

public static final java.lang.String QUERY_CREATION_WIKITTY_DATA
See Also:
Constant Field Values

QUERY_INSERT_WIKITTY_ADMIN

public static final java.lang.String QUERY_INSERT_WIKITTY_ADMIN
insertion in the admin table query property name

See Also:
Constant Field Values

QUERY_UPDATE_WIKITTY_ADMIN

public static final java.lang.String QUERY_UPDATE_WIKITTY_ADMIN
update in the admin table query property name

See Also:
Constant Field Values

QUERY_INSERT_WIKITTY_DATA

public static final java.lang.String QUERY_INSERT_WIKITTY_DATA
insertion in the data table query property name

See Also:
Constant Field Values

QUERY_DELETE_WIKITTY_ADMIN

public static final java.lang.String QUERY_DELETE_WIKITTY_ADMIN
deletion in the admin table query property name

See Also:
Constant Field Values

QUERY_DELETE_WIKITTY_DATA

public static final java.lang.String QUERY_DELETE_WIKITTY_DATA
deletion in the data table query property name

See Also:
Constant Field Values

QUERY_CLEAR_EXTENSION

public static final java.lang.String QUERY_CLEAR_EXTENSION
clear extension query property name

See Also:
Constant Field Values

QUERY_CLEAR_WIKITTY

public static final java.lang.String QUERY_CLEAR_WIKITTY
clear wikitty query property name

See Also:
Constant Field Values

QUERY_CREATION_EXTENSION_ADMIN_TEST

public static final java.lang.String QUERY_CREATION_EXTENSION_ADMIN_TEST
extension_admin table creation query property name

See Also:
Constant Field Values

QUERY_CREATION_EXTENSION_ADMIN

public static final java.lang.String QUERY_CREATION_EXTENSION_ADMIN
See Also:
Constant Field Values

QUERY_CREATION_EXTENSION_DATA_TEST

public static final java.lang.String QUERY_CREATION_EXTENSION_DATA_TEST
extension_data table creation query property name

See Also:
Constant Field Values

QUERY_CREATION_EXTENSION_DATA

public static final java.lang.String QUERY_CREATION_EXTENSION_DATA
See Also:
Constant Field Values

QUERY_INSERT_EXTENSION_ADMIN

public static final java.lang.String QUERY_INSERT_EXTENSION_ADMIN
insertion in the admin table query property name

See Also:
Constant Field Values

QUERY_INSERT_EXTENSION_DATA

public static final java.lang.String QUERY_INSERT_EXTENSION_DATA
insertion in the data table query property name

See Also:
Constant Field Values

JDBC_DRIVER

protected static java.lang.String JDBC_DRIVER
JDBC JDBC_DRIVER property name


JDBC_HOST

protected static java.lang.String JDBC_HOST
JDBC_HOST property name


JDBC_USER_NAME

protected static java.lang.String JDBC_USER_NAME
JDBC_USER_NAME property name


JDBC_PASSWORD

protected static java.lang.String JDBC_PASSWORD
JDBC_PASSWORD property name


JDBC_XADATASOURCE

protected static java.lang.String JDBC_XADATASOURCE
JDBC_XADATASOURCE property name


TABLE_WIKITTY_ADMIN

protected static java.lang.String TABLE_WIKITTY_ADMIN
admin table name


TABLE_WIKITTY_DATA

protected static java.lang.String TABLE_WIKITTY_DATA
data table name


TABLE_EXTENSION_ADMIN

protected static java.lang.String TABLE_EXTENSION_ADMIN
admin table name


TABLE_EXTENSION_DATA

protected static java.lang.String TABLE_EXTENSION_DATA
data table name

Constructor Detail

WikittyJDBCUtil

public WikittyJDBCUtil()
Method Detail

loadProperties

public static java.util.Properties loadProperties(java.util.Properties properties)
Loads the properties in the wikitty-jdbc-config.properties file.

Parameters:
properties - custom properties to override default configuration
Returns:
the properties for the connection and the queries

getConnection

public static java.sql.Connection getConnection(java.util.Properties conf)
Get a new connection instance (i.e. it opens a new transaction) plug on JTA.

Parameters:
conf - configuration
Returns:
a new Connection (db transaction)

closeQuietly

public static void closeQuietly(java.sql.Connection connection)
Closes a connection.

Parameters:
connection - the connection to close

getJDBCConnection

public static java.sql.Connection getJDBCConnection(java.util.Properties conf)
Get a new connection instance (i.e. it opens a new transaction).

Returns:
a new Connection (db transaction)
Throws:
java.sql.SQLException - if the connection fails

commitJDBCConnection

public static void commitJDBCConnection(java.sql.Connection connection)
Closes a connection (i.e. transaction) and commit data.

Parameters:
connection - the connection to close and commit

rollbackJDBCConnection

public static void rollbackJDBCConnection(java.sql.Connection connection)
Closes a connection (i.e. transaction) and rollback data.

Parameters:
connection - the connection to close and rollback

doQuery

public static void doQuery(java.sql.Connection connection,
                           java.lang.String query,
                           java.lang.Object... args)
                    throws java.sql.SQLException
Execute query.

Parameters:
connection - connection to use
query - sql query to do
args - arguments for the query
Throws:
java.sql.SQLException


Copyright © 2009-2010 CodeLutin. All Rights Reserved.