org.nuiton.wikitty.jdbc
Class WikittyJDBCUtil

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

public class WikittyJDBCUtil
extends Object

Version:
$Revision: 874 $ Last update: $Date: 2011-05-09 16:14:08 +0200 (lun., 09 mai 2011) $ by : $Author: sletellier $
Author:
morin

Field Summary
static String[] BINARY_TYPES
          reference all binary type known for bd, wikitty will search if type is supported for using it
static String COL_BINARY_VALUE
          boolean value column in the wikitty_data table
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 QUERY_CLEAR_EXTENSION
          clear extension query property name
static String QUERY_CLEAR_WIKITTY
          clear wikitty query property name
static String QUERY_COUNT_ACTIVE_WIKITTY
          count number of active (not deleted wikitties)
static String QUERY_COUNT_DELETED_WIKITTY
          count number of deleted
static String QUERY_CREATION_EXTENSION_ADMIN
          extension_admin table creation query property name
static String QUERY_CREATION_EXTENSION_DATA
          extension_data table creation query property name
static String QUERY_CREATION_WIKITTY_ADMIN
          wikitty_admin table creation query property name
static String QUERY_CREATION_WIKITTY_DATA
          wikitty_data table creation query property name
static String QUERY_CREATION_WIKITTY_DATA_ALTER_BINARY
          wikitty_data column binary creation with alter query property name
static String QUERY_CREATION_WIKITTY_DATA_NO_BINARY
           
static String QUERY_CREATION_WIKITTY_DATA_TEST_BINARY
          wikitty_data column binary test exits query property name
static String QUERY_DELETE_EXTENSION_ADMIN
           
static String QUERY_DELETE_EXTENSION_DATA
           
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_EXTENSION_ADMIN
          clear extension query property name
static String QUERY_SELECT_NOTDELETED
          basic selection without where clause query property name
static String QUERY_SELECT_TWO_WHERE
          basic selection with 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 deleted 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)
          Closes a connection.
static void doQuery(Connection connection, String query, Object... args)
          Execute query.
static Connection getConnection(WikittyTransaction tx, org.nuiton.util.ApplicationConfig config)
          Get a new connection instance (i.e. it opens a new transaction).
static Connection getConnectionUnconfigured(WikittyTransaction tx, org.nuiton.util.ApplicationConfig conf)
          Get a new connection instance (i.e. it opens a new transaction) plug on JTA.
static String getSupportedBinaryType(Connection connection)
           
static Properties loadQuery(org.nuiton.util.ApplicationConfig config)
          Loads the properties from configuration file, one or more properties can be load default load wikitty-jdbc-config.properties file.
static boolean tableExist(Connection connection, String tableName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BINARY_TYPES

public static final String[] BINARY_TYPES
reference all binary type known for bd, wikitty will search if type is supported for using it


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_BINARY_VALUE

public static final String COL_BINARY_VALUE
boolean value column in the wikitty_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_COUNT_ACTIVE_WIKITTY

public static final String QUERY_COUNT_ACTIVE_WIKITTY
count number of active (not deleted wikitties)

See Also:
Constant Field Values

QUERY_COUNT_DELETED_WIKITTY

public static final String QUERY_COUNT_DELETED_WIKITTY
count number of deleted

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_TWO_WHERE

public static final 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 String QUERY_SELECT_WHERE_NOTDELETED
not deleted data selection with where clause query property name

See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_ADMIN

public static final String QUERY_CREATION_WIKITTY_ADMIN
wikitty_admin table creation query property name

See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_DATA_TEST_BINARY

public static final String QUERY_CREATION_WIKITTY_DATA_TEST_BINARY
wikitty_data column binary test exits query property name

See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_DATA_ALTER_BINARY

public static final String QUERY_CREATION_WIKITTY_DATA_ALTER_BINARY
wikitty_data column binary creation with alter query property name

See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_DATA

public static final String QUERY_CREATION_WIKITTY_DATA
wikitty_data table creation query property name

See Also:
Constant Field Values

QUERY_CREATION_WIKITTY_DATA_NO_BINARY

public static final String QUERY_CREATION_WIKITTY_DATA_NO_BINARY
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_SELECT_EXTENSION_ADMIN

public static final String QUERY_SELECT_EXTENSION_ADMIN
clear extension query property name

See Also:
Constant Field Values

QUERY_DELETE_EXTENSION_ADMIN

public static final String QUERY_DELETE_EXTENSION_ADMIN
See Also:
Constant Field Values

QUERY_DELETE_EXTENSION_DATA

public static final String QUERY_DELETE_EXTENSION_DATA
See Also:
Constant Field Values

QUERY_CREATION_EXTENSION_ADMIN

public static final String QUERY_CREATION_EXTENSION_ADMIN
extension_admin table creation query property name

See Also:
Constant Field Values

QUERY_CREATION_EXTENSION_DATA

public static final String QUERY_CREATION_EXTENSION_DATA
extension_data table creation query property name

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

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

loadQuery

public static Properties loadQuery(org.nuiton.util.ApplicationConfig config)
Loads the properties from configuration file, one or more properties can be load default load wikitty-jdbc-config.properties file.

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

getConnectionUnconfigured

public static Connection getConnectionUnconfigured(WikittyTransaction tx,
                                                   org.nuiton.util.ApplicationConfig conf)
Get a new connection instance (i.e. it opens a new transaction) plug on JTA. This connection is not configured, returned connection is just create connection Don't use this method, use getConnection that change auto commit to false This connection must be close be the asker after used

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

closeQuietly

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

Parameters:
connection - the connection to close

getConnection

public static Connection getConnection(WikittyTransaction tx,
                                       org.nuiton.util.ApplicationConfig config)
Get a new connection instance (i.e. it opens a new transaction). This connection must be close be the asker after used

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

tableExist

public static boolean tableExist(Connection connection,
                                 String tableName)
                          throws SQLException
Throws:
SQLException

getSupportedBinaryType

public static String getSupportedBinaryType(Connection connection)
                                     throws SQLException
Throws:
SQLException

doQuery

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

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


Copyright © 2009-2011 CodeLutin. All Rights Reserved.