SMACS

Package smacs.write.script

Writing the Script glue.

See:
          Description

Interface Summary
HasCurrentRecordJavaVariable knows instance of current record.
HasCurrentRecordPsqlVariable knows instance of current record.
HasJavaClassName resolved class name.
HasJavaExpression marks statements with source value computation.
HasJavaExpressionList marks statements with a list of source value computation.
HasJavaName get name as for name resolution.
HasJavaNameList storing list used during name resolution.
HasJavaRecordFieldName used for JavaVariables and similar things.
HasJavaStatements block-like language elements.
HasJavaVariableName resolved variable name.
HasProtected special attributions for java declarations.
HasPsqlExpression marks statements with source value computation.
HasPsqlExpressionList marks statements with a list of source value computation.
HasPsqlName get name as for name resolution.
HasPsqlNameList storing list used during name resolution.
HasPsqlNewName has a name to be resolved.
HasPsqlRecordFieldName used for PsqlVariables and similar things.
HasPsqlStatements block-like language elements.
HasPsqlTypeName resolved type name.
HasPsqlVariableName resolved variable name.
HasSqlResolver Lambda for field resolvers - unused.
JavaAddFromCursorRecord marker node for field expression of a target.
JavaCallExpression mark call expression.
JavaExpression element of a computation tree.
JavaSimpleNode basenode for script writing.
PsqlAddFromCursorRecord marker node for field expression of a target.
PsqlExpression expression node.
PsqlNodeHandler just a marker.
PsqlSimpleNode basenode for script writing.
 

Class Summary
FromSelinsCode test to convert SelinsCode to JavaScript tree.
FromSelinsCode.DataBaseHead  
FromSelinsCode.SelectInsertRule  
JavaAddAllFromCursorRecord target field expression list.
JavaAddFieldFromCursorRecord target field expression.
JavaAddFieldFromExpression extendsion of JavaAddFieldFromCursorRecord Expand an SqlExpression with a bunch of RecordVariables being referenced implicitly.
JavaArgument argument-variant of a variable.
JavaArgumentList list of JavaArguments.
JavaAssignment a side-effect statement.
JavaBlock print a list as a block.
JavaCallMethod build function callstack.
JavaCatchBlock add to JavaTryBlock.
JavaChoiceBlock an IF-ELIF-ELSE-THEN block.
JavaClass helper routines for classname handling.
JavaClassDefinition the class being contained in a script.
JavaClassImport representing a java class name of a script
JavaClassImportNeeded representing a java class name of a script
JavaClassScript the class writing a JavaScript containing a class.
JavaCommentLine just for commenting.
JavaConditionExpression a condition of an IF-ELIF-ELSE-THEN block.
JavaConditionStatement condition block with conjugated condition list.
JavaConditionStatement.Conditions list of conditions of JavaConditionStatement
JavaConditionStatement.ExecAtEnd list of cleanup code in JavaConditionStatement
JavaConditionStatement.Executions list of executions of JavaConditionStatement
JavaConditionStatement.Resolver for the field resolver of JavaConditionStatement
JavaDeclarations This class is a container usually kept at the start of a block container.
JavaDeclarationsResolver algorithm to be applied to JavaDeclarations.
JavaExistsCursorRecord sql EXISTS tests as a condition.
JavaExistsCursorRecord.Field remember field test for JavaExistsCursorRecord.
JavaExistsCursorRecord.Fieldlist  
JavaExistsCursorRecord.Target  
JavaExpressionNode basic implementation of JavaExpression.
JavaExpressionStatement wrap a JavaExpression as a Statement.
JavaFieldResolver field resolver for sql expression copies.
JavaFieldResolver.ViaCursor resolve via cursor. a helper that defines a custom JavaFieldResolver.ViaCursor.print(JavaPrintStream) method.
JavaForeachBlock build loops around containers and iterators.
JavaForeachCursorRecord do UpdateFromCursorRow.
JavaHasBlock externalized script definition.
JavaIncrementOperator special of JavaPrefixOperator.
JavaInfixOperator base for prefix operators being functions.
JavaInheritedClass attribution of class definitions.
JavaInsertValuesRecord do UpdateFromCursorRow.
JavaLiteral literal expression base.
JavaMethod unused.
JavaMethodDefinition the main method of a Runnable class.
JavaNames helper routines for name handling.
JavaPrefixOperator base for prefix operators being functions.
JavaPrintStream java stream writer context.
JavaProgramScript the class writing a JavaScript and all its associated classes.
JavaRecordVariable a record variable.
JavaRunnableClassDefinition the class implementing Runnable.
JavaRunnableMethod the main method of a Runnable class.
JavaRunnableUpdateScriptDefinition defines three fields.
JavaScriptInvisibleNode base node for non-print subtrees.
JavaScriptNode basenode for script writing.
JavaScriptWriter final steps to write the script.
JavaSetExpression set value.
JavaSqlExecuteQuery wrap DynamicSQL statement that query data.
JavaSqlExecuteUpdate wrap DynamicSQL statement that modifies data.
JavaSqlExpression an SQL snippt is-a JDBC string in java.
JavaSqlTableExpression defining a SQL table.
JavaStatements statement list (in a block).
JavaStringConcatExpression concat string expressions.
JavaStringLiteral literal expression.
JavaTargetOperation wrap actual database operations.
JavaTryBlock model block with exception group.
JavaVariable internal Variable instance.
JavaVariableDefinition this class reserves a name for later usage.
JavaVariableName this class reserves a name for later usage.
JavaVariableType node for a variable type name.
JavaVariableUsed The use of a variable.
JavaWhenBlock an x in IF-x-ELIF-x-ELSE-x-THEN block.
PsqlAddAllFromCursorRecord target field expression list.
PsqlAddFieldFromCursorRecord target field expression.
PsqlAddFieldFromExpression extendsion of PsqlAddFieldFromCursorRecord Expand an SqlExpression with a bunch of RecordVariables being referenced implicitly.
PsqlArgument argument-variant of a variable.
PsqlArgumentList list of PsqlArguments.
PsqlBlock print a list as a block.
PsqlCommentLine just for commenting.
PsqlConditionStatement condition by sql.
PsqlConditionStatement.Conditions list of conditions of PsqlConditionStatement
PsqlConditionStatement.ExecAtEnd list of cleanup code in PsqlConditionStatement
PsqlConditionStatement.Executions list of executions of PsqlConditionStatement
PsqlConditionStatement.Resolver for the field resolver of PsqlConditionStatement
PsqlDeclarations helper node to store declarations.
PsqlDeclarationsResolver resolve variable name lists.
PsqlExistsCursorRecord sql EXISTS tests as a condition.
PsqlExistsValuesRecord do UpdateFromCursorRow.
PsqlExpressionNode arbitrary expression base node.
PsqlFieldResolver field resolver for sql expression copies.
PsqlFieldResolver.ViaCursor resolve via cursor. a helper that defines a custom PsqlFieldResolver.ViaCursor.print(PsqlPrintStream) method.
PsqlForeachCursorRecord do UpdateFromCursorRow.
PsqlFunctionDefinition the main method of a Runnable class.
PsqlInsertValuesRecord do UpdateFromCursorRow.
PsqlMaterializeQuery Materializing a Query.
PsqlNames helper routines for name handling.
PsqlNameUsed wrap some HasPsqlNewName node.
PsqlOpenCursor open a cursor.
PsqlOracleFixup fixup.
PsqlPackageDefinition the class carrying the execution.
PsqlPackageScript the class writing a PsqlScript containing a class.
PsqlPrintStream Psql stream writer context.
PsqlProgramScript root of PsqlScript.
PsqlRecordResolver field resolver for sql expression copies.
PsqlRecordResolverMapping expanded field name.
PsqlRecordResolverViaCursor prefix a field name.
PsqlRecordVariable special variable fore records.
PsqlRunnablePackageDefinition the package implementing executable functions.
PsqlRunnableUpdatePackageDefinition defines three fields.
PsqlScriptInvisibleNode invisible node.
PsqlScriptNode basenode for script writing.
PsqlScriptWriter final steps to write the script.
PsqlSelectSubQuery a query being part of another command.
PsqlSetExpression set value.
PsqlSetFieldValue field value.
PsqlSqlExpression a generic SQL snippet.
PsqlSqlResolverExpression defining a SQL table.
PsqlSqlSnippet a generic SQL snippet.
PsqlSqlTableExpression defining a SQL table.
PsqlStatements statement list (in a block).
PsqlTableDefinition CREATE TABLE writer.
PsqlTargetOperation wrap actual database operations.
PsqlTargetValuesRecord common base node for PsqlInsertValuesRecord and PsqlExistsValuesRecord.
PsqlTargetValuesRecordItem helper class.
PsqlType helper class to encode a type.
PsqlTypeDefinition a type defintion helper.
PsqlUpdateValuesRecord do UpdateFromCursorRow.
PsqlVariable internal Variable instance.
PsqlVariableDefinition this class reserves a name for later usage.
PsqlVariableType node for a variable type name.
PsqlVariableUsed The use of a variable.
 

Package smacs.write.script Description

Writing the Script glue.

Java

This is a repository of JavaScriptNode tree elements that know how to write themselves to a java script file. They will automatically do all the necessary indentation and linebreaking, any variable instance can be referenced multiple times and it will be declared with its type in prior to its usage, all automatically. Likewise we import as many classes as possible to allow for the usual shorter names.

The script writing is not finished, there is lots of improvements that can be done here. The FromSelinsCode class is trying to check that we have accumulated enough classes to write out a script similar to what smacs.find.SelinsCode had been writing - we did not match it up completely however for there was no time left. Instead we made it up the point where we would kill the explicit sql classes as shown in the first attempt.

The real workings are done in between the schema import module and the java output tree - where we speak more about cursors to get from a database, to get out each item from a selected row where the SMACS system does already know about each item sql type prior to execution - and rearranging into another "cursor" item to put the reworked items into a target table.

the difference

The original smacs.find.SelinsCode was simply getting a cursor row where it does not know about the number or types of items being returned in that row. That's why we did create the generic loop around it with the help of a metadata query. After the loop, the result is spilled into the target database. This will know about the data types at runtime only.

In the next step we will do differently, the cursor will get a row and the row is virtually or really disintegrated into its fields. No loop anymore but instead an item get(x) call. Each field is possibly worked on, and pushed to a target row. Again, no loop anymore, we could possibly do it with a longer string concat on each of the variables modified or transfered. In here, the choice-which statements are much more important, and the automatic variable declaration stuff kicks in more drastically.

Hope that helps to know what the current state of this area is like.

additional note

After implementing lots of code for PL/SQL generation, the directory has been filled with a lot of classes that closely follow the operations expressible in PL/SQL and which are often database operations. Even that they look similar to the input SQL scan interpreter classes, these are strictly independent from any prior compiler stage - after generating a script tree, all the former intermediate objects can be deleted or reinitialized.


SMACS