Explain the structure of the configuration file initidb.xml used by InitLoader. It also describes initdb_ex.xml that developers can extend.

Initdb.xml is the configuration file used by the InitLoader command. This file is contained in the wagbyapp / webapps / wagby / WEB - INF / export / conf folder.

Initdb.xml has the following structure.

<Config> <! - Database configuration -> <database ...> ... </ database> <! - Setting of each folder -> <directory ... /> <directory ... / > <Directory ... /> ... </ config>

Specify the type of database, JDBC driver, destination URL, etc.

Type attribute
Specify the type of database.For the built-in database, specify "sql92".
Driver attribute
Specify the JDBC driver.
Url attribute
Specify the URL to the destination database.
User attribute
Specify the user name of the destination database.
Password attribute
Specify the password of the destination database.
Quoteid attribute
Specify the identifier delimiter (quote.id) in the SQL statement. For example, if you specify '"', SQL statements such as' select * from" "juser" where id> 0 "will be executed.
Quotewhere attribute
Specify the delimiter (quote.where) of the WHERE clause in the SQL statement. For example, if you specify '"', SQL statements like 'select * from juser where" id> 0 "will be executed.
Quoteidinwhere attribute
Specifies the identifier delimiter (quote.idInWhere) in the WHERE clause of the SQL statement. For example, if you specify '"', SQL statements such as' select * from juser where" id "> 0 will be executed.

Specify the relative folder name and various attributes starting from the exported folder. Specifically, it is as follows.

  'Adddslfilename = "importxsl / customer.dsl" importxslfilename = "importxsl / customer.xsl" convertimportxslfilename = "convertimportxsl / customerdslfilename =" dropddl / customer.ddl "<directory group =" data hibernate "tablename =" customer "storage =" hibernate "createddlfilename = Customer.xsl "> init / customer </ directory>
Group attribute

Specify the group name of this sql element.It is possible to describe more than one space.When executing the command, sql elements matching the group name can be executed collectively.The following values ​​are set.

  • Data: A marker indicating the meaning developed by the end user.
  • Jfc_data: Wagby This marker indicates a model managed internally.
  • Hibernate: Store data using Hibernate.It is applicable to models developed by end users.

this Use the group attribute value to operate the InitLoadercan do.You will be able to perform operations limited to the target group.

Tablename attribute
If the database table name is specified and executed, only the matching sql element is executed.
Storage attribute
You can specify "hibernate".
Createddlfilename attribute
Specify the DDL file at table creation.
Dropddlfilename attribute
Specify the DDL file when deleting the table.
Importxslfilename attribute
By specifying the file name of the XSL file for this attribute, processing is performed with XSL which specified the imported XML at import time.If not specified, it will be processed as it is with the imported XML.Specify a relative path from the parent directory of the initdb.xml file.
Convertimportxslfilename attribute
You can pass the XSLT specified here (as a filter) at the timing when past data is migrated and data is stored in the new system.

When InitLoader is executed, specify the SQL statement to be executed at the same time.Specify various SQL statements (one sentence) such as definition of view.

  <Sql group = "create_view jfc_data" tablename = "staff"> create view ... </ sql>

When executing multiple SQL statements, please describe the element multiple times.Or describe SQL by separating it with semicolon ";".

When using MySQL, it is necessary to set up to recognize multiple SQLs separated by semicolons.[More ...]
Group attribute
Specify the group name of this sql element.It is possible to describe more than one space.When executing the command, sql elements matching the group name can be executed collectively.
Tablename attribute
If the database table name is specified and executed, only the matching sql element is executed.
If both acceptcommand attribute and denycommand attribute are not specified, default value
acceptcommand="sql sql-auto-before" denycommand="all"
Use the.

When executing InitLoader, specify the CREATE SEQUENCE statement to be executed at the same time. Specifically, it is as follows.

  <Sequence group = "create_seq jfc_data" tablename = "jprincipal" tablemaxcolumn = "id" seqname = "jprincipal_seq" start = "1000" />
Group attribute
Specify the group name of this sequence element.It is possible to describe more than one space.Sequence elements matching the group name can be executed at once when the command is executed.
Tablename attribute
When the database table name is specified and executed, only the matching sequence element is executed.
Tablemaxcolumn attribute
If the tablename attribute and the maximum value of the column of the table specified by this attribute are acquired and it is larger than the value specified by the start attribute, this value is set as the value of START.If the tablename attribute or this attribute is not specified, it follows the specification of the start attribute.
Seqname attribute
Specify the name of the SEQUENCE to be created.It must be specified.
Increment attribute, minvalue attribute, maxvalue attribute, start attribute, cache attribute
It corresponds to INCREMENT, MINVALUE, MAXVALUE, START, CACHE of the CREATE SEQUENCE statement.If it is not specified, it is omitted.
Cycle attribute
Corresponds to CYCLE of the CREATE SEQUENCE statement.It is specified only if the value is true.It is omitted if it is not specified or the value is false.
If both acceptcommand attribute and denycommand attribute are not specified, default value
acceptcommand="sequence" denycommand="all"
Use the.

Initdb.xml is always generated automatically from the model definition.On the other hand, initdb_ex.xml is created by the developer and placed in the customize folder.By using this mechanism, you can prepare the SQL that you want to always execute at InitLoader regardless of the model definition.

How to use

  1. In order to issue your own DDL, prepare $ (DEVHOME) /customize/webapp/WEB-INF/export/conf/initdb_ex.xml.
  2. Create the contents of the file.Here is an example.
    <?xml version="1.0" encoding="UTF-8"?>
      <sql group="data"
            acceptcommand="sql sql-create-after" denycommand="all"
            tablename="seq">
    INSERT INTO &quot;seq&quot; VALUES('report_seq1',1);
    INSERT INTO &quot;seq&quot; VALUES('report_seq2',1);
      </sql>
    
  3. Build.After the build, it is placed in wagbyapp / webapps / wagby / WEB - INF / export / conf / initdb_ex.xml.
  4. When init_db.bat is executed, the contents described here will be executed (after initdb.xml).

[Application example: support> repository> business logic> primary key> Define order]

Notes on operation

  • It depends on your database to describe SQL directly.When changing databases, please also review the contents described in this file.
  • Whether double quotes enclose the table name depend on the database you use.
  • If you designate "Do not create tables" in Designer, SQL execution related to the model will be skipped during the import operation from the web screen.If you run the init_db.bat script from the console, all the contents of initdb_ex.xml will always be executed.
  • If there is an error in the description content, the description will not be executed.For example, a misspelled tablename attribute, extra blank space, etc.