org.riverock.dbrevision.utils
Class DbUtils

java.lang.Object
  extended by org.riverock.dbrevision.utils.DbUtils

public class DbUtils
extends Object

Author:
Sergei Maslyukov Date: 14.12.2006 Time: 17:10:38

$Id$


Constructor Summary
DbUtils()
           
 
Method Summary
static void close(Connection conn)
           
static void close(ResultSet rs, Statement st)
           
static void close(Statement st)
           
static Boolean getBoolean(ResultSet rs, String f)
          String f - name of field
static Boolean getBoolean(ResultSet rs, String f, Boolean def)
           
static Integer getInteger(ResultSet rs, String f)
          ResultSet rs - ResultSet String f - name of field
static Integer getInteger(ResultSet rs, String f, Integer def)
          ResultSet rs - ResultSet String f - name of field int def - default value
static Long getLong(ResultSet rs, String f)
          String f - name of field
static Long getLong(ResultSet rs, String f, Long def)
           
static Long getLongValue(Connection conn, String sql, Object[] params, int[] types)
          Get result of query as Long
static String getString(ResultSet rs, String f)
          ResultSet rs - ResultSet String f - name of field
static String getString(ResultSet rs, String f, String def)
          ResultSet rs - ResultSet String f - name of field String def - default value
static int runSQL(Connection conn, String query, Object[] params, int[] types)
          выполнить sql
static void setLong(PreparedStatement ps, int index, Long data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbUtils

public DbUtils()
Method Detail

getLongValue

public static Long getLongValue(Connection conn,
                                String sql,
                                Object[] params,
                                int[] types)
                         throws SQLException
Get result of query as Long

Parameters:
conn - db connection
sql - query string
params - query parameters
types - parameters types
Returns:
Long result
Throws:
SQLException - on error

runSQL

public static int runSQL(Connection conn,
                         String query,
                         Object[] params,
                         int[] types)
                  throws SQLException
выполнить sql

Parameters:
conn - connection
query - sql
params - parameters
types - types of parameters
Returns:
int count of updated records
Throws:
SQLException - on error

setLong

public static void setLong(PreparedStatement ps,
                           int index,
                           Long data)
                    throws SQLException
Throws:
SQLException

getBoolean

public static Boolean getBoolean(ResultSet rs,
                                 String f)
                          throws SQLException
String f - name of field

Parameters:
rs - ResultSet
f - name of field
Returns:
value as Long
Throws:
SQLException - on error

getBoolean

public static Boolean getBoolean(ResultSet rs,
                                 String f,
                                 Boolean def)
                          throws SQLException
Parameters:
rs - - ResultSet
f - - name of field
def - - default value
Returns:
value of column as Long
Throws:
SQLException - on error

getLong

public static Long getLong(ResultSet rs,
                           String f)
                    throws SQLException
String f - name of field

Parameters:
rs - ResultSet
f - name of field
Returns:
value as Long
Throws:
SQLException - on error

getLong

public static Long getLong(ResultSet rs,
                           String f,
                           Long def)
                    throws SQLException
Parameters:
rs - - ResultSet
f - - name of field
def - - default value
Returns:
value of column as Long
Throws:
SQLException - on error

getInteger

public static Integer getInteger(ResultSet rs,
                                 String f)
                          throws SQLException
ResultSet rs - ResultSet String f - name of field

Throws:
SQLException

getInteger

public static Integer getInteger(ResultSet rs,
                                 String f,
                                 Integer def)
                          throws SQLException
ResultSet rs - ResultSet String f - name of field int def - default value

Throws:
SQLException

getString

public static String getString(ResultSet rs,
                               String f)
                        throws SQLException
ResultSet rs - ResultSet String f - name of field

Throws:
SQLException

getString

public static String getString(ResultSet rs,
                               String f,
                               String def)
                        throws SQLException
ResultSet rs - ResultSet String f - name of field String def - default value

Throws:
SQLException

close

public static void close(ResultSet rs,
                         Statement st)

close

public static void close(Statement st)

close

public static void close(Connection conn)


Copyright © 2008 Riverock community. All Rights Reserved.