|
SMACS | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsmacs.find.InsertInto
derived from earlier SelinsCode - described as follows...
The usual way to transfer data from one database to another is in using a combination of SELECT (to get some records) with an INSERT (to put some records) in an sql statement. In actual essence a VIEW definition will look very similar which we will be checking for in another place. Here we want to be able to scan real world (handwritten) code for transfer rules - so we can implant them later into a larger schema mapping application.
Essentially, we try to find (a) an sql statement (b) with both an INSERT and SELECT subrule (c) which are embedded and close to each other - after having detected it we want to (x) split the embedded SELECT subrule getter from the INSERT setter part (y) create a jdbc/sqlj database cursor with the getter subrule and (z) create a java loop that execs an INSERT on the target for each record current on the cursor created with the SELECT.
The real compiler generation is being done in another part of this project. The example executions in here will handle very simple variants with a known set of statements in a known example transfer script. Let's try to keep it simple here to let a later developer know the code flow of the project ;-)
| Nested Class Summary | |
static class |
InsertInto.Rule
a compact notation to pass around parts of a SelIns rule |
| Field Summary | |
static String |
InsertIntoStatement
|
static String |
IntoTableClause
|
protected static Logger |
log
|
static String |
ScriptRoot
|
static String |
Selector
|
static String |
SelectStatement
|
| Constructor Summary | |
InsertInto()
|
|
| Method Summary | |
String |
getRuleScript(SimpleNode tree)
scan rules from tree and generate jdbc core script. |
Vector |
getSelectInsertRuleVector(SimpleNode tree)
Rule-Vector as copied from Rules in the parsing tree |
static void |
main(String[] args)
self test |
JavaWriter |
newJavaWriter()
overriding this one is the easiest way to generate some slightly different output code |
static InsertInto.Rule |
newRuleFromInsertIntoStatement(SimpleNode statement)
build new Rule from sql statement. |
SqlWriter |
newSqlWriter()
overriding this one is the easiest way to generate some slightly different output code |
String |
strInsertCode(JavaWriter jj,
SqlWriter qq,
SimpleNode tree)
SQL'INSERT into JDBC-string |
String |
strRuleScript(JavaWriter jj,
SqlWriter qq,
SimpleNode tree)
generating glue code around getSelectInsertRuleVector(SimpleNode) result |
String |
strSelectCode(JavaWriter jj,
SqlWriter qq,
SimpleNode tree)
SQL'SELECT into JDBC-string |
String |
strSelectInsertRule(JavaWriter jj,
SqlWriter qq,
InsertInto.Rule rule)
SQL'SELECT'INSERT into JDBC-string |
String |
strSelectInsertRules(JavaWriter jj,
SqlWriter qq,
SimpleNode tree)
parse Rules from ParsingTree and create JDBC script from all of them. |
protected String |
strThisClass()
helper |
static String |
toRuleScript(SimpleNode tree)
scan rules from tree and generate jdbc core script. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final Logger log
public static final String IntoTableClause
public static final String SelectStatement
public static final String InsertIntoStatement
public static final String ScriptRoot
public static final String Selector
| Constructor Detail |
public InsertInto()
| Method Detail |
public static InsertInto.Rule newRuleFromInsertIntoStatement(SimpleNode statement)
public Vector getSelectInsertRuleVector(SimpleNode tree)
public String strSelectCode(JavaWriter jj,
SqlWriter qq,
SimpleNode tree)
public String strInsertCode(JavaWriter jj,
SqlWriter qq,
SimpleNode tree)
public String strSelectInsertRule(JavaWriter jj,
SqlWriter qq,
InsertInto.Rule rule)
public String strSelectInsertRules(JavaWriter jj,
SqlWriter qq,
SimpleNode tree)
protected String strThisClass()
public String strRuleScript(JavaWriter jj,
SqlWriter qq,
SimpleNode tree)
getSelectInsertRuleVector(SimpleNode) result
public JavaWriter newJavaWriter()
public SqlWriter newSqlWriter()
public String getRuleScript(SimpleNode tree)
strRuleScript(smacs.find.JavaWriter, smacs.tree.SqlWriter, smacs.tree.SimpleNode)
public static String toRuleScript(SimpleNode tree)
getRuleScript(smacs.tree.SimpleNode)
public static void main(String[] args)
|
SMACS | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||