Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Accessing Result columns after parsing using SQLQueryParser(Accessing Result columns after parsing using SQLQueryParser)
Accessing Result columns after parsing using SQLQueryParser [message #869135] Thu, 03 May 2012 01:40
Aditya Wagle is currently offline Aditya WagleFriend
Messages: 7
Registered: November 2011
Junior Member
I am trying to use the SQLQueryParser to parse a query statement and want to gather the result columns and their data type.

Currently I can successfully get the column name however the data type is not populated. I am not sure how I can pass the connection profile. I tried extracting the Database object from IConnectionProfile and passing it to StatementHelper but to no avail.

This is what I am trying right now:

Database db = getDatabaseForProfile(connection);
			StatementHelper helper = new StatementHelper(db);
			SQLQueryParserManager parserManager = SQLQueryParserManagerProvider.getInstance().getParserManager(db.getVendor(), db.getVersion());
			QuerySelectStatement result = null;
			try {
				result = (QuerySelectStatement) parserManager.parseQuery(statement).getQueryStatement();
			} catch (SQLParserException e) {
				// TODO Auto-generated catch block
			} catch (SQLParserInternalException e) {
				// TODO Auto-generated catch block
			List columnList = helper.getEffectiveResultColumns(result);
			Iterator<ValueExpressionColumn> columnIterator = columnList.iterator();
				ValueExpressionColumn column =;
				System.out.println("Column name is "+column.getName());
				System.out.println("Column datatype is "+column.getDataType());

Any help is appreciated!

Previous Topic:"execute all" always splits up statements at semicolon
Next Topic:"NLS missing" messages on Ubuntu
Goto Forum:

Current Time: Sun Feb 28 10:30:48 GMT 2021

Powered by FUDForum. Page generated in 0.01912 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top