Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## baseCode.db
Class Handle

    java.lang.Object
      baseCode.db.Handle

public class Handle
extends java.lang.Object

Database handle container and query convenience functions.

Copyright (c) 2004

Institution: Columbia University

Version:
  $Id: Handle.java,v 1.6 2005/01/12 19:10:46 pavlidis Exp $
Author:
  Paul Pavlidis

Constructor Summary
`Handle()`
`Handle(java.lang.String host, java.lang.String database)`
`Handle(java.lang.String host, java.lang.String database, java.lang.String user, java.lang.String password)`

Method Summary
`void` | `closeCon()` Close the database connection.
`java.sql.Connection` | `getCon()`
`java.sql.Statement` | `newStatement()`
`java.sql.PreparedStatement` | `prepareStatement(java.lang.String query)`
`java.lang.Double` | `queryToDouble(java.lang.String query)`
`java.lang.Integer` | `queryToInt(java.lang.String query)`
`java.util.List` | `queryToList(java.lang.String query)`
`java.util.Map` | `queryToMap(java.lang.String query)`
`java.util.Set` | `queryToSet(java.lang.String query)`
`java.lang.String` | `queryToString(java.lang.String query)`
`java.lang.String` | `quote(java.lang.String k)`
`java.sql.ResultSet` | `runQuery(java.lang.String query)`
`int` | `runUpdateQuery(java.lang.String query)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Handle

    public Handle(java.lang.String host,
                  java.lang.String database,
                  java.lang.String user,
                  java.lang.String password)
           throws java.sql.SQLException

Parameters:
  `host` - String
  `database` - String
  `user` - String
  `password` - String
Throws:
  `java.sql.SQLException`

### Handle

    public Handle()
           throws java.sql.SQLException

### Handle

    public Handle(java.lang.String host,
                  java.lang.String database)
           throws java.sql.SQLException

Method Detail

### getCon

    public java.sql.Connection getCon()

  Returns:
    java.sql.Connection

### quote

    public java.lang.String quote(java.lang.String k)
                           throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### newStatement

    public java.sql.Statement newStatement()
                                    throws java.sql.SQLException

  Returns:
    java.sql.Statement
  Throws:
    `java.sql.SQLException`

### closeCon

    public void closeCon()

  Close the database connection.

### runUpdateQuery

    public int runUpdateQuery(java.lang.String query)
                       throws java.sql.SQLException

  Parameters:
    `query` - String
  Returns:
    int
  Throws:
    `java.sql.SQLException`

### runQuery

    public java.sql.ResultSet runQuery(java.lang.String query)
                                throws java.sql.SQLException

  Parameters:
    `query` - String
  Returns:
    java.sql.ResultSet
  Throws:
    `java.sql.SQLException`

### prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String query)
                                                throws java.sql.SQLException

  Parameters:
    `query` - String
  Returns:
    java.sql.PreparedStatement
  Throws:
    `java.sql.SQLException`

### queryToMap

    public java.util.Map queryToMap(java.lang.String query)
                             throws java.sql.SQLException

  Parameters:
    `query` - String
  Returns:
    java.util.Map
  Throws:
    `java.sql.SQLException`

### queryToSet

    public java.util.Set queryToSet(java.lang.String query)
                             throws java.sql.SQLException

  Parameters:
    `query` - String
  Returns:
    java.util.Set
  Throws:
    `java.sql.SQLException`

### queryToList

    public java.util.List queryToList(java.lang.String query)
                               throws java.sql.SQLException

  Parameters:
    `query` - String
  Returns:
    java.util.List
  Throws:
    `java.sql.SQLException`

### queryToInt

    public java.lang.Integer queryToInt(java.lang.String query)
                                 throws java.sql.SQLException

  Parameters:
    `query` - String
  Returns:
    Object containing the first result obtained. If no result, it return null.
  Throws:
    `java.sql.SQLException`

### queryToDouble

    public java.lang.Double queryToDouble(java.lang.String query)
                                   throws java.sql.SQLException

  Parameters:
    `query` - String
  Returns:
    java.lang.Double
  Throws:
    `java.sql.SQLException`

### queryToString

    public java.lang.String queryToString(java.lang.String query)
                                   throws java.sql.SQLException

  Parameters:
    `query` - String
  Returns:
    java.lang.String
  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2005 Columbia University. All Rights Reserved.