|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectproper.core.ProperObject
proper.database.ConnectorObject
proper.relaggs.SqlEngine
public class SqlEngine
Title: SqlEngine
Description: Connection to database system.
Changelog:
RelaggsAttribute
,
RelaggsDatabase
,
RelaggsTable
Field Summary | |
---|---|
static java.lang.String |
UNKNOWN_TYPE
used for unknown column types |
static boolean |
USE_BUILTIN_STDDEV
whether to use the database dependent STDDEV function |
static boolean |
USE_SAMPLE_STDDEV
whether to use sample or population STDDEV |
Fields inherited from interface proper.core.ProperInterface |
---|
VERSION |
Constructor Summary | |
---|---|
SqlEngine(Connector conn)
Creates the interface between database and userinterface. |
Method Summary | |
---|---|
void |
addAggregatedAttributes(RelaggsTable dest_table,
RelaggsTable source_table,
RelaggsStructure struct,
Join join)
Adds the aggregated attributes to the relaggs table. FracPete: - introduced HashSet to skip duplicate columns and
also that there are not too many columns inserted- ADD COLUMN split into single statements (necessary for ANSI SQL!) |
java.lang.String |
aggregateAttributes(RelaggsTable main,
RelaggsTable aggr,
Join join,
int number)
Combines two tables 'main' and 'aggr' by adding the aggregated columns of table 'aggr' to table main. FracPete: can perform LEFT OUTER JOIN, CREATE TABLE statement now more ANSI compliant |
void |
dropTable(java.lang.String table)
Drops a table from the database. |
RelaggsStructure |
getAttributes(RelaggsTable table,
RelaggsAttribute attribute)
Reads the attributes of the given table into the RelaggsStructure. |
java.util.Vector |
getDatabases()
Returns the available databases. |
boolean |
getLeftOuterJoin()
returns whether we use natural or left outer joins during aggregation |
java.lang.String |
getLimit()
returns the LIMIT statement (unprocessed) |
java.lang.String |
getLimit(int rows)
returns the LIMIT statement for the given number of rows |
int |
getMaxColumnCount()
returns the max number of columns for table, -1 if error |
java.util.Vector |
getPrimaryKeys(java.lang.String table)
Returns a Vector containing the primary keys of the table. |
static java.lang.String |
getStddev(java.lang.String colName)
returns the stddev statement for the given column |
RelaggsTable |
getTable(java.lang.String name)
Creates a RelaggsTable object containing the table information (attributes, primary keys). |
java.lang.String |
getTableCreateFromSelect(java.lang.String table,
java.lang.String sql)
generates a CREATE TABLE statement from the given select statement. |
java.util.Vector |
getTables()
Deprecated. replaced by SqlEngine.getMetaData() |
java.lang.String |
getTargetField()
returns the field used as class in Weka |
java.lang.String |
getTargetTable()
returns the table that contains the column used as class in Weka |
int |
getTmpNumber()
Returns the number for a new temporary table. |
static java.lang.String |
getTypeString(int type,
int size)
returns the definition of a type, used in CREATE TABLE |
boolean |
getUseAnyIndex()
returns whether we use the primary key or any index for determining the relation between the tables |
boolean |
getUseForeignKeys()
returns whether to use "real" foreign key relations or base the table relation on column names |
java.lang.String |
getUseIndex()
returns the index to use (primary = "", name otherwise) |
void |
incTmpNumber()
Increments the number for a new temporary table by 1. |
boolean |
indexMatches(java.lang.String index)
checks whether the given index matches the index we want to use; if useIndex = "" then all indices match |
void |
info()
Displays information about the server, the driver, etc. |
void |
renameTable(java.lang.String old_name,
java.lang.String new_name)
Renames a table of the database. |
void |
setColumns(RelaggsTable table)
sets the columns in this table |
void |
setExcludedTables(java.lang.String tables)
sets the tables (comma separated) that shall not be included in the aggregation process |
void |
setLeftOuterJoin(boolean leftOuterJoin)
whether to use natural or left outer joins during aggregation. |
void |
setTargetField(java.lang.String targetField)
sets the field used as class in Weka |
void |
setTargetTable(java.lang.String targetTable)
sets the table that contains the column used as class in Weka |
void |
setTmpNumber(int value)
Sets the number for a new temporary table. |
void |
setUseAnyIndex(boolean use)
whether to use the primary key or any index for determining the relation between the tables |
void |
setUseForeignKeys(boolean use)
whether to use "real" foreign key relations or base the table relation on column names |
void |
setUseIndex(java.lang.String index)
whether to use the primary key (= "") or a special one (!= ""). |
Methods inherited from class proper.database.ConnectorObject |
---|
getConnector |
Methods inherited from class proper.core.ProperObject |
---|
addListener, addOutput, classInVerbose, debugprint, debugprint, debugprint, debugprint, debugprintln, debugprintln, debugprintln, debugprintln, debugprintln, getListeners, getRuntime, getVerbose, getVerboseLevel, getVerboseLevelForClass, getVerboseString, getVerboseStringForClass, notifyListener, notifyListeners, print, print, print, print, println, println, println, println, println, printMemory, removeListener, setOutput, setVerbose, setVerboseLevel, setVerboseString, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean USE_BUILTIN_STDDEV
public static final boolean USE_SAMPLE_STDDEV
public static final java.lang.String UNKNOWN_TYPE
getTypeString(int, int)
,
Constant Field ValuesConstructor Detail |
---|
public SqlEngine(Connector conn)
conn
- the connection to the databaseMethod Detail |
---|
public void info()
public void setTmpNumber(int value)
value
- the new numberpublic void incTmpNumber()
public int getTmpNumber()
public void setLeftOuterJoin(boolean leftOuterJoin)
setUseAnyIndex(boolean)
public boolean getLeftOuterJoin()
public void setUseAnyIndex(boolean use)
public boolean getUseAnyIndex()
public void setUseForeignKeys(boolean use)
public boolean getUseForeignKeys()
public void setUseIndex(java.lang.String index)
setUseAnyIndex(boolean)
public java.lang.String getUseIndex()
public boolean indexMatches(java.lang.String index)
index
- the index to check
public void setTargetTable(java.lang.String targetTable)
public java.lang.String getTargetTable()
public void setTargetField(java.lang.String targetField)
public java.lang.String getTargetField()
public void setExcludedTables(java.lang.String tables)
public int getMaxColumnCount()
public void setColumns(RelaggsTable table)
public java.lang.String getLimit()
public java.lang.String getLimit(int rows)
public java.util.Vector getDatabases()
public java.util.Vector getTables()
SqlEngine.getMetaData()
public java.util.Vector getPrimaryKeys(java.lang.String table)
table
- the name of the table
public RelaggsTable getTable(java.lang.String name)
name
- the name of the table
public static java.lang.String getTypeString(int type, int size)
type
- the JDBC typesize
- the display sizeUNKNOWN_TYPE
public java.lang.String getTableCreateFromSelect(java.lang.String table, java.lang.String sql) throws java.lang.Exception
table
- the name of the table to createsql
- the select statement to retrieve the column
definitions from
java.lang.Exception
- throws an exception if something with the
select-statement went wrongpublic java.lang.String aggregateAttributes(RelaggsTable main, RelaggsTable aggr, Join join, int number)
main
- the table whose columns remain untouchedaggr
- the table whose aggregated columns should be addedjoin
- the foreign key relationnumber
- the actual number of the next temporary table
public static java.lang.String getStddev(java.lang.String colName)
USE_BUILTIN_STDDEV
,
USE_SAMPLE_STDDEV
public RelaggsStructure getAttributes(RelaggsTable table, RelaggsAttribute attribute) throws java.lang.IllegalArgumentException
table
- the table that should be aggregatedattribute
- the foreign key attribute that is used for the
aggregation
java.lang.IllegalArgumentException
public void addAggregatedAttributes(RelaggsTable dest_table, RelaggsTable source_table, RelaggsStructure struct, Join join)
HashSet
to skip duplicate columns and
also that there are not too many columns inserted
dest_table
- the relaggs table in which the aggregated
attributes should be insertedsource_table
- the table from which the aggregated attributes
comestruct
- the RelaggsStructure containing the aggregation
valueskey_attribute
- the foreign key attribute of the source tablepublic void dropTable(java.lang.String table)
table
- the name of table to droppublic void renameTable(java.lang.String old_name, java.lang.String new_name)
old_name
- the old name of the tablenew_name
- the new name of the table
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |