本文记录一些突然很想知道的问题,可能是某个功能的实现细节,可能是某个框架的运行原理,也可能是某个事件的来龙去脉等等。反正,应该会是一些奇奇怪怪的东西吧~
框架
MyBaits 插入后如何得到生成的主键 id 的
MyBaits 中的SqlRunner
封装了PreparedStatement
,在insert
方法中,调用了Statement.getGeneratedKeys()
,然后循环将生成的主键返回。
/**
* Retrieves any auto-generated keys created as a result of executing this
* <code>Statement</code> object. If this <code>Statement</code> object did
* not generate any keys, an empty <code>ResultSet</code>
* object is returned.
*
*<p><B>Note:</B>If the columns which represent the auto-generated keys were not specified,
* the JDBC driver implementation will determine the columns which best represent the auto-generated keys.
*
* @return a <code>ResultSet</code> object containing the auto-generated key(s)
* generated by the execution of this <code>Statement</code> object
* @exception SQLException if a database access error occurs or
* this method is called on a closed <code>Statement</code>
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
* @since 1.4
*/
ResultSet getGeneratedKeys() throws SQLException;
英语
什么时候con
读/kən/
,什么时候读/kɔn/
有些发“ɔ”的音,有些发“ə”的音。重音在单词的开头,就要发的“ɔ”音,例如concentrate,重音在c上;complement,重音也在c 上。重音在单词的后面,就是“ə”音,例如computer,重音在p上;constrict,重音在s上。
comments powered by