appli.sqlplayer.util
Class SQLQuery

java.lang.Object
  extended byappli.sqlplayer.util.SQLQuery

public class SQLQuery
extends java.lang.Object

Manages the SQL queries

Version:
2.0 Adaptation to CDS requirements and tools
, 2.1 July 2003 (SJ) : ajout des methodes executeQuery et executeUpdate, 2.2 Dec 2003 (MW) : supprime l'utilisation de fichier temporaire
Author:
Alexander Schatten (T.U. Wien), Marc Wenger/CDS, Sylvaine Jaehn

Field Summary
private  java.sql.Connection con
           
private  Database database
           
private  java.sql.DatabaseMetaData databaseMetaData
           
static java.lang.String MESSAGEOK
           
private  java.lang.String sqlCommand
           
private  java.sql.Statement stmt
           
 
Constructor Summary
SQLQuery(Database database)
           
 
Method Summary
 java.lang.Object executeQuery()
          Execution d'une requete de type select
 java.lang.Object executeUpdate()
           
 java.lang.String getDBmetadata()
           
 java.sql.ResultSet getMetadataColumns(java.lang.String tablename)
          Returns a resultSet with the columns information for a given table
 java.sql.ResultSet getMetadataTables()
          Returns a resultSet with the database tables
 java.lang.String getSqlCommand()
           
private  void setDBmetadata()
           
 void setSqlCommand(java.lang.String newSqlCommand)
          set SQL command to send to database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

database

private Database database

con

private java.sql.Connection con

stmt

private java.sql.Statement stmt

databaseMetaData

private java.sql.DatabaseMetaData databaseMetaData

sqlCommand

private java.lang.String sqlCommand

MESSAGEOK

public static java.lang.String MESSAGEOK
Constructor Detail

SQLQuery

public SQLQuery(Database database)
Method Detail

setSqlCommand

public void setSqlCommand(java.lang.String newSqlCommand)
set SQL command to send to database

Parameters:
newSqlCommand - valid SQL statement

getSqlCommand

public java.lang.String getSqlCommand()
Returns:
last SQL command

getDBmetadata

public java.lang.String getDBmetadata()
Returns:
Database Metadata

setDBmetadata

private void setDBmetadata()
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

getMetadataTables

public java.sql.ResultSet getMetadataTables()
Returns a resultSet with the database tables

Returns:
the result

getMetadataColumns

public java.sql.ResultSet getMetadataColumns(java.lang.String tablename)
Returns a resultSet with the columns information for a given table

Returns:
the result

executeQuery

public java.lang.Object executeQuery()
Execution d'une requete de type select

Returns:
objet contenant le resultat de la requete ou un message d'erreur

executeUpdate

public java.lang.Object executeUpdate()