|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.contrib.dbwriter.info.SqlDescription
public class SqlDescription
This info object is mainly used for two purposes: the one is the parsed object returned by each message. The other is as an info object for each table in the replication (hold in cache to contain meta information of the table on which to perform the operations (either INSERT, UPDATE or DELETE).
Field Summary | |
---|---|
private boolean |
allowDoubleInserts
|
private java.util.List |
attributeKeys
|
private java.util.Map |
attributes
|
private boolean |
caseSensitive
|
private java.lang.String |
charSet
|
private java.util.List |
columnList
|
private java.lang.String |
command
|
static java.lang.String |
COMMAND_TAG
|
private java.util.Set |
configuredSearchableColumns
if set, it means the configuration has specified which columns have to be used for searches in this table. |
private java.lang.String |
deleteStatementTxt
|
static java.lang.String |
DESC_TAG
|
private boolean |
hasAddedStatements
|
static java.lang.String |
IDENT_TAG
|
private java.lang.String |
identity
|
private I_Info |
info
|
private java.lang.String |
insertStatementTxt
|
private static java.util.logging.Logger |
log
|
static java.lang.String |
ME
|
(package private) static java.lang.String |
OLD_POSTFIX
|
(package private) static java.lang.String |
OLD_PREFIX
|
private I_Parser |
parser
this is only needed for tables which do not have any PK and on updates |
private boolean |
pk
|
private boolean |
pkKnown
|
private boolean |
quoteColumnNames
|
private java.lang.String |
schema
|
private boolean |
schemaKnown
|
private java.lang.String |
updateStatementTxt
|
Constructor Summary | |
---|---|
SqlDescription(I_Info info)
|
Method Summary | |
---|---|
void |
addAttributes(java.util.Map map)
It copies (stores) all entries found in the map into the attributes. |
void |
addColumn(SqlColumn column)
|
private boolean |
canAddColToSearch(SqlColumn sqlCol)
|
void |
clearColumnDescriptions()
|
private java.lang.String |
createInsertStatement(SqlRow row,
java.util.List searchEntries)
|
private java.lang.String |
createSetStatement(SqlRow row,
java.util.List searchEntries)
|
private java.lang.String |
createWhereStatement(SqlRow row,
java.util.List searchEntries)
|
private byte[] |
cutEndIfTooLong(SqlColumn col,
java.lang.String colName,
byte[] val)
|
int |
delete(java.sql.Connection conn,
SqlRow row)
Returns the number of entries deleted |
private java.lang.String |
extractColumnInfo(boolean isSchema)
Used by getSchema and getCatalog. |
ClientProperty |
getAttribute(java.lang.String key)
Returns the requested attribute. |
java.lang.String[] |
getAttributeNames()
|
java.util.Map |
getAttributesClone()
|
java.lang.String |
getCatalog()
Gets the name of the schema. |
SqlColumn |
getColumn(java.lang.String colName)
|
SqlColumn |
getColumnAtPosition(int pos)
Gets the column at position given by pos. |
SqlColumn[] |
getColumns()
|
java.lang.String |
getCommand()
|
java.lang.String |
getCompleteTableName()
|
static java.lang.String |
getDifferences(SqlDescription description1,
SqlDescription description2)
|
private double |
getDouble(ClientProperty prop)
|
java.lang.String |
getIdentity()
|
private long |
getLong(ClientProperty prop)
|
int |
getNumOfColumns()
|
java.lang.String |
getSchema()
Gets the name of the schema. |
private static java.lang.String |
getVal(SqlDescription description,
java.lang.String key)
|
private boolean |
hasPk()
Note this method has only sense when used in such cases where all columns belonging to this description are in the same table. |
int |
insert(java.sql.Connection conn,
SqlRow row)
Returns the number of entries inserted |
private void |
insertIntoStatement(java.sql.PreparedStatement st,
int pos,
ClientProperty prop)
|
private boolean |
isBinaryType(int type)
|
boolean |
isColumnSearchConfigured(java.lang.String column)
|
static void |
main(java.lang.String[] args)
|
private static void |
processMapping(SqlInfo sqlInfo,
I_Mapper mapper)
|
void |
setAttribute(ClientProperty value)
Stores the client property as a new value. |
void |
setAttribute(java.lang.String key,
java.lang.String value)
Stores the String as a new value. |
void |
setCommand(java.lang.String command)
|
void |
setIdentity(java.lang.String identity)
|
private static void |
setVal(SqlDescription description,
java.lang.String key,
java.lang.String val)
|
java.lang.String |
toXml(java.lang.String extraOffset)
|
(package private) java.lang.String |
toXml(java.lang.String extraOffset,
boolean doTruncate)
|
int |
update(java.sql.Connection conn,
SqlRow newRow,
I_Parser parserForOld)
Returns the number of entries updated |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ME
public static final java.lang.String DESC_TAG
public static final java.lang.String IDENT_TAG
public static final java.lang.String COMMAND_TAG
static final java.lang.String OLD_PREFIX
static final java.lang.String OLD_POSTFIX
private java.lang.String identity
private java.lang.String command
private java.util.List columnList
private java.lang.String updateStatementTxt
private java.lang.String deleteStatementTxt
private java.lang.String insertStatementTxt
private boolean hasAddedStatements
private java.util.Map attributes
private java.util.List attributeKeys
private boolean caseSensitive
private boolean quoteColumnNames
private boolean pk
private boolean pkKnown
private boolean schemaKnown
private java.lang.String schema
private java.lang.String charSet
private boolean allowDoubleInserts
private I_Parser parser
private static java.util.logging.Logger log
private I_Info info
private volatile java.util.Set configuredSearchableColumns
Constructor Detail |
---|
public SqlDescription(I_Info info)
Method Detail |
---|
public java.lang.String getSchema()
public java.lang.String getCompleteTableName()
public java.lang.String getCatalog()
private final java.lang.String extractColumnInfo(boolean isSchema)
public java.lang.String[] getAttributeNames()
public void clearColumnDescriptions()
public java.util.Map getAttributesClone()
public ClientProperty getAttribute(java.lang.String key)
key
- the key of the attribute
public void setAttribute(ClientProperty value)
value
- the value to store as an attribute.public void setAttribute(java.lang.String key, java.lang.String value)
value
- the value to store as an attribute.public void addAttributes(java.util.Map map)
map
- private final boolean hasPk()
private final boolean canAddColToSearch(SqlColumn sqlCol)
private final java.lang.String createWhereStatement(SqlRow row, java.util.List searchEntries)
searchEntries
- an empty list. This will be filled with the values of the
entries (ClientProperties) found in the row object: also NULL objects are considered.
and which can be used as search path (either pk or all).
private final java.lang.String createInsertStatement(SqlRow row, java.util.List searchEntries)
searchEntries
- an empty list. This will be filled with the values of the
entries (ClientProperties) found in the row object. Also NULL objects are now
added and which can be used as search path (either pk or all).
private final java.lang.String createSetStatement(SqlRow row, java.util.List searchEntries)
searchEntries
- an empty list. This will be filled with the values of the
entries (ClientProperties) found in the row object. Also null objects are added.
and which can be used as search path (either pk or all).
private final byte[] cutEndIfTooLong(SqlColumn col, java.lang.String colName, byte[] val)
private final double getDouble(ClientProperty prop)
private final long getLong(ClientProperty prop)
private final void insertIntoStatement(java.sql.PreparedStatement st, int pos, ClientProperty prop) throws java.sql.SQLException, java.io.IOException, java.text.ParseException
java.sql.SQLException
java.io.IOException
java.text.ParseException
private boolean isBinaryType(int type)
private static java.lang.String getVal(SqlDescription description, java.lang.String key)
private static void setVal(SqlDescription description, java.lang.String key, java.lang.String val)
private static void processMapping(SqlInfo sqlInfo, I_Mapper mapper) throws java.lang.Exception
java.lang.Exception
public int update(java.sql.Connection conn, SqlRow newRow, I_Parser parserForOld) throws java.lang.Exception
conn
- row
-
java.lang.Exception
public int delete(java.sql.Connection conn, SqlRow row) throws java.lang.Exception
conn
- row
-
java.lang.Exception
public int insert(java.sql.Connection conn, SqlRow row) throws java.lang.Exception
conn
- row
-
java.lang.Exception
public java.lang.String getCommand()
public void setCommand(java.lang.String command)
public java.lang.String getIdentity()
public void setIdentity(java.lang.String identity)
public void addColumn(SqlColumn column)
public SqlColumn[] getColumns()
public SqlColumn getColumn(java.lang.String colName)
public int getNumOfColumns()
public SqlColumn getColumnAtPosition(int pos)
pos
-
java.lang.IllegalArgumentException
- if the number is less than 1 or bigger than the size of the list or if for some reason the entry has not been found.public java.lang.String toXml(java.lang.String extraOffset)
final java.lang.String toXml(java.lang.String extraOffset, boolean doTruncate)
public static java.lang.String getDifferences(SqlDescription description1, SqlDescription description2)
public static void main(java.lang.String[] args)
public boolean isColumnSearchConfigured(java.lang.String column)
column
- the name of the column to check or null if a global check for the table.
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |