Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

18.3.12 Migrating an SQLJ source from the standard interface version to the native interface version

Some portions must be revised to migrate an SQLJ source from the standard interface version to the native interface version. Table 18-9 shows where revision is required to migrate to the native interface version.

Table 18-9 Migrating an SQLJ source to the native interface version

Command name Standard interface version Native interface version Revision needed?
UAP (input) source file-name.sqlj file-name.sqlj N
UAP (output) source JAVAsource-file-name.
javaprofile-name.ser
JAVAsource-file.java N
Option Specification of output file name, others Specification of output file name, others N
SQL prefix #sql #sql N
SQL terminator ; ; N
SQL declare section Unnecessary Unnecessary N
Embedded variable :variable-name :variable-name N
Declaration statement #sql context class-name
#sql iterator class-name
#sql context class-name
#sql iterator class-name1
N2
Connection context creation A JDBC connection object can be specified in a parameter. A JDBC connection object can be specified in a parameter. N
An object other than a JDBC connection object can be specified in a parameter. There is no object that obtains the same parameter. Y3
Use of default connection context JP.co.Hitachi.soft.HiRDB.sqj.runtime.
PrdbContext
JP.co.Hitachi.soft.HiRDB.pdjpp.runtime.
PrdbContext
Y4
Explicit specification of execution context sqlj.runtime.ExecutionContext JP.co.Hitachi.soft.HiRDB.pdjpp.runtime.
ExecutionContext
Y5
Use of the CAST statement (acceptance of a JDBC result set) Can be executed. Cannot be executed. Y6
Acceptance of dynamic result set Can be executed. Cannot be executed. Y7
Data type byte[]
java.math.BigDecimal
java.lang.String
JP.co.Hitachi.soft.HiRDB.pdjpp.runtime.
HiRDBBLOB
JP.co.Hitachi.soft.HiRDB.pdjpp.runtime.
HiRDBDECIMAL
JP.co.Hitachi.soft.HiRDB.pdjpp.runtime.
HiRDBCHAR and others
Y8
Execution of different SELECT statements that use the same iterator object name Can be executed. Cannot be executed. Y9

Legend:
Y: Need for revision.
N: No need for revision.

1 A name iterator cannot be used. A position iterator can be used but not in an inner class.

2 Revision becomes necessary when a name iterator or an inner class is used.

3 Change the connection process. For details, see 18.3.7(1)(d) Connecting to the HiRDB server when the native interface is used.

4 Change the JP.co.Hitachi.soft.HiRDB.sqj.runtime.PrdbContext package name to JP.co.Hitachi.soft.HiRDB.pdjpp.runtime.PrdbContext.

5 Change sqlj.runtime.ExecutionContext to JP.co.Hitachi.soft.HiRDB.pdjpp.runtime.ExecutionContext.

6 CAST statements result in errors when translated. Therefore, delete all CAST statements. Modify the UAP so that it operates the JDBC result set directly and does not use an SQLJ iterator.

7 Since there is no method that accepts a dynamic result set, an error occurs during Java compilation. Therefore, delete the section that issues ExecutionContext.getNextResultSet(). To get the dynamic result set, change the UAP so that is uses JDBC directly.

8 byte[] is requested to the HiRDB server as the BINARY type. Modification is necessary if the HIRDB server is version 06-02 or earlier.

When the BigDecimal type is specified in an acceptance variable, the precision in set to 15 and the scale to 0. Therefore, if any other precision or scale value is set, the value must be changed.

When String is specified in an input variable, it is requested to the HiRDB server as the VARCHAR type. If you want to associate the data type with a data type of the HiRDB server, you must change the data type.

9 The same iterator object name cannot be used to execute different SELECT statements. In this case, a separate iterator object name must be specified for each SELECT statement.
 
#sql iterator pos(HiRDBCHAR(10));
   :
pos positer = null
pos positer2 = null;
HiRDBCHAR out = null;
   :
#sql positer = {SELECT * FROM T1};
#sql {FETCH :positer INTO :out}
positer.close();
 
#sql positer2 = {SELECT * FROM T2};
#sql {FETCH :positer2 INTO :out}
positer2.close();