poolborges / openbravo-sqlc

This is fork of openbravo SQLC Tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Openbravo SQLC (PB Fork)

1. About

This project was part of Openbravo code (src-core)

SQLC (SQL Compiler) is a utility used to avoid the repetitive task of writing Java classes to interact with the database. The input is an XML file that contains standard SQL statements and the parameters used in the statements. SQLC reads this file and generates a Java class that has all the code necessary to connect to the database, execute the statement, read the record and create standard Java types as return for the methods.

2. How to use

How to use command line
java org.openbravo.data.Sqlc [fileProperties] [fileTermination] [sourceDir] [destinyDir] [write_txt_files] [timeout]
Table 1. System Properties
Nome Values

sqlc.listOfFiles

sqlc.queryExecutionStrategy

Table 2. Property File
Name

dateFormat.java

Table 3. XML

SqlClass

SqlClassComment

SqlMethod

Sql

SqlMethodComment

Field

3. Main

org.openbravo.xmlEngine.XmlEngine

4. Bibliotecas

4.1. Advance Usage

-Dsqlc.listOfFiles=SakilaActor.xml,SakilaFilms.xml -Dsqlc.queryExecutionStrategy=

5. SQLC XML Schema

5.1. SQLC XML Tags

  • SqlClass

  • SqlClassComment

  • SqlMethod

  • SqlMethodComment

  • Sql

  • Parameter

5.2. SqlClass Attribute

  • name

  • accessModifier

  • package

5.3. SqlMethod Attribute

  • type (sql.sqlType)

    • constant

    • preparedStatement

    • callableStatement

    • statement

  • return (sql.sqlReturn)

    • STRING

    • BOOLEAN

    • DATE

    • SINGLE

    • MULTIPLE

    • SCROLLABLE

    • ROWCOUNT

    • SEQUENCE

    • OBJECT

6. TODO

  • Não esta sendo o directorio correcto respeitando a package, ou seja, as classe (bla..bla..)

6.1. Flow

SQLC Current flow diagram
init();

listDir(){
    parseSqlFile();
}
SQLC Future flow diagram
setDefaultOptions();
parseCLIOptions();
processInputDirectory(){
    //1 - Iterate on all subdirectory. and search for every FILE that match inputFilePrefix/*.xsql
    //3 - validateXsql(File); validateXsql(String);
    //2 - XsqlEntity parseXsqlFile() XsqlException: Malformatted XSQL, Wrapper ERROR about database, table, field, etc
    //3 - generateJavaCode(XsqlEntity);

}

6.2. TODO maven plugin

  • Default input directory: src/main/resources

  • Default outpuy directory: target/generated-sources

  • groupId: com.poolborges.maven

  • artifactId: maven-plugin-sqlc

About

This is fork of openbravo SQLC Tool

License:Apache License 2.0


Languages

Language:Java 100.0%