query
Class QueryCheck

java.lang.Object
  extended by query.QueryCheck

 class QueryCheck
extends java.lang.Object

Uses the catalogs to perform final type checking for query statements.


Constructor Summary
private QueryCheck()
          Private constructor (static class).
 
Method Summary
static int columnExists(Schema schema, java.lang.String columnName)
          Checks whether a column exists.
static void fileNotExists(java.lang.String fileName)
          Checks whether a file name does not exist.
static void indexExists(java.lang.String indexName)
          Checks whether an index exists.
static void insertValues(Schema schema, java.lang.Object[] values)
          Checks whether values to insert matches the table schema.
static void predicates(Schema schema, Predicate[][] preds)
          Checks whether selection predicates (in CNF) match the given schema.
static Schema tableExists(java.lang.String tableName)
          Checks whether a table exists.
static int[] updateFields(Schema schema, java.lang.String[] fields)
          Checks whether field to update match the table schema.
static void updateValues(Schema schema, int[] fldnos, java.lang.Object[] values)
          Checks whether values to update matches the table schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryCheck

private QueryCheck()
Private constructor (static class).

Method Detail

fileNotExists

public static void fileNotExists(java.lang.String fileName)
                          throws QueryException
Checks whether a file name does not exist.

Throws:
QueryException

tableExists

public static Schema tableExists(java.lang.String tableName)
                          throws QueryException
Checks whether a table exists.

Returns:
schema of the table
Throws:
QueryException

indexExists

public static void indexExists(java.lang.String indexName)
                        throws QueryException
Checks whether an index exists.

Throws:
QueryException

columnExists

public static int columnExists(Schema schema,
                               java.lang.String columnName)
                        throws QueryException
Checks whether a column exists.

Returns:
field number of the column
Throws:
QueryException

insertValues

public static void insertValues(Schema schema,
                                java.lang.Object[] values)
                         throws QueryException
Checks whether values to insert matches the table schema.

Throws:
QueryException - if wrong number of columns or invalid values

updateFields

public static int[] updateFields(Schema schema,
                                 java.lang.String[] fields)
                          throws QueryException
Checks whether field to update match the table schema.

Returns:
the field numbers of the columns to update.
Throws:
QueryException - if a column name doesn't exist

updateValues

public static void updateValues(Schema schema,
                                int[] fldnos,
                                java.lang.Object[] values)
                         throws QueryException
Checks whether values to update matches the table schema.

Throws:
QueryException - if wrong number of columns or invalid values

predicates

public static void predicates(Schema schema,
                              Predicate[][] preds)
                       throws QueryException
Checks whether selection predicates (in CNF) match the given schema.

Throws:
QueryException - if any predicates are invalid