Fossil SCM

Limit the range of rowids to 0..2147483647.

drh 2013-06-20 15:17 trunk
Commit 5aa2aee95fc57611d6f32635c4ee4ad15b93b9c5
1 file changed +6 -2
+6 -2
--- src/db.c
+++ src/db.c
@@ -399,12 +399,16 @@
399399
}
400400
401401
/*
402402
** Return the rowid of the most recent insert
403403
*/
404
-i64 db_last_insert_rowid(void){
405
- return sqlite3_last_insert_rowid(g.db);
404
+int db_last_insert_rowid(void){
405
+ i64 x = sqlite3_last_insert_rowid(g.db);
406
+ if( x<0 || x>(i64)2147483647 ){
407
+ fossil_fatal("rowid out of range (0..2147483647)");
408
+ }
409
+ return (int)x;
406410
}
407411
408412
/*
409413
** Return the number of rows that were changed by the most recent
410414
** INSERT, UPDATE, or DELETE. Auxiliary changes caused by triggers
411415
--- src/db.c
+++ src/db.c
@@ -399,12 +399,16 @@
399 }
400
401 /*
402 ** Return the rowid of the most recent insert
403 */
404 i64 db_last_insert_rowid(void){
405 return sqlite3_last_insert_rowid(g.db);
 
 
 
 
406 }
407
408 /*
409 ** Return the number of rows that were changed by the most recent
410 ** INSERT, UPDATE, or DELETE. Auxiliary changes caused by triggers
411
--- src/db.c
+++ src/db.c
@@ -399,12 +399,16 @@
399 }
400
401 /*
402 ** Return the rowid of the most recent insert
403 */
404 int db_last_insert_rowid(void){
405 i64 x = sqlite3_last_insert_rowid(g.db);
406 if( x<0 || x>(i64)2147483647 ){
407 fossil_fatal("rowid out of range (0..2147483647)");
408 }
409 return (int)x;
410 }
411
412 /*
413 ** Return the number of rows that were changed by the most recent
414 ** INSERT, UPDATE, or DELETE. Auxiliary changes caused by triggers
415

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button