org.apache.oozie.util.db
Class Schema

java.lang.Object
  extended by org.apache.oozie.util.db.Schema

public class Schema
extends Object


Nested Class Summary
static interface Schema.Column
          Interface or table columns
static class Schema.DBType
          DB types
static interface Schema.Index
          Interface for Index
static interface Schema.Table
          Interface for DB Table
 
Constructor Summary
Schema()
           
 
Method Summary
static String generateCreateIndexScript(Schema.Index index, Schema.DBType dbType)
          Generates the SQL statement for creating the Index
static String generateCreateTableScript(Schema.Table table, Schema.DBType dbType, List<Schema.Column> tableColumns)
          Generates the SQL Statement for creating the table
static String generateDropTableScript(Schema.Table table, Schema.DBType dbType)
          Generates the SQL Statement for droping the table
static String getDbDataType(Schema.Column column, Schema.DBType dbType)
          Returns the appropriate DB type for given column according to the DB Type
static boolean isHsqlConnection(Connection conn)
          Checks if the given connection's driver is HSQL Database Driver
static boolean isMySqlConnection(Connection conn)
          Checks if the given connection's driver is MySQL Database Driver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Schema

public Schema()
Method Detail

getDbDataType

public static String getDbDataType(Schema.Column column,
                                   Schema.DBType dbType)
Returns the appropriate DB type for given column according to the DB Type

Parameters:
column -
dbType -
Returns:
column type

generateCreateTableScript

public static String generateCreateTableScript(Schema.Table table,
                                               Schema.DBType dbType,
                                               List<Schema.Column> tableColumns)
Generates the SQL Statement for creating the table

Parameters:
table -
dbType -
tableColumns -
Returns:
CREATE TABLE SQL Statement

generateDropTableScript

public static String generateDropTableScript(Schema.Table table,
                                             Schema.DBType dbType)
Generates the SQL Statement for droping the table

Parameters:
table -
dbType -
Returns:
DROP TABLE SQL Statement

generateCreateIndexScript

public static String generateCreateIndexScript(Schema.Index index,
                                               Schema.DBType dbType)
Generates the SQL statement for creating the Index

Parameters:
index -
dbType -
Returns:
CREATE INDEX SQL Statement

isHsqlConnection

public static boolean isHsqlConnection(Connection conn)
                                throws SQLException
Checks if the given connection's driver is HSQL Database Driver

Parameters:
conn -
Returns:
true if the driver is HSQL
Throws:
SQLException

isMySqlConnection

public static boolean isMySqlConnection(Connection conn)
                                 throws SQLException
Checks if the given connection's driver is MySQL Database Driver

Parameters:
conn -
Returns:
true if the driver is MySQL
Throws:
SQLException


Copyright © 2012 Apache Software Foundation. All Rights Reserved.