Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add comments and prototype for experimental sqlite_last_statement_changes() API function. Also, allow function to be called from tcl. (CVS 1273) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ca99920b0dbf773962b47766d690154f |
User & Date: | rdc 2004-02-25 22:51:06.000 |
Context
2004-02-26
| ||
19:47 |
Build system update:
* Update of generated/libtoolized files: config.guess, config.sub, configure, ltmain.sh * Removal of libtool, which is generated by configure * Changes to Makefile.in, adding better support for newer libtools (CVS 1274) (check-in: 22d63bbf78 user: a.rottmann tags: trunk) | |
2004-02-25
| ||
22:51 | Add comments and prototype for experimental sqlite_last_statement_changes() API function. Also, allow function to be called from tcl. (CVS 1273) (check-in: ca99920b0d user: rdc tags: trunk) | |
13:47 | Min() and max() functions honor the distinction between TEXT and NUMERIC data. Ticket #623. typeof() is now a user function. Some tests are now failing due to ticket #521. (CVS 1272) (check-in: adbe31adf1 user: drh tags: trunk) | |
Changes
Changes to src/func.c.
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** |
︙ | |||
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | + + + + + + + + + | ** value is the same as the sqlite_last_insert_rowid() API function. */ static void last_insert_rowid(sqlite_func *context, int arg, const char **argv){ sqlite *db = sqlite_user_data(context); sqlite_set_result_int(context, sqlite_last_insert_rowid(db)); } /* ** Implementation of the change_count() SQL function. The return ** value is the same as the sqlite_changes() API function. */ static void change_count(sqlite_func *context, int arg, const char **argv){ sqlite *db = sqlite_user_data(context); sqlite_set_result_int(context, sqlite_changes(db)); } /* ** Implementation of the last_statement_change_count() SQL function. The ** return value is the same as the sqlite_last_statement_changes() API function. */ static void last_statement_change_count(sqlite_func *context, int arg, const char **argv){ sqlite *db = sqlite_user_data(context); sqlite_set_result_int(context, sqlite_last_statement_changes(db)); } /* |
︙ |
Changes to src/main.c.
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - + | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** |
︙ | |||
541 542 543 544 545 546 547 548 549 550 551 552 553 554 | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | + + + + + + | /* ** Return the number of changes in the most recent call to sqlite_exec(). */ int sqlite_changes(sqlite *db){ return db->nChange; } /* ** Return the number of changes produced by the last INSERT, UPDATE, or ** DELETE statement to complete execution. The count does not include ** changes due to SQL statements executed in trigger programs that were ** triggered by that statement */ int sqlite_last_statement_changes(sqlite *db){ return db->lsChange; } /* ** Close an existing SQLite database */ |
︙ |
Changes to src/sqlite.h.in.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the SQLite library ** presents to client programs. ** |
︙ | |||
200 201 202 203 204 205 206 207 208 209 210 211 212 213 | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | + + + + + + + + + + + + + + + + + + + + + + + + + + | ** this optimization, the change count for "DELETE FROM table" will be ** zero regardless of the number of elements that were originally in the ** table. To get an accurate count of the number of rows deleted, use ** "DELETE FROM table WHERE 1" instead. */ int sqlite_changes(sqlite*); /* ** This function returns the number of database rows that were changed ** by the last INSERT, UPDATE, or DELETE statment executed by sqlite_exec(), ** or by the last VM to run to completion. The change count is not updated ** by SQL statements other than INSERT, UPDATE or DELETE. ** ** Changes are counted, even if they are later undone by a ROLLBACK or ** ABORT. Changes associated with trigger programs that execute as a ** result of the INSERT, UPDATE, or DELETE statement are not counted. ** ** If a callback invokes sqlite_exec() recursively, then the changes ** in the inner, recursive call are counted together with the changes ** in the outer call. ** ** SQLite implements the command "DELETE FROM table" without a WHERE clause ** by dropping and recreating the table. (This is much faster than going ** through and deleting individual elements form the table.) Because of ** this optimization, the change count for "DELETE FROM table" will be ** zero regardless of the number of elements that were originally in the ** table. To get an accurate count of the number of rows deleted, use ** "DELETE FROM table WHERE 1" instead. ** ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ****** */ int sqlite_last_statement_changes(sqlite*); /* If the parameter to this routine is one of the return value constants ** defined above, then this routine returns a constant text string which ** descripts (in English) the meaning of the return value. */ const char *sqlite_error_string(int); #define sqliteErrStr sqlite_error_string /* Legacy. Do not use in new code. */ |
︙ |
Changes to src/tclsqlite.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** A TCL Interface to SQLite ** |
︙ | |||
484 485 486 487 488 489 490 | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | - - - - - + + + + + + - - - - - + + + + + + | ** subroutine to be invoked. */ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ SqliteDb *pDb = (SqliteDb*)cd; int choice; int rc = TCL_OK; static const char *DB_strs[] = { |
︙ | |||
655 656 657 658 659 660 661 662 663 664 665 666 667 668 | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | + + + + + + + + + + + + + + + + + + + + | return TCL_ERROR; } nChange = sqlite_changes(pDb->db); pResult = Tcl_GetObjResult(interp); Tcl_SetIntObj(pResult, nChange); break; } /* ** $db last_statement_changes ** ** Return the number of rows that were modified, inserted, or deleted by ** the last statment to complete execution (excluding changes due to ** triggers) */ case DB_LAST_STATEMENT_CHANGES: { Tcl_Obj *pResult; int lsChange; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } lsChange = sqlite_last_statement_changes(pDb->db); pResult = Tcl_GetObjResult(interp); Tcl_SetIntObj(pResult, lsChange); break; } /* $db close ** ** Shutdown the database */ case DB_CLOSE: { Tcl_DeleteCommand(interp, Tcl_GetStringFromObj(objv[0], 0)); |
︙ |
Changes to test/tclsqlite.test.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - + - + | # This file implements regression tests for TCL interface to the # SQLite library. # # Actually, all tests are based on the TCL interface, so the main # interface is pretty well tested. This file contains some addition # tests for fringe issues that the main test suite does not cover. # |
︙ |