Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360137 - Saved default SQL statement for Get fails in execution
Summary: Saved default SQL statement for Get fails in execution
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Zhi Zhu CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-06 13:03 EDT by Paul Hoffman CLA
Modified: 2017-02-23 14:16 EST (History)
3 users (show)

See Also:


Attachments
Test case for defect (1.25 KB, application/octet-stream)
2011-10-06 13:03 EDT, Paul Hoffman CLA
no flags Details
Library to load database for test case (1.25 KB, application/octet-stream)
2011-10-06 13:04 EDT, Paul Hoffman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Hoffman CLA 2011-10-06 13:03:57 EDT
Created attachment 204694 [details]
Test case for defect

UI allows you to hit ctrl, 1 to save default SQL statement in the EGL program.  
  
For statement "get record from sqldatasource" the default statement works when it is not expanded, but fails when it is expanded into the program.   Adding a "using" clause makes the statement work.    The using clause should be included when the default statement is saved in the program.

See attached test case.   Test output:

default get  
success
saved default with added using clause 
success
saved default with no modification 
Failure:  Exception = At least one parameter to the current statement is uninitialized.: [sqlstate:07000][sqlcode:30,000]
Comment 1 Paul Hoffman CLA 2011-10-06 13:04:25 EDT
Created attachment 204695 [details]
Library to load database for test case
Comment 2 Zhi Zhu CLA 2011-10-12 21:49:28 EDT
Seems this is a SQL generator problem, if it belongs to SQL UI problem, please assign back to me.
Comment 3 Joseph Vincens CLA 2011-10-14 11:29:52 EDT
If a statement contains a #SQL{} clause which contains a ? the user is responsible for adding a USING clause to populate the ?'s in the #SQL. Generation can't add a default USING if there is an #SQL because the #SQL could contain variables, so the actual #SQL is not know at generation time and the generator won't know that the SQL contains ?. 

Our sql tooling (ctrl 1) should create statements that fully functional. In this case our tooling is adding the #SQL clause that contains ?'s and is not adding a using so the statement is not functional.

If the sql added by the tooling contains ?'s then the tooling should add the using to make the statement valid and perform like the default generation.
Comment 4 Zhi Zhu CLA 2011-10-19 04:24:02 EDT
Code is not delivered since cannot deliver now
Comment 5 Paul Hoffman CLA 2011-10-24 08:33:15 EDT
This problem is not fixed.

Save after Cntl-1 still produces SQL statement without the required using clause.
Comment 6 Zhi Zhu CLA 2011-10-25 21:08:46 EDT
Paul, can you paste your GET statement in the bug commnet?
Comment 7 Joseph Vincens CLA 2011-10-26 07:35:54 EDT
I'm marking this as resolved because I tried it on an install and it is now adding a 'using' and the attached test case runs successfully. Maybe it didn't make it into the build the day Paul tested it. 

Using the attached egl files.
I pressed Cntl-1 on row in the following statement:
get row from ds;
Select Add SQL Statement and I see:
	get row from ds using(row.id) with
		#sql{select id, aChar, aString, afloat, aInt, aSmallInt, aBigint
			from MINITBL
			where
				id = ?
		};



when I run the test I get:
connect to jdbc:derby:/home/jvincens/eclipse/rbdDev/derby/SAMPLE
Check row 1
Check row 10
default get
success
saved default with added using clause 
success
saved default with no modification 
success
Comment 8 Paul Hoffman CLA 2011-10-26 12:44:03 EDT
Verified and closed.