|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.DefaultHandler jimm.datavision.testdata.SchemaGen
public abstract class SchemaGen
Skeleton for creating a schema.sql file by reading an XML description of a schema.
Field Summary | |
---|---|
protected boolean |
isFirstColumn
|
protected boolean |
notNull
|
protected boolean |
primaryKey
|
protected int |
size
|
protected java.lang.String |
type
|
Constructor Summary | |
---|---|
SchemaGen()
|
Method Summary | |
---|---|
protected void |
column(org.xml.sax.Attributes attributes)
Parses a column XML tag and calls printColumn . |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
|
protected abstract void |
endTable()
Outputs the SQL needed to close a create table statement. |
protected abstract void |
makeTable(java.lang.String tableName)
Outputs the SQL needed to create a database table. |
protected java.lang.String |
printableName(java.lang.String name)
|
protected void |
printColumn(java.lang.String columnName,
java.lang.String type,
int size,
boolean notNull,
boolean primaryKey)
Prints the SQL needed to create a database column within a create table statement. |
protected void |
printColumnName(java.lang.String columnName)
Prints the column name, taking into account case, blanks, and other possibly funky things. |
protected abstract void |
printNotNull()
Prints the SQL that defines a column as NOT NULL. |
protected abstract void |
printPrimaryKey()
Prints the SQL that defines a column as a primary key. |
protected abstract void |
printType(java.lang.String type,
int size)
Prints the SQL that defines a column's type. |
void |
run(java.lang.String schemaXMLFile)
|
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
|
protected void |
table(org.xml.sax.Attributes attributes)
Parses a table XML tag and calls makeTable . |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String type
protected int size
protected boolean notNull
protected boolean primaryKey
protected boolean isFirstColumn
Constructor Detail |
---|
public SchemaGen()
Method Detail |
---|
public void run(java.lang.String schemaXMLFile)
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
protected void table(org.xml.sax.Attributes attributes)
makeTable
.
attributes
- XML element attributesmakeTable(java.lang.String)
protected void column(org.xml.sax.Attributes attributes)
printColumn
. Also handles
commas and indentation.
attributes
- XML element attributesmakeTable(java.lang.String)
protected abstract void makeTable(java.lang.String tableName)
protected java.lang.String printableName(java.lang.String name)
protected abstract void endTable()
protected void printColumn(java.lang.String columnName, java.lang.String type, int size, boolean notNull, boolean primaryKey)
protected void printColumnName(java.lang.String columnName)
protected abstract void printType(java.lang.String type, int size)
protected abstract void printNotNull()
protected abstract void printPrimaryKey()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |