如何在SQLite中获取最后的插入Id ?
Is there any built in function available in SQLite to fetch last inserted row id. For eg :- In mysql we have LAST_INSERT_ID()
this kind of a function. For sqllite any function available for doing the same process.
SQLite中是否有内建函数可以获取最后插入的行id ?对于sqllite,可以使用任何函数来执行相同的过程。
Please help me.
请帮助我。
Thanks
谢谢
5 个解决方案
#1
19
SQLite
This is available using the SQLite last_insert_rowid()
function:
这可以使用SQLite last_insert_rowid()函数获得:
The last_insert_rowid() function returns the ROWID of the last row insert from the database connection which invoked the function. The last_insert_rowid() SQL function is a wrapper around the sqlite3_last_insert_rowid() C/C++ interface function.
函数的作用是:从调用函数的数据库连接返回最后一行插入的ROWID。last_insert_rowid() SQL函数是围绕sqlite3_last_insert_rowid() C/ c++接口函数的包装器。
PHP
The PHP version/binding of this function is sqlite_last_insert_rowid()
:
这个函数的PHP版本/绑定是sqlite_last_insert_rowid():
Returns the rowid of the row that was most recently inserted into the database dbhandle, if it was created as an auto-increment field.
返回最近插入到数据库dbhandle中的行的rowid,如果它是作为自动增量字段创建的。
更多相关文章
- MYSQL存储过程,函数,光标
- 请问mysql中有没有类似math.max(1,2)这种可以比较两个值中最大值
- SQL 函数如何设置参数默认值
- 使用不同的条件,在同一个表的一个SQL查询中使用多个聚合函数
- PHP OOP - 调用非obj上的成员函数[重复]
- sqlserver的常用函数
- SQLSERVER2005调试存储过程跟函数
- SQL Server中的TextPtr函数
- MySQL字符串相加函数如何运行?似曾相识还是记一笔吧