spring 的JDBCTemplate的 queryForInt用法

来源:互联网 发布:淘宝怎么举报假货 编辑:程序博客网 时间:2024/06/05 05:03
  • queryForInt

    @Deprecatedpublic int queryForInt(String sql,                                   Object[] args,                                   int[] argTypes)                            throws DataAccessException
    Deprecated. 
    Description copied from interface: JdbcOperations
    Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, resulting in an int value.

    The query is expected to be a single row/single column query that results in an int value.

    Specified by:
    queryForInt in interface JdbcOperations
    Parameters:
    sql - SQL query to execute
    args - arguments to bind to the query
    argTypes - SQL types of the arguments (constants from java.sql.Types)
    Returns:
    the int value, or 0 in case of SQL NULL
    Throws:
    IncorrectResultSizeDataAccessException - if the query does not return exactly one row, or does not return exactly one column in that row
    DataAccessException - if the query fails
    See Also:
    JdbcOperations.queryForInt(String)Types
0 0
原创粉丝点击