org.backsource.utils.sql
Class MetadataUtil

java.lang.Object
  extended byorg.backsource.utils.sql.MetadataUtil

public class MetadataUtil
extends java.lang.Object

A collection of static utility methods to work with jdbc metadata.

Version:
$Id: MetadataUtil.java,v 1.1.1.1 2004/05/19 12:07:31 pra Exp $
Author:
Jens Askengren

Constructor Summary
MetadataUtil()
           
 
Method Summary
static void checkCreateTable(java.sql.Connection con, java.lang.String tableName, java.lang.String createStatement)
          Check if the table exists.
static boolean tableExists(java.sql.Connection con, java.lang.String tableName)
          Check if a table exists in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataUtil

public MetadataUtil()
Method Detail

tableExists

public static boolean tableExists(java.sql.Connection con,
                                  java.lang.String tableName)
                           throws java.sql.SQLException
Check if a table exists in the database.

Throws:
java.sql.SQLException

checkCreateTable

public static void checkCreateTable(java.sql.Connection con,
                                    java.lang.String tableName,
                                    java.lang.String createStatement)
                             throws java.sql.SQLException
Check if the table exists. If not, it will be created

This method does only check if the table name exists. It does not check that the table actually matches the create statement

Example

 MetadataUtil.checkCreateTable(con,
     "Customer",
     "CREATE TABLE Customer ("
     + " Id INTEGER,"
     + " Name TEXT"
     + ")");
 

Parameters:
tableName - name of table
createStatement - table definition.
Throws:
java.sql.SQLException


Copyright © 2000-2004 Backsource. All Rights Reserved.