Java Code Examples for java.sql.PreparedStatement.getMetaData()

The following are Jave code examples for showing how to use getMetaData() of the java.sql.PreparedStatement class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ChronoBike   File: Transcoder.java   Source Code and License Vote up 6 votes
public static void checkSQL(int nLine, String csQuery)
{
	if (m_bSQLCheck)
	{
		Connection connection = getConnection();
		try
		{
			csQuery = csQuery.trim();
			SQLTypeOperation typeOperation = SQLTypeOperation.determineOperationType(csQuery, false);
			csQuery = SQLTypeOperation.updateMarkers(csQuery);
			csQuery = SQLTypeOperation.addEnvironmentPrefix("TEST", csQuery, typeOperation, "");
			PreparedStatement statement = connection.prepareStatement(csQuery);
			statement.getMetaData(); // to validate the SQL
			statement.close();
		}
		catch (SQLException ex)
		{
			if (csQuery.indexOf("SESSION.") == -1)
			{	
				logError(nLine, ex.getMessage());
			}
			else
			{
				logWarn(nLine, ex.getMessage());
			}
		}
	}
}