| Summary: | EDT SQL: Some smallInt types will be generated as SHORT type which cannot be resolved in EDT Java compiler | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Thomas Wu <wxwu> | ||||
| Component: | EDT | Assignee: | Project Inbox <edt.javagen-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | jspadea, jvincens | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 206593 [details]
Java Error
fixed Verified in build 20111110 |
Build Identifier: 20111107 Create a record value like following: record staff_rec type Entity{@table{name = "THOMASWU.STAFF"}} ID smallInt = 888; NAME string? = "Thomas"; DEPT smallInt? = 21; JOB string? ; YEARS smallInt? ; SALARY decimal(7, 2)? = 1999.99; COMM decimal(7, 2)? = 5.00; end Add this record into related DB2 sample table. The egl codes have no error, but their generated java codes having un-resolved SHORT type for some smallInt data values. Reproducible: Always Steps to Reproduce: 1.Connect DB2 samples database. 2.Create a record structure as following record staff_rec type Entity{@table{name = "THOMASWU.STAFF"}} ID smallInt = 888; NAME string? = "Thomas"; DEPT smallInt? = 21; JOB string? ; YEARS smallInt? ; SALARY decimal(7, 2)? = 1999.99; COMM decimal(7, 2)? = 5.00; end 3.Create a basic program to insert a record into STAFF table in DB2 sample as the following. program testSQLforDB2 type BasicProgram {} ds SQLDataSource = new SQLDataSource("jdbc:db2://localhost:50001/SAMPLE:user=ThomasWu;password=rat10nal;"); staff1 staff_rec; function main() testAdd(); end function testAdd() add staff1 to ds; syslib.writeStdout("Done!"); end end Actual results: The egl codes have no errors, but some of smallInt values, like DEPT, YEARS will generate the un-resloved type, SHORT. There are the generated codes for function testAdd(). public void testAdd() { try { java.sql.PreparedStatement ezeStatement = (java.sql.PreparedStatement)ds.getStatement("testdb2.testSQLforDB2", 1); if (ezeStatement== null) { String stmtStr = "INSERT INTO THOMASWU.STAFF(ID, NAME, DEPT, JOB, YEARS, SALARY, COMM) VALUES (?, ?, ?, ?, ?, ?, ?)"; ezeStatement = ds.getConnection().prepareStatement(stmtStr); ds.registerStatement("testdb2.testSQLforDB2", 1, ezeStatement); } ezeStatement.setShort(1, staff1.ID); if(null == staff1.NAME){ ezeStatement.setNull(2, java.sql.Types.VARCHAR); } else{ ezeStatement.setString(2, staff1.NAME); } if(null == staff1.DEPT){ ezeStatement.setNull(3, java.sql.Types.SHORT); } else{ ezeStatement.setShort(3, staff1.DEPT); } if(null == staff1.JOB){ ezeStatement.setNull(4, java.sql.Types.VARCHAR); } else{ ezeStatement.setString(4, staff1.JOB); } if(null == staff1.YEARS){ ezeStatement.setNull(5, java.sql.Types.SHORT); } else{ ezeStatement.setShort(5, staff1.YEARS); } if(null == staff1.SALARY){ ezeStatement.setNull(6, java.sql.Types.DECIMAL); } else{ ezeStatement.setBigDecimal(6, staff1.SALARY); } if(null == staff1.COMM){ ezeStatement.setNull(7, java.sql.Types.DECIMAL); } else{ ezeStatement.setBigDecimal(7, staff1.COMM); } ezeStatement.execute(); } catch(java.sql.SQLException ezeEx) { throw org.eclipse.edt.javart.util.JavartUtil.makeEglException(ezeEx); } ; SysLib.writeStdout("Done!"); }