Re: [sqlite] Re: sqlite3_total_changes() and multiple connections

2007-03-04 Thread Brownie

It would be nice if sqlite stored a change count in the database that was 
easily accessible.


CREATE TABLE counter_table(n INTEGER);
INSERT INTO counter_table VALUES(0);

CREATE TRIGGER counter_trigger_insert
AFTER INSERT ON yourtable
FOR EACH ROW BEGIN
UPDATE counter_table SET n = n + 1;
END;

CREATE TRIGGER counter_trigger_update
AFTER UPDATE ON yourtable
FOR EACH ROW BEGIN
UPDATE counter_table SET n = n + 1;
END;

CREATE TRIGGER counter_trigger_delete
AFTER DELETE ON yourtable
FOR EACH ROW BEGIN
UPDATE counter_table SET n = n + 1;
END;

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Re: sqlite3_total_changes() and multiple connections

2007-03-03 Thread Ron Stevens

> but it seems like only changes made through the connection I call the
> function on are counted.

This is correct.


The documentation is misleading and should mention this limitation.


> Is there any way to get the total number of
> changes made through all opened connections?

Get the numbers for each connection, and add them up.


The connections are opened from different processes, so collecting the
numbers isn't trivial. It would be nice if sqlite stored a change
count in the database that was easily accessible.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-