This convenience method assumes that the return value is a long (bigint).

@param name Function name
@param args Function arguments
@return long result
@throws SQLException if a database-access error occurs or no result
505830
public long getLong(String name, FastpathArg[] args) throws SQLException {
    byte[] returnValue = fastpath(name, args);
    if (returnValue == null) {
      throw new PSQLException(
          GT.tr("Fastpath call {0} - No result was returned and we expected a long.", name),
          PSQLState.NO_DATA);
    }
    if (returnValue.length == 8) {
      return ByteConverter.int8(returnValue, 0);

    } else {
      throw new PSQLException(
          GT.tr("Fastpath call {0} - No result was returned or wrong size while expecting a long.",
              name),
          PSQLState.NO_DATA);
    }
  }
1046846
public long getAsLong(final String name, final long defaultValue) {
        return AtsdUtil.getPropertyLongValue(fullName(name), clientProperties, defaultValue);
    }
1087748
protected int jdbcExecuteUpdate(String sql, Object... args) {
		log(sql);
		long start = System.currentTimeMillis();
		int rows = jdbcTemplate.update(sql.toString(), args);// 此处可以用jdbcTemplate，因为没有in (?)表达式
		long cost = System.currentTimeMillis() - start;
		logSlow(cost, sql, args == null ? new ArrayList<Object>() : Arrays.asList(args));
		return rows;
	}
834241
public <T> List<T> querySingleColumnTypedResults(String sql, String[] args) {
		@SuppressWarnings("unchecked")
		List<T> result = (List<T>) querySingleColumnResults(sql, args);
		return result;
	}
36874
public int executeUpdate(String name, DataObject object) throws SQLException {
        ParametricStatement statement = _statements.get(name);
        if (statement != null) {
            return statement.executeUpdate(DataSourceUtils.getConnection(_dataSource), object);
        } else {
            throw new RuntimeException("ParametricStatement '" + name + "' not found");
        }
    }
534081
public Long getLong(Map<String, Object> data, String name) {
    return get(data, name, Long.class);
  }
84128
public static Object invoke(String name, Object[] args) throws PageException {
	return invoke(null, name, args);
    }
699032
private final Long getLong(NamedList<Object> response, String... args) {
    Object objectItem = response.findRecursive(args);
    if (objectItem != null && objectItem instanceof Long) {
      return (Long) objectItem;
    } else {
      return null;
    }
  }
6673
public Long getParameterLong(String name) throws RepositoryConfigurationException
   {
      try
      {
         return StringNumberParser.parseLong(getParameterValue(name));
      }
      catch (NumberFormatException e)
      {
         throw new RepositoryConfigurationException(name + ": unparseable Long. " + e, e);
      }
   }
220592
public long getLong(String name)
    {
        long val = 0;
        try {
            val = Long.valueOf(request.getParameter(name));
        } catch (NumberFormatException e) {}
        
        return val;
    }
488938
public List<Object> querySingleRowResults(String sql, String[] args) {
		return db.querySingleRowResults(sql, args);
	}
252708
public Long execute(final ConnectionResource _con)
        throws SQLException
    {
        final boolean supGenKey = Context.getDbType().supportsGetGeneratedKeys();

        Long ret = null;
        if (this.newId && !supGenKey)  {
            ret = Context.getDbType().getNewId(_con, getTableName(), getIdColumn());
            this.column(getIdColumn(), ret);
        }

        final StringBuilder cmd = new StringBuilder()
            .append(Context.getDbType().getSQLPart(SQLPart.INSERT))
            .append(" ")
            .append(Context.getDbType().getSQLPart(SQLPart.INTO))
            .append(" ")
            .append(Context.getDbType().getTableQuote())
            .append(getTableName())
            .append(Context.getDbType().getTableQuote())
            .append(" ")
            .append(Context.getDbType().getSQLPart(SQLPart.PARENTHESIS_OPEN));

        final StringBuilder val = new StringBuilder();

        // append SQL values
        boolean first = true;
        for (final ColumnWithSQLValue col : getColumnWithSQLValues())  {
            if (first)  {
                first = false;
            } else  {
                cmd.append(Context.getDbType().getSQLPart(SQLPart.COMMA));
                val.append(Context.getDbType().getSQLPart(SQLPart.COMMA));
            }
            cmd.append(Context.getDbType().getColumnQuote())
                .append(col.getColumnName())
                .append(Context.getDbType().getColumnQuote());
            val.append(col.getSqlValue());
        }

        // append values
        for (final AbstractColumnWithValue<?> col : getColumnWithValues())  {
            if (first)  {
                first = false;
            } else  {
                cmd.append(Context.getDbType().getSQLPart(SQLPart.COMMA));
                val.append(Context.getDbType().getSQLPart(SQLPart.COMMA));
            }
            cmd.append(Context.getDbType().getColumnQuote())
                .append(col.getColumnName())
                .append(Context.getDbType().getColumnQuote());
            val.append('?');
        }
        cmd.append(Context.getDbType().getSQLPart(SQLPart.PARENTHESIS_CLOSE))
            .append(Context.getDbType().getSQLPart(SQLPart.VALUES))
            .append(Context.getDbType().getSQLPart(SQLPart.PARENTHESIS_OPEN))
            .append(val)
            .append(Context.getDbType().getSQLPart(SQLPart.PARENTHESIS_CLOSE));

        SQLInsert.LOG.debug("Executing SQL: {}", cmd.toString());

        final PreparedStatement stmt;
        if (this.newId && supGenKey) {
            if (Context.getDbType().supportsMultiGeneratedKeys()) {
                stmt = _con.prepareStatement(cmd.toString(), new String[]{ getIdColumn() });
            } else {
                stmt = _con.prepareStatement(cmd.toString(), Statement.RETURN_GENERATED_KEYS);
            }
        } else {
            stmt = _con.prepareStatement(cmd.toString());
        }

        int index = 1;
        for (final AbstractColumnWithValue<?> col : getColumnWithValues())  {
            if (SQLInsert.LOG.isDebugEnabled()) {
                SQLInsert.LOG.debug("    " + index + " = " + col.getValue());
            }
            col.set(index++, stmt);
        }

        try {
            final int rows = stmt.executeUpdate();
            if (rows == 0) {
                throw new SQLException("Object for SQL table '" + getTableName()
                        + "' does not exists and was not inserted.");
            }

            // if auto generated get new id
            if (this.newId && supGenKey) {
                final ResultSet resultset = stmt.getGeneratedKeys();
                if (resultset.next()) {
                    ret = resultset.getLong(1);
                }
                resultset.close();
            }
        } finally  {
            stmt.close();
        }

        if (this.newId && SQLInsert.LOG.isDebugEnabled()) {
            SQLInsert.LOG.debug("new generated id " + ret);
        }

        return ret;
    }
475976
public static Map<String, byte[]> getBigData(String sql, Object... arg) {
        Map<String, byte[]> bigDataMap = new HashMap<String, byte[]>();
        Connection connection = JDBCUtils.getConnection();
        PreparedStatement ps = null;
        ResultSet result = null;

        // 填充占位符
        try {
            ps = connection.prepareStatement(sql);
            for (int i = 0; i < arg.length; i++) {
                ps.setObject(i + 1, arg[i]);
            }

            // 执行SQL语句
            result = ps.executeQuery();
            // 获取字段名
            List<String> columnList = DBUtils.getColumnLabels(result);
            // 遍历结果集
            while (result.next()) {
                // 遍历字段名获取相应大数据值
                for (String column : columnList) {
                    Blob data = result.getBlob(column);
                    byte[] datas = data.getBytes(1, (int) data.length());
                    bigDataMap.put(column, datas);
                }
                break;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            JDBCUtils.release(result, ps, connection);
        }

        return bigDataMap;
    }
1250560
public Long getLong(String name) {
        Object o = get(name);
        if (o instanceof Number) {
            return ((Number)o).longValue();
        }

        if (o != null) {
            try {
                return Long.parseLong(o.toString());
            }
            catch (NumberFormatException e) {}
        }
        return null;
    }
1153404
public @NotNull OptionalLong findOptionalLong(@NotNull @SQL String sql, Object... args) {
        return findOptionalLong(SqlQuery.query(sql, args));
    }
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
    }
759071
public long getOID(String name, FastpathArg[] args) throws SQLException {
    long oid = getInteger(name, args);
    if (oid < 0) {
      oid += NUM_OIDS;
    }
    return oid;
  }