com.strangelight.db
Class Database

java.lang.Object
  |
  +--com.strangelight.db.Database

public class Database
extends java.lang.Object

Encapsulates the strangelight.com database as a whole.


Method Summary
static java.sql.Connection get_connection()
          obtains a java.sql.Connection object for the strangelight.com database.
protected static java.lang.String sql_escape(java.lang.String s)
          a utility method for escaping strings for inclusion in SQL queries.
protected static java.lang.String sql_quote(java.lang.Object object)
          a utility method for embedding Java objects into SQL queries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get_connection

public static java.sql.Connection get_connection()
obtains a java.sql.Connection object for the strangelight.com database. [Currently uses hard-coded database settings, but could easily be modified to get its settings from a configuration file.]

Returns:
a connection to the strangelight.com database.

sql_escape

protected static java.lang.String sql_escape(java.lang.String s)
a utility method for escaping strings for inclusion in SQL queries. Converts \ and ' characters to \\ and \', respectively. Also converts null values to empty strings.

Parameters:
s - the String to escape.
Returns:
a String with \ and ' characters converted to \\ and \', respectively, or an empty string if s was null.

sql_quote

protected static java.lang.String sql_quote(java.lang.Object object)
a utility method for embedding Java objects into SQL queries.

Parameters:
object - the Object to embed.
Returns:
a String representation of the object, surrounded by ' (single-quote) characters, or the String literal "NULL" if object was null.