Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033434Openbravo ERPA. Platformpublic2012-12-13 11:072016-07-06 09:26
shuehner 
shuehner 
normalminorhave not tried
closedfixed 
5
 
3.0PR16Q2.13.0PR16Q2.1 
alostale
Core
No
0033434: SqlC does execute all queries at compile time, which is not required.
SqlC does execute all select queries at compile time when it is processing xsql files.
Technically that is needed to get the number, names & data-types of the columns in the result as that info is used to generate the fields and data-reading code in the to be generated java file.

However the jdbc spec does have a optional method to get that same information for a query without executing it.

Postgresql does implement that optional method.
Oracle jdbc driver does implement that method only starting with Oracle 11R2
Quoting: https://docs.oracle.com/cd/E18283_01/java.112/e16548/whatsnew.htm#CJACGJHA [^]

""
Starting from Oracle Database 11g Release 2 (11.2), JDBC drivers support obtaining the metadata of a SELECT statement without executing the PreparedStatement. This feature works even with the earlier database releases. For more information, please refer to "Interface oracle.jdbc.OraclePreparedStatement".
""

So it should be fine to just have the updated jdbc driver even when the database behind is not yet 11R2 (Important as System Requirements only have 11 as min version, we do not require R2)


A prototype patch exist which does use this improvement transparently on postgresl and will remove all execution times for those queries on that db.

-
Review & apply proposed patch to get this compile time improvement on the database where it is possible.
Performance
blocks feature request 0022559 closed shuehner SqlC does execute all queries at compile time, which is not required. 
Issue History
2016-07-05 17:28OrekariaTypefeature request => backport
2016-07-05 17:28OrekariaTarget Version => 3.0PR16Q2.1
2016-07-06 09:05OrekariaAssigned Toshuehner => alostale
2016-07-06 09:09alostaleTag Attached: Performance
2016-07-06 09:24OrekariaFile Added: FixesIssue22559.patch
2016-07-06 09:24OrekariaNote Added: 0088226
2016-07-06 09:25hgbotCheckin
2016-07-06 09:25hgbotNote Added: 0088228
2016-07-06 09:25hgbotStatusscheduled => resolved
2016-07-06 09:25hgbotResolutionopen => fixed
2016-07-06 09:25hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/21698df6e4fe6e0272f997ba99be1c38bc966ee7 [^] => http://code.openbravo.com/erp/backports/3.0PR16Q2.1/rev/9ec9da16c06a04e01ae9d8d345835f3cbf340855 [^]
2016-07-06 09:26alostaleAssigned Toalostale => shuehner
2016-07-06 09:26alostaleNote Added: 0088229
2016-07-06 09:26alostaleStatusresolved => closed
2016-07-06 09:26alostaleFixed in Version => 3.0PR16Q2.1
2016-07-06 15:35OrekariaFile Deleted: FixesIssue22559.patch

Notes
(0088226)
Orekaria   
2016-07-06 09:24   
Attached proposed patch
(0088228)
hgbot   
2016-07-06 09:25   
Repository: erp/backports/3.0PR16Q2.1
Changeset: 9ec9da16c06a04e01ae9d8d345835f3cbf340855
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Thu Jun 16 10:04:13 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q2.1/rev/9ec9da16c06a04e01ae9d8d345835f3cbf340855 [^]

fixed issue 33434: SqlC does execute all queries at compile time

  SqlC does execute all select queries at compile time when it is processing
  xsql files.

  Technically that is needed to get the number, names & data-types of the columns
  in the result as that info is used to generate the fields and data-reading code
  in the to be generated java file.

  However the jdbc spec does have a optional method to get that same information
  for a query without executing it.

  As this method is supported in current jdbc drivers for both Oracle and PostgreSQL,
  now it is used instead of executing the whole queries.

---
M src-core/src/org/openbravo/data/Sqlc.java
---
(0088229)
alostale   
2016-07-06 09:26   
code reviewd + tested both in Oracle and PG