Query for values

@param sql
sql statement
@param args
arguments
@param dataTypes
column data types
@return results
@since 3.1.0
354470
public List<List<Object>> queryResults(String sql, String[] args,
			GeoPackageDataType[] dataTypes) {
		return db.queryResults(sql, args, dataTypes);
	}
666829
public static void main(String args[]) {
        String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver";
        String url = "jdbc:db2:sample";
        String user = "Murali";
        String pass = "ibm";
        String querystring = "Select * from Murali.department";

        try {
            ConnectionProperties cp = new ConnectionProperties(dbDriver, url, user, pass);
            Query query = new Query(cp, querystring);
            QueryResults qs = query.execute();
            System.out.println("Number of rows = " + qs.size());
            for (int i = 0; i < qs.size(); i++) {
                String dept = qs.getValue("DEPTNAME", i);
                System.out.println("Department:" + dept);
            }
            /*Enumeration enum= qs.getRows();
            while (enum.hasMoreElements())
              {
              QueryRow qr = (QueryRow)enum.nextElement();
              String fn = qr.getValue("DEPT");
              String ln = qr.getValue("DEPTNAME");
            //  String bd = qr.getValue("BIRTHDATE");
              //String sal = qr.getValue("SALARY");
              System.out.println(fn + " " + ln);
            
              }*/ // while
        } // try
        catch (Exception e) {
            //com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.main", "310");
            System.out.println("Exception:: " + e.getMessage());
        } //catch
    }
851452
public static ResultSet query(Connection connection, String sql,
			String[] selectionArgs) {

		PreparedStatement statement = null;
		ResultSet resultSet = null;

		try {
			statement = connection.prepareStatement(sql);
			setArguments(statement, selectionArgs);
			resultSet = statement.executeQuery();
		} catch (SQLException e) {
			throw new GeoPackageException("Failed to execute SQL statement: "
					+ sql, e);
		} finally {
			if (resultSet == null) {
				closeStatement(statement, sql);
			}
		}

		return resultSet;
	}
223869
@Override
    public ResultSet executeQuery(String sql) throws SQLException
    {
        checkClosed();
        VoltSQL query = VoltSQL.parseSQL(sql);
        if (!query.isOfType(VoltSQL.TYPE_SELECT)) {
            throw SQLError.get(SQLError.ILLEGAL_STATEMENT, sql);
        }
        return this.executeQuery(query);
    }
1062637
public static String stringForQuery(SQLiteStatement prog, String[] selectionArgs) {
        prog.bindAllArgsAsStrings(selectionArgs);
        return prog.simpleQueryForString();
    }
541866
public List<ENTITY> findBySQL(String sql, List<?> params) {
        RowMapper<ENTITY> mapper = new GenericMapper<ENTITY, KEY>(orMapping);
        return findBySQL(sql, params, mapper);
    }
609880
public <T> T executeQuery(@NotNull ResultSetProcessor<T> processor, @NotNull @SQL String sql, Object... args) {
        return executeQuery(processor, SqlQuery.query(sql, args));
    }
701161
@SafeVarargs
  static <T> String sqlArgumentList(T... values) {
    StringBuilder sb = new StringBuilder();
    if (values.length != 0) {
      sb.append(values[0]);
      for (int i=1; i < values.length; i++) {
        sb.append(',').append(' ').append(values[i]);
      }
    }
    return sb.toString();
  }
571642
public List<Object> querySingleRowResults(String sql, String[] args) {
		return querySingleRowResults(sql, args, null);
	}
796448
public static Map<String, Object> queryForMap(String sql, Object... args) {
		Map<String, Object> result = new HashMap<String, Object>();
		List<Map<String, Object>> list = queryForList(sql, args);
		if (list.size() > 0) {
			result = list.get(0);
		}
		return result;
	}
475139
@Override
  public void findAll(Result<Iterable<byte[]>> result,
                      byte []tableKey,
                      String sql, 
                      Object[] args)
  {
    try {
      TableKraken table = _tableManager.getTable(tableKey);
      
      if (table == null) {
        throw new QueryException(L.l("'{0}' is an unknown table.",
                                     Hex.toShortHex(tableKey)));
      }
      
      QueryBuilderKraken builder = QueryParserKraken.parse(_tableManager, sql);
      
      QueryKraken query = builder.build();
      
      query.findAllLocalKeys(result, args);
    } catch (Throwable e) {
      result.fail(e);
    }
  }
9514
public static int getTypeValForSqlType(SqlType sqlType) throws SQLException {
		int[] typeVals = typeToValMap.get(sqlType);
		if (typeVals == null) {
			throw new SQLException("SqlType is unknown to type val mapping: " + sqlType);
		}
		if (typeVals.length == 0) {
			throw new SQLException("SqlType does not have any JDBC type value mapping: " + sqlType);
		} else {
			return typeVals[0];
		}
	}
1156442
public @NotNull <T> List<T> findAll(@NotNull RowMapper<T> rowMapper, @NotNull @SQL String sql, Object... args) {
        return findAll(rowMapper, SqlQuery.query(sql, args));
    }
215714
@Deprecated
	public static ResultSet query(String sql, Object... args) {
		ResultSet result = null;
		Connection con = getconnnection();
		PreparedStatement ps = null;
		try {
			ps = con.prepareStatement(sql);
			if (args != null) {
				for (int i = 0; i < args.length; i++) {
					ps.setObject((i + 1), args[i]);
				}
			}
			result = ps.executeQuery();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return result;
	}
389693
public List< T> getAllBySql(String fullSql, Object[] paramValues, Type[] paramTypes) {
        return getAllBySql(fullSql, paramValues, paramTypes, null, null);
    }
1255888
public static List<Map<String, Object>> getListMap(String sql, Object... arg) {
        Connection connection = JDBCUtils.getConnection();
        PreparedStatement ps = null;
        ResultSet result = null;
        List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
        try {
            ps = connection.prepareStatement(sql);
            for (int i = 0; i < arg.length; i++) {
                ps.setObject(i + 1, arg[i]);
            }

            result = ps.executeQuery();
            listMap = DBUtils.handleResultSetToMapList(result, listMap);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            JDBCUtils.release(result, ps, connection);
        }
        return listMap;
    }
747487
public List<List<Object>> queryResults(String sql, String[] args) {
		return queryResults(sql, args, null, null);
	}