org.nuiton.wikitty.jdbc
Class WikittyJDBCUtil

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

public class WikittyJDBCUtil
extends Object

Version:
$Revision: 90 $ Last update: $Date: 2010-06-02 21:12:32 +0200 (mer., 02 juin 2010) $ by : $Author: bpoussin $
Author:
morin

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

See Also:
Constant Field Values

COL_VERSION

public static final String COL_VERSION
version column in the admin tables

See Also:
Constant Field Values

COL_ID

public static final String COL_ID
id column in all the tables

See Also:
Constant Field Values

COL_NAME

public static final String COL_NAME
name column in the extension_admin table

See Also:
Constant Field Values

COL_REQUIRES

public static final String COL_REQUIRES
requires column in the extension_admin table

See Also:
Constant Field Values

COL_TAGVALUES

public static final String COL_TAGVALUES
tagvalues column in the extension_admin table

See Also:
Constant Field Values

COL_FIELDNAME

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

See Also:
Constant Field Values

COL_FIELDTYPE

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

See Also:
Constant Field Values

COL_BOOLEAN_VALUE

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

See Also:
Constant Field Values

COL_NUMBER_VALUE

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

See Also:
Constant Field Values

COL_TEXT_VALUE

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

See Also:
Constant Field Values

COL_DATE_VALUE

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

See Also:
Constant Field Values

COL_DELETION_DATE

public static final String COL_DELETION_DATE
deletion date column in wikitty_admin table

See Also:
Constant Field Values

QUERY_SELECT

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

See Also:
Constant Field Values

QUERY_SELECT_NOTDELETED

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

See Also:
Constant Field Values

QUERY_SELECT_WHERE

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

See Also:
Constant Field Values

QUERY_SELECT_WHERE_NOTDELETED

public static final String QUERY_SELECT_WHERE_NOTDELETED
not dleeted data selection with where clause query property name

See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_ADMIN_TEST

public static final 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 String QUERY_CREATION_WIKITTY_ADMIN
See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_DATA_TEST

public static final 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 String QUERY_CREATION_WIKITTY_DATA
See Also:
Constant Field Values

QUERY_INSERT_WIKITTY_ADMIN

public static final 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 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 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 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 String QUERY_DELETE_WIKITTY_DATA
deletion in the data table query property name

See Also:
Constant Field Values

QUERY_CLEAR_EXTENSION

public static final String QUERY_CLEAR_EXTENSION
clear extension query property name

See Also:
Constant Field Values

QUERY_CLEAR_WIKITTY

public static final String QUERY_CLEAR_WIKITTY
clear wikitty query property name

See Also:
Constant Field Values

QUERY_CREATION_EXTENSION_ADMIN_TEST

public static final 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 String QUERY_CREATION_EXTENSION_ADMIN
See Also:
Constant Field Values

QUERY_CREATION_EXTENSION_DATA_TEST

public static final 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 String QUERY_CREATION_EXTENSION_DATA
See Also:
Constant Field Values

QUERY_INSERT_EXTENSION_ADMIN

public static final 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 String QUERY_INSERT_EXTENSION_DATA
insertion in the data table query property name

See Also:
Constant Field Values

JDBC_DRIVER

public static final String JDBC_DRIVER
JDBC JDBC_DRIVER property name

See Also:
Constant Field Values

JDBC_HOST

protected static String JDBC_HOST
JDBC_HOST property name


JDBC_USER_NAME

protected static String JDBC_USER_NAME
user name property name


JDBC_PASSWORD

protected static String JDBC_PASSWORD
JDBC_PASSWORD property name


TABLE_WIKITTY_ADMIN

protected static String TABLE_WIKITTY_ADMIN
admin table name


TABLE_WIKITTY_DATA

protected static String TABLE_WIKITTY_DATA
data table name


TABLE_EXTENSION_ADMIN

protected static String TABLE_EXTENSION_ADMIN
admin table name


TABLE_EXTENSION_DATA

protected static String TABLE_EXTENSION_DATA
data table name

Constructor Detail

WikittyJDBCUtil

public WikittyJDBCUtil()
Method Detail

loadProperties

public static Properties loadProperties(Properties properties)
Loads the properties in the jdbc.properties file.

Returns:
the properties for the connection and the queries

getConnection

public static Connection getConnection(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)

getJDBCConnection

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

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

closeQuietly

public static void closeQuietly(Connection connection)

commitJDBCConnection

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

Parameters:
connection - the connection to close and commit

rollbackJDBCConnection

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

Parameters:
connection - the connection to close and rollback

doQuery

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

Parameters:
con - connexion to use
query - sql query to do
args - arguments for the query
Throws:
SQLException


Copyright © 2009-2010 CodeLutin. All Rights Reserved.