Bug #1609 enhance initialize() to speed up implementation with Connector/J
Submitted: 20 Oct 2003 7:41 Modified: 11 Nov 2009 2:35
Reporter: Ralf Hauser Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / J Severity:S4 (Feature request)
Version:any OS:Any (any)
Assigned to: CPU Architecture:Any

[20 Oct 2003 7:41] Ralf Hauser
Description:
a significant share of time when using connector/J is lost due to 
i)   typos in field or table names
ii)  syntax errors in queries (e.g. adding field in a SELECT and forgetting to
     add a comma)
iii) ambiguity errors (a field name is used in multiple tables and not fully 
     determined in a JOIN)

Development efficiency is the higher the earlier an error is detected - possible points in time when an error is detected:
a) in the GUI Editor (e.g. an eclipse plug-in that would consider a "prepareStatement" not just as strings but is aware of their nature of being SQL statements and reports some pertinent errors)
b) at compile time
c) at load/initialize time
d) at execution time.

It appears to me that all the above errors i) - iii) right now fall into the d) category that is the most time consuming!

Once mysqldump's xml output is fixed (http://bugs.mysql.com/bug.php?id=1530), I plan to use http://sourceforge.net/projects/fmpp to convert that xml file into a MySQLConst.Java constants file and will only use these string constants in my prepareStatement's. This will move errors of type i) and partially iii) to b) from d). (I do this very successfully already in my ant build.xml for struts variables...).

Thus my suggestions:
====================
1) Use the initialize() command to do some syntax checking (e.g. missing commas etc.) IMHO, this has next to zero run-time effect, probably it won't blow up the connector code too much either (if that is a problem, this feature could be turned on/off with a property?). Essentially, this would mean moving errors of type ii) from d) to c) which shortens potentially long test-suites already tremendously!!!
2) later have initialize() also use the xml'ed table structure to move errors of type i) and iii) from d) to c) !!!

How to repeat:
.

Suggested fix:
.