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]
-



[sqlite] Re: sqlite3_total_changes() and multiple connections

2007-03-03 Thread Igor Tandetnik

Ron Stevens sqlite-Y9FGH9USQxS1Z/[EMAIL PROTECTED] wrote:

I have multiple database connections opened against the same database
and I'm having problems with sqlite3_total_changes(). The docs state:

This function returns the total number of database rows that have be
modified, inserted, or deleted since the database connection was
created using sqlite3_open().

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


This is correct.


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.

Igor Tandetnik

-
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]
-