theSq3Lite 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard - theLib - theATL
c - tcl - atl - cs - py - rb - jv - cc
Loading...
Searching...
No Matches
Sq3LiteC_Row_C_API

Sq3LiteC - work with a rowMore...

+ Collaboration diagram for Sq3LiteC_Row_C_API:

Functions

static MK_I32 Sq3LiteChanges (SQ3_LITE sq3lite)
 Count The Number Of Rows Modified …
 
static MK_I64 Sq3LiteChanges64 (SQ3_LITE sq3lite)
 Count The Number Of Rows Modified …
 
static void Sq3LiteSetLastInsertRowid (SQ3_LITE sq3lite, MK_I64 arg1)
 Set the Last Insert Rowid value …
 
static MK_I32 Sq3LiteTotalChanges (SQ3_LITE sq3lite)
 Total Number Of Rows Modified …
 
static MK_I64 Sq3LiteTotalChanges64 (SQ3_LITE sq3lite)
 Total Number Of Rows Modified …
 

Sq3LiteC - Sq3LiteC_Row_C_API - function

MK_I32 Sq3LiteChangesP (SQ3_LITE sq3lite)
 Non-inline replacement for Sq3LiteChanges
 
MK_I64 Sq3LiteChanges64P (SQ3_LITE sq3lite)
 Non-inline replacement for Sq3LiteChanges64
 
void Sq3LiteSetLastInsertRowidP (SQ3_LITE sq3lite, MK_I64 arg1)
 Non-inline replacement for Sq3LiteSetLastInsertRowid
 
MK_I32 Sq3LiteTotalChangesP (SQ3_LITE sq3lite)
 Non-inline replacement for Sq3LiteTotalChanges
 
MK_I64 Sq3LiteTotalChanges64P (SQ3_LITE sq3lite)
 Non-inline replacement for Sq3LiteTotalChanges64
 

Detailed Description

Sq3LiteC - work with a row

Function Documentation

◆ Sq3LiteChanges()

static MK_I32 Sq3LiteChanges ( SQ3_LITE sq3lite)
inlinestatic

Count The Number Of Rows Modified …

These functions return the number of rows modified, inserted or deleted by the most recently completed INSERT, UPDATE or DELETE statement on the database connection specified by the only parameter. The two functions are identical except for the type of the return value and that if the number of rows modified by the most recent INSERT, UPDATE or DELETE is greater than the maximum value supported by type "int", then the return value of Sq3LiteChanges() is undefined. Executing any other type of SQL statement does not modify the value returned by these functions.

Only changes made directly by the INSERT, UPDATE or DELETE statement are considered - auxiliary changes caused by triggers, foreign key actions or REPLACE constraint resolution are not counted.

Changes to a view that are intercepted by INSTEAD OF triggers are not counted. The value returned by Sq3LiteChanges() immediately after an INSERT, UPDATE or DELETE statement run on a view is always zero. Only changes made to real tables are counted.

Things are more complicated if the Sq3LiteChanges() function is executed while a trigger program is running. This may happen if the program uses the changes() SQL function, or if some other callback function invokes Sq3LiteChanges() directly. Essentially:

  • Before entering a trigger program the value returned by Sq3LiteChanges() function is saved. After the trigger program has finished, the original value is restored.

  • Within a trigger program each INSERT, UPDATE and DELETE statement sets the value returned by Sq3LiteChanges() upon completion as normal. Of course, this value will not include any changes performed by sub-triggers, as the Sq3LiteChanges() value will be saved and restored after each sub-trigger has run.

This means that if the changes() SQL function (or similar) is used by the first INSERT, UPDATE or DELETE statement within a trigger, it returns the value as set when the calling statement began executing. If it is used by the second or subsequent such statement within a trigger program, the value returned reflects the number of rows modified by the previous INSERT, UPDATE or DELETE statement within the same trigger.

If a separate thread makes changes on the same database connection while Sq3LiteChanges () is running then the value returned is unpredictable and not meaningful.

See also:

Reference code from sqlite3:

sqlite_int64 sqlite3_int64
struct sqlite3 sqlite3
#define SQLITE_API
SQLITE_API int sqlite3_changes(sqlite3 *)
SQLITE_API sqlite3_int64 sqlite3_changes64(sqlite3 *)

Definition at line 502 of file Sq3LiteC_sq3.h.

502 {
503 SQ3_INSTANCE_HDL(sq3lite);
504 return sqlite3_changes(sq3lite->nat);
505 }
#define SQ3_INSTANCE_HDL(x)
sqlite3 * nat
internal - link between Sq3LiteS and native library
+ Here is the caller graph for this function:

◆ Sq3LiteChanges64()

static MK_I64 Sq3LiteChanges64 ( SQ3_LITE sq3lite)
inlinestatic

Count The Number Of Rows Modified …

read more at 'Sq3LiteChanges'

Definition at line 508 of file Sq3LiteC_sq3.h.

508 {
509 SQ3_INSTANCE_HDL(sq3lite);
510 return sqlite3_changes64(sq3lite->nat);
511 }
+ Here is the caller graph for this function:

◆ Sq3LiteChanges64P()

MK_I64 Sq3LiteChanges64P ( SQ3_LITE sq3lite)

Non-inline replacement for Sq3LiteChanges64

◆ Sq3LiteChangesP()

MK_I32 Sq3LiteChangesP ( SQ3_LITE sq3lite)

Non-inline replacement for Sq3LiteChanges

◆ Sq3LiteSetLastInsertRowid()

static void Sq3LiteSetLastInsertRowid ( SQ3_LITE sq3lite,
MK_I64 arg1 )
inlinestatic

Set the Last Insert Rowid value …

The Sq3LiteSetLastInsertRowid(D, R) method allows the application to set the value returned by calling Sq3LiteLastInsertRowid(D) to R without inserting a row into the database.

Reference code from sqlite3:

SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3 *, sqlite3_int64)

Definition at line 514 of file Sq3LiteC_sq3.h.

514 {
515 SQ3_INSTANCE_HDL(sq3lite);
516 sqlite3_set_last_insert_rowid(sq3lite->nat, arg1);
517 }
+ Here is the caller graph for this function:

◆ Sq3LiteSetLastInsertRowidP()

void Sq3LiteSetLastInsertRowidP ( SQ3_LITE sq3lite,
MK_I64 arg1 )

Non-inline replacement for Sq3LiteSetLastInsertRowid

◆ Sq3LiteTotalChanges()

static MK_I32 Sq3LiteTotalChanges ( SQ3_LITE sq3lite)
inlinestatic

Total Number Of Rows Modified …

These functions return the total number of rows inserted, modified or deleted by all INSERT, UPDATE or DELETE statements completed since the database connection was opened, including those executed as part of trigger programs. The two functions are identical except for the type of the return value and that if the number of rows modified by the connection exceeds the maximum value supported by type "int", then the return value of Sq3LiteTotalChanges() is undefined. Executing any other type of SQL statement does not affect the value returned by Sq3LiteTotalChanges().

Changes made as part of foreign key actions are included in the count, but those made as part of REPLACE constraint resolution are not. Changes to a view that are intercepted by INSTEAD OF triggers are not counted.

The Sq3LiteTotalChanges (D) interface only reports the number of rows that changed due to SQL statement run against database connection D. Any changes by other database connections are ignored. To detect changes against a database file from other database connections use the PRAGMA data_version command or the SQ3_FCNTL_DATA_VERSION file control.

If a separate thread makes changes on the same database connection while Sq3LiteTotalChanges () is running then the value returned is unpredictable and not meaningful.

See also:

Reference code from sqlite3:

SQLITE_API int sqlite3_total_changes(sqlite3 *)
SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3 *)

Definition at line 520 of file Sq3LiteC_sq3.h.

520 {
521 SQ3_INSTANCE_HDL(sq3lite);
522 return sqlite3_total_changes(sq3lite->nat);
523 }
+ Here is the caller graph for this function:

◆ Sq3LiteTotalChanges64()

static MK_I64 Sq3LiteTotalChanges64 ( SQ3_LITE sq3lite)
inlinestatic

Total Number Of Rows Modified …

read more at 'Sq3LiteTotalChanges'

Definition at line 526 of file Sq3LiteC_sq3.h.

526 {
527 SQ3_INSTANCE_HDL(sq3lite);
528 return sqlite3_total_changes64(sq3lite->nat);
529 }
+ Here is the caller graph for this function:

◆ Sq3LiteTotalChanges64P()

MK_I64 Sq3LiteTotalChanges64P ( SQ3_LITE sq3lite)

Non-inline replacement for Sq3LiteTotalChanges64

◆ Sq3LiteTotalChangesP()

MK_I32 Sq3LiteTotalChangesP ( SQ3_LITE sq3lite)

Non-inline replacement for Sq3LiteTotalChanges