stdmql.dbmanager
Class DBManager

java.lang.Object
  extended by stdmql.dbmanager.DBManager

public class DBManager
extends java.lang.Object

This is the class which interact with the database layer, therefore it is used to (i) execute a query, (ii) initialize a table and (iii) store the data


Field Summary
 java.lang.Object[] bindVars
          This is the buffer used to store the data, it is an object array because the interpretation of this buffer depends on the type of storing that will be used
 
Constructor Summary
DBManager()
          It constructs a DBManager instance when M-Atlas is initialized.
 
Method Summary
 Query execQuery(java.lang.String query)
           
 void initStore(java.lang.String table_name, java.lang.String fieldDefinition)
           
 void initStore(java.lang.String table_name, java.lang.String fieldDefinition, TranslationLibrary tl)
           
 void initStore(TranslationLibrary tl, java.lang.String table_name)
           
 void initStore(TranslationLibrary tl, java.lang.String table_name, boolean append)
           
 void setComment(java.lang.String table_name, java.lang.String s)
           
 void setNewBuffer(java.lang.Object[] buffer)
           
 void storeData(java.lang.String name)
           
 void storeData(java.lang.String name, boolean complex)
           
 void storeData(java.lang.String name, int idbase)
           
 void storeData(java.lang.String name, java.lang.Object[] ids)
           
 void storeDataClob(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bindVars

public java.lang.Object[] bindVars
This is the buffer used to store the data, it is an object array because the interpretation of this buffer depends on the type of storing that will be used

Constructor Detail

DBManager

public DBManager()
          throws java.sql.SQLException,
                 java.io.IOException
It constructs a DBManager instance when M-Atlas is initialized.

Throws:
java.sql.SQLException
java.io.IOException
Method Detail

execQuery

public Query execQuery(java.lang.String query)
                throws java.sql.SQLException
Parameters:
query - The query to be executed
Returns:
A Query object which contains the resultset and other information about the execution Execute a query enclosing it in a database transaction.
Throws:
java.sql.SQLException

setNewBuffer

public void setNewBuffer(java.lang.Object[] buffer)
Parameters:
buffer - is the buffer which contains the data to be stored Set the new buffer which will be used during the storing call

setComment

public void setComment(java.lang.String table_name,
                       java.lang.String s)
Parameters:
table_name - the name of the table where to put the comment
s - the comment to be attached on the table It set a comment on a specific table

initStore

public void initStore(java.lang.String table_name,
                      java.lang.String fieldDefinition,
                      TranslationLibrary tl)
               throws java.sql.SQLException,
                      java.io.IOException
Parameters:
table_name - the name of the table to be initialized
fieldDefinition - the list of fields of the table with the open parenthesis. Ex. "(id text, speed numeric"
tl - the translation library object which will be used as last field of the table It initialize (or replace) a table which is composed by a set of standard fields and a complex type specified by the translation library
Throws:
java.sql.SQLException
java.io.IOException

initStore

public void initStore(java.lang.String table_name,
                      java.lang.String fieldDefinition)
               throws java.sql.SQLException,
                      java.io.IOException
Parameters:
table_name - the name of the table to be initialized
fieldDefinition - the list of fields of the table. Ex. "(id text, speed numeric)" It initialize (or replace) a table which is composed by a set of standard fields.
Throws:
java.sql.SQLException
java.io.IOException

initStore

public void initStore(TranslationLibrary tl,
                      java.lang.String table_name)
               throws java.sql.SQLException,
                      java.io.IOException
Parameters:
table_name - the name of the table to be initialized
tl - the translation library object which will be used as field of the table It initialize (or replace) a table which is composed by two fields: id (text type) and the complex object specified by the translation library
Throws:
java.sql.SQLException
java.io.IOException

initStore

public void initStore(TranslationLibrary tl,
                      java.lang.String table_name,
                      boolean append)
               throws java.sql.SQLException,
                      java.io.IOException
Parameters:
table_name - the name of the table to be initialized
tl - the translation library object which will be used as field of the table It initialize if not exist yet, a table which is composed by two fields: id (text type) and the complex object specified by the translation library
Throws:
java.sql.SQLException
java.io.IOException

storeData

public void storeData(java.lang.String name)
               throws java.sql.SQLException
Parameters:
name - the name of the table where the data will be stored Store the data which is already in the buffet (see setNewBuffer method). The buffer must contain the values to be stored in the proper format (i.e. text must be enclosed by ' character)
Throws:
java.sql.SQLException

storeDataClob

public void storeDataClob(java.lang.String name)
                   throws java.sql.SQLException
Parameters:
name - the name of the table where the data will be stored Store the data which is already in the buffet (see setNewBuffer method) using a prepared statement. The buffer must contain the values to be stored in the proper format (i.e. text must be enclosed by ' character)
Throws:
java.sql.SQLException

storeData

public void storeData(java.lang.String name,
                      int idbase)
               throws java.sql.SQLException
Parameters:
name - the name of the table where the data will be stored
idbase - the staring value of the ids Store the data which is already in the buffet (see setNewBuffer method) adding automatically a progressive id in the first column. The buffer must contain the values to be stored in the proper format (i.e. text must be enclosed by ' character)
Throws:
java.sql.SQLException

storeData

public void storeData(java.lang.String name,
                      java.lang.Object[] ids)
               throws java.sql.SQLException
Parameters:
name - the name of the table where the data will be stored
ids - the ordered list (w.r.t. the objects in the buffer) of ids to be stored Store the data which is already in the buffet (see setNewBuffer method) adding the ids in the first column. The buffer must contain the values to be stored in the proper format (i.e. text must be enclosed by ' character)
Throws:
java.sql.SQLException

storeData

public void storeData(java.lang.String name,
                      boolean complex)
               throws java.sql.SQLException
Parameters:
name - the name of the table where the data will be stored
complex - if a flag used to distinguish this method from the others. Store the data which is already in the buffet (see setNewBuffer method). The buffer must be composed by standard values and a complex type at the end.
Throws:
java.sql.SQLException