2 个回答
 /**
   * Execute an insert statement.
   * @param statement Unique identifier matching the statement to execute.
   * @return int The number of rows affected by the insert.
   */
  int insert(String statement);

上面是SqlSession中的insert方法, 注释中已经很清楚的说到int是insert影响的行数。

返回的是修改记录的条数,如果是插入一条记录应该返回1,通过判断是不是大于0知道插入是否成功?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题