public class DBQuery extends DBRowSet
Modifier and Type | Field and Description |
---|---|
protected String |
alias |
protected DBCommandExpr |
cmdExpr |
protected DBColumn[] |
keyColumns |
protected DBQueryColumn[] |
queryColumns |
columnReferences, columns, comment, db, log, primaryKey, timestampColumn
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESES, CTX_VALUE
Constructor and Description |
---|
DBQuery(DBCommandExpr cmd)
Creaes a DBQuery object from a given command object.
|
DBQuery(DBCommandExpr cmd,
DBColumn keyColumn)
Constructs a new DBQuery object initialize the query object.
|
DBQuery(DBCommandExpr cmd,
DBColumn[] keyColumns)
Constructor initializes the query object.
|
DBQuery(DBCommandExpr cmd,
DBColumn[] keyColumns,
String alias)
Constructor initializes the query object.
|
DBQuery(DBCommandExpr cmd,
DBColumn keyColumn,
String alias)
Constructs a new DBQuery object initialize the query object.
|
DBQuery(DBCommandExpr cmd,
String alias)
Creaes a DBQuery object from a given command object.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
addJoinRestriction(DBCommand upd,
DBColumn updCol,
DBColumn keyCol,
DBColumn[] keyColumns,
DBRecord rec)
Adds join restrictions to the supplied command object.
|
void |
addSQL(StringBuilder buf,
long context)
Adds the select SQL Command of this object to the specified StringBuilder object.
|
DBQueryColumn |
column(DBColumnExpr expr)
This is a convenience shortcut for findQueryColumn
|
DBQueryColumn |
column(String name)
This is a convenience shortcut for findQueryColumn
|
protected DBQueryColumn |
createQueryColumn(DBColumnExpr expr)
factory method for column expressions in order to allow overrides
|
void |
createRecord(DBRecord rec,
Connection conn)
Returns an error, because it is not possible to add a record to a query.
|
void |
deleteRecord(Object[] keys,
Connection conn)
Deletes a record identified by its primary key from the database.
|
DBQueryColumn |
findQueryColumn(DBColumnExpr expr)
This function provides the query column object for a particular query command expression
|
DBQueryColumn |
findQueryColumn(String name)
This function provides the query column object for a particular query command expression
|
String |
getAlias()
not applicable - returns null
|
DBCommandExpr |
getCommandExpr()
returns the underlying command expression
|
protected DBCommand |
getCommandFromExpression()
returns the command from the underlying command expression or throws an exception
|
DBColumn[] |
getKeyColumns()
return query key columns
|
String |
getName()
not applicable - returns null
|
DBQueryColumn[] |
getQueryColumns()
Gets all columns of this rowset (e.g. for cmd.select()).
|
Object[] |
getRecordKey(DBRecord record)
Returns a array of primary key columns by a specified DBRecord object.
|
void |
initRecord(DBRecord rec,
Object[] keyValues,
boolean insert)
Initialize specified DBRecord object with primary key
columns (the Object[] keyValues).
|
boolean |
isUpdateable()
Returns whether or not the table supports record updates.
|
void |
readRecord(DBRecord rec,
Object[] key,
Connection conn)
Creates a select SQL-Command of the query call the InitRecord method to execute the SQL-Command.
|
void |
updateRecord(DBRecord rec,
Connection conn)
Updates a query record by creating individual update commands for each table.
|
addColumnReference, addReferencedColumns, completeInitRecord, count, deleteAllReferences, deleteRecord, deleteReferenceRecords, equals, findById, getColumn, getColumn, getColumnIndex, getColumnIndex, getColumnReferences, getColumns, getComment, getDatabase, getFullName, getId, getRenameTablePhrase, getTimestampColumn, hashCode, initRecord, isColumnReadOnly, isKeyColumn, prepareInitRecord, readRecord, recordExists, recordExists, setComment, setKeyConstraints, setTimestampColumn
getObjectValue, getValueClass
protected final DBCommandExpr cmdExpr
protected final DBColumn[] keyColumns
protected final DBQueryColumn[] queryColumns
protected final String alias
public DBQuery(DBCommandExpr cmd, DBColumn[] keyColumns, String alias)
cmd
- the SQL-CommandkeyColumns
- an array of the primary key columnsthe
- query aliaspublic DBQuery(DBCommandExpr cmd, DBColumn[] keyColumns)
cmd
- the SQL-CommandkeyColumns
- an array of the primary key columnspublic DBQuery(DBCommandExpr cmd, DBColumn keyColumn, String alias)
cmd
- the SQL-CommandkeyColumn
- the primary key columnthe
- query aliaspublic DBQuery(DBCommandExpr cmd, DBColumn keyColumn)
cmd
- the SQL-CommandkeyColumn
- the primary key columnpublic DBQuery(DBCommandExpr cmd, String alias)
cmd
- the command object representing an SQL-Command.the
- query aliaspublic DBQuery(DBCommandExpr cmd)
cmd
- the command object representing an SQL-Command.public DBCommandExpr getCommandExpr()
public String getName()
public String getAlias()
public boolean isUpdateable()
isUpdateable
in class DBRowSet
public DBQueryColumn[] getQueryColumns()
public DBQueryColumn findQueryColumn(DBColumnExpr expr)
expr
- the DBColumnExpr objectpublic DBQueryColumn findQueryColumn(String name)
the
- column namepublic DBQueryColumn column(DBColumnExpr expr)
expr
- the DBColumnExpr objectpublic DBQueryColumn column(String name)
the
- column namepublic DBColumn[] getKeyColumns()
getKeyColumns
in class DBRowSet
public Object[] getRecordKey(DBRecord record)
getRecordKey
in class DBRowSet
record
- the DBRecord object, contains all fields and the field propertiespublic void addSQL(StringBuilder buf, long context)
public void initRecord(DBRecord rec, Object[] keyValues, boolean insert)
initRecord
in class DBRowSet
rec
- the Record objectkeyValues
- an array of the primary key columnspublic void createRecord(DBRecord rec, Connection conn)
createRecord
in class DBRowSet
rec
- the DBRecord object, contains all fields and the field propertiesconn
- a valid database connectionNotImplementedException
- because this is not implementedpublic void readRecord(DBRecord rec, Object[] key, Connection conn)
readRecord
in class DBRowSet
rec
- the DBRecord object, contains all fields and the field propertieskey
- an array of the primary key columnsconn
- a valid connection to the database.public void updateRecord(DBRecord rec, Connection conn)
updateRecord
in class DBRowSet
rec
- the DBRecord object. contains all fields and the field propertiesconn
- a valid connection to the database.public void deleteRecord(Object[] keys, Connection conn)
deleteRecord
in class DBRowSet
keys
- array of primary key valuesconn
- a valid database connectionprotected boolean addJoinRestriction(DBCommand upd, DBColumn updCol, DBColumn keyCol, DBColumn[] keyColumns, DBRecord rec)
protected DBCommand getCommandFromExpression()
protected DBQueryColumn createQueryColumn(DBColumnExpr expr)
expr
- Copyright © 2008–2018 Apache Software Foundation. All rights reserved.