Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360714

Summary: Formatting screws up SQL statements
Product: z_Archived Reporter: Justin Spadea <jspadea>
Component: EDTAssignee: Yun Feng Ma <mayunf>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P1 CC: chenzhh, jqian, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch
lasher: iplog+
Patch for preference page /IO statement lasher: iplog+

Description Justin Spadea CLA 2011-10-12 14:29:20 EDT
The following statements get screwed up, probably due to parser changes:

add
delete
execute
foreach
prepare
replace

Examples:


library test

	function foo()
		expr string;
		ds SQLDataSource?;
		rs SQLResultSet?;
		stmt SQLStatement?;
		r rec;
		
		add r to ds;
		delete r from ds using expr for r with expr;
//		delete from ds; // Causes NPE - target is not required for delete
		execute from rs with stmt;
		prepare stmt from ds with #sql{};
		prepare stmt from ds with expr;
		replace r to ds using expr for r;
		replace r to ds with expr for r;
		
		forEach(r from rs)
		end
	end
end

record rec
	i int{@Id};
end
Comment 1 Jing Qian CLA 2011-10-18 10:09:28 EDT
Jimmy,

the formatter code needs to match the parser definition the egl.cup file 
if there are parser changes in egl.cup, then please update the formatter visitor, etc to update them
Comment 2 Justin Spadea CLA 2011-10-18 10:21:42 EDT
The egl.cup file did have a few changes for new/changed syntax in EDT. For example, the "with" clause can be a WithExpressionClause in addition to the already-existing WithInlineSQLClause ("with myVariable" instead of "with #sql{}").
Comment 3 Jing Qian CLA 2011-10-18 10:41:54 EDT
then while fixing this bug, it should also include the with clause
Comment 4 Yun Feng Ma CLA 2011-10-19 23:41:40 EDT
Created attachment 205574 [details]
Patch

Here is a patch. Thanks.
Comment 5 Xiao Bin Chen CLA 2011-10-20 04:25:53 EDT
Created attachment 205591 [details]
Patch for preference page /IO statement
Comment 6 Yun Feng Ma CLA 2011-10-20 23:18:15 EDT
Hi Jing, the "with" issue is fixed in this patch. Now tix is in. Thanks.
Comment 7 Justin Spadea CLA 2011-11-04 14:37:35 EDT
Verified