com.fatwire.gst.foundation.facade.sql
Class SqlHelper

java.lang.Object
  extended by com.fatwire.gst.foundation.facade.sql.SqlHelper

public class SqlHelper
extends Object

A helper class over ICS.SQL

Author:
Dolf Dijkstra
See Also:
ICS.SQL(String, String, String, int, boolean, boolean, StringBuffer)

Method Summary
static void execute(COM.FutureTense.Interfaces.ICS ics, String table, String sql)
          Executes sql statements, other then SELECT statements.
static String quote(String s)
          Quote a string for use in a SQL statement.
static IListIterable select(COM.FutureTense.Interfaces.ICS ics, com.fatwire.cs.core.db.PreparedStmt stmt, com.fatwire.cs.core.db.StatementParam param)
          Executes a PreparedStatement
static IListIterable select(COM.FutureTense.Interfaces.ICS ics, String table, String sql)
          facade over ICS.SQL

limit =-1;

bCache=true;

clears errno before ics.SQL

no IList registered in ics variable space

static IListIterable select(COM.FutureTense.Interfaces.ICS ics, String table, String sql, int limit)
          Executes an ICS.SQL operation with a limit.
static IListIterable selectSimplePrepared(COM.FutureTense.Interfaces.ICS ics, String table, String sql, Object... value)
          Executes a PreparedStatement in a simple form.
static Row selectSingle(COM.FutureTense.Interfaces.ICS ics, com.fatwire.cs.core.db.PreparedStmt stmt, com.fatwire.cs.core.db.StatementParam param)
          Executes a PreparedStatement, returning a single row
static Row selectSingle(COM.FutureTense.Interfaces.ICS ics, String table, String sql)
          Executes an ICS.SQL operation, returning a single Row, or null if no result was returned by ICS.SQL.
static boolean tableExists(COM.FutureTense.Interfaces.ICS ics, String table)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

select

public static final IListIterable select(COM.FutureTense.Interfaces.ICS ics,
                                         String table,
                                         String sql)
facade over ICS.SQL

limit =-1;

bCache=true;

clears errno before ics.SQL

no IList registered in ics variable space

Parameters:
ics -
table - tablename
sql - the sql statement, needs to start with 'select'
Returns:
never null, always an IListIterable
Throws:
RuntimeException - if errno is not zero or not -101
See Also:
select(ICS, String, String, int)

select

public static final IListIterable select(COM.FutureTense.Interfaces.ICS ics,
                                         String table,
                                         String sql,
                                         int limit)
Executes an ICS.SQL operation with a limit.

Parameters:
ics -
table - tablename
sql - the sql statement, needs to start with 'select'
limit - maximum number of rows to return
Returns:
never null, always an IListIterable
See Also:
ICS.SQL(String, String, String, int, boolean, StringBuffer)

execute

public static final void execute(COM.FutureTense.Interfaces.ICS ics,
                                 String table,
                                 String sql)
Executes sql statements, other then SELECT statements.

flushes the table (ics.FlushCatalog()) after the statement execution

Parameters:
ics -
table - tablename
sql - the sql statement, can not start with "select"

select

public static final IListIterable select(COM.FutureTense.Interfaces.ICS ics,
                                         com.fatwire.cs.core.db.PreparedStmt stmt,
                                         com.fatwire.cs.core.db.StatementParam param)
Executes a PreparedStatement

Parameters:
ics -
stmt - the PreparedStatement
param - the statement parameters
Returns:
never null, always an IListIterable

selectSimplePrepared

public static final IListIterable selectSimplePrepared(COM.FutureTense.Interfaces.ICS ics,
                                                       String table,
                                                       String sql,
                                                       Object... value)
Executes a PreparedStatement in a simple form. The values are simply mapped based on order and type to prepared statement parameters.

Parameters:
ics -
table - tablename
sql - the sql statement
value - the values for the prepared statement parameters.
Returns:
never null, always an IListIterable

selectSingle

public static final Row selectSingle(COM.FutureTense.Interfaces.ICS ics,
                                     com.fatwire.cs.core.db.PreparedStmt stmt,
                                     com.fatwire.cs.core.db.StatementParam param)
Executes a PreparedStatement, returning a single row

Parameters:
ics - the Content Server context
stmt - the PreparedStatement
param - the statement parameters
Returns:
Row if resultset is returned, otherwise null

selectSingle

public static final Row selectSingle(COM.FutureTense.Interfaces.ICS ics,
                                     String table,
                                     String sql)
Executes an ICS.SQL operation, returning a single Row, or null if no result was returned by ICS.SQL.

Parameters:
ics -
table - tablename
sql - the sql statement, needs to start with 'select'
Returns:
Row if resultset is returned, otherwise null

quote

public static final String quote(String s)
Quote a string for use in a SQL statement.

Parameters:
s - string to quote
Returns:
quoted string. Null strings are returned simply as ''.

tableExists

public static boolean tableExists(COM.FutureTense.Interfaces.ICS ics,
                                  String table)


Copyright © 2010-2013 Oracle Corporation. All Rights Reserved.