private void processQuery () {
		
		// find command terminator
		int pos = query.indexOf (";\n");
		if (pos < 0)
			return;
		
		// extract query to execute
		String cmd = query.substring (0, pos+1);
		query = query.substring (pos+2);
		System.out.println ("SQL cmd: '" + cmd + "'");
		
		// drop previous result
		result = "# @SQL@: " + cmd + "\n";
		
		try {
			// execute SQL command
			Statement stmt = session.createStatement();
			if (stmt.execute (cmd)) {
				// successful:
				StringBuffer buf = new StringBuffer();
				buf.append ("# @STATUS@: SUCCESSFUL\n");
				
				// get result
				ResultSet r = stmt.getResultSet();
				if (r != null) {
					// assemble column list
					ResultSetMetaData md = r.getMetaData();
					int numCol = md.getColumnCount();
					buf.append ("# @COLS@: ");
					for (int n = 0; n < numCol; n++) {
						buf.append (md.getColumnName (n+1));
						if (n < numCol-1)
							buf.append ("¦");
					}
					buf.append ("\n");
					
					// collect result set data
					StringBuffer recBuf = new StringBuffer();
					int numRec = 0;
					while (r.next()) {
						// assemble record.
						for (int n = 0; n < numCol; n++) {
							String data = r.getString (n+1);
							recBuf.append (convert(data));
							if (n < numCol-1)
								recBuf.append ("¦");
						}
						recBuf.append ("\n");
						numRec++;
					}
					// assemble result
					buf.append ("# @RESULT@: " + numRec + "\n");
					buf.append (recBuf);
				} else
					buf.append ("# @RESULT@: NONE\n");
				result += buf.toString();
			} else
				result += "# @STATUS@: FAILED!\n";
		} catch (SQLException e) {
			result += "# @STATUS@: FAILED! (" + e.getMessage() + ")\n";
		}
	}