> Another question would be: When I use transactions, and I said
> ".BeginTrans"
> and insert new records and then, before saying ".CommitTrans", I query the
> records, they seem to be already saved. Can you tell me why this is so?
> Does
> a select command automatically trigger a ".CommitTrans"?
> Wishing you a happy new year!
>
>
I think it comes from the nature of transaction itself, it is not an
isolated database inside the database, it's an "undo" feature. Otherwise
many operations would have unpredictable results.
So in the example below

sqlite> Create Table [TestTable] ([Value] INTEGER);
sqlite> Begin transaction;
sqlite> INSERT INTO TestTable (Value) VALUES (11);
sqlite> SELECT Count(*) FROM TestTable;
1
sqlite> SELECT Max(rowid) FROM TestTable;
1
sqlite> SELECT * FROM TestTable;
11
sqlite> End transaction;

.. all three selects should return the same results regardless of begin/end
transaction existence in the sequence of commands and it makes sense I
think.

Max


> On Fri, Jan 1, 2010 at 9:11 AM, Olaf Schmidt <s...@online.de> wrote:
>
> >
> > "Bert Nelsen" <bert.nel...@googlemail.com> schrieb
> > im Newsbeitrag
> > news:a5ffd530912311004p26a7cc5k1f1bf6f671bef...@mail.gmail.com...
> >
> > > Your .Sychronous = False property does everything
> > > as fast as I want, and I am not afraid of losing some
> > > user data (it's not a critical application) but
> > > I am very much afraid of having a corrupted db.
> > > Can anybody please confirm
> > > that there is no chance of getting my db corrupted?
> >
> > Ah, I see now, where the "confusion" came from.
> > The wrappers Synchronous-Property has nothing to do
> > with the (relative new) async-writer-feature of SQLite -
> > instead it maps to SQLites Synchronous PRAGMA
> > (as a "convenience property").
> >
> > You can set all the Pragmas alternatively also per
> > Cnn.Execute "PRAGMA pragma_name ..."
> >
> > or read out a current Pragma-Value with:
> > Cnn.OpenRecordset("PRAGMA pragma_name")(0).Value
> >
> > Please read about SQLite-Pragmas here:
> > http://www.sqlite.org/pragma.html
> > ... and what's written there about the Synchronous-Pragma-
> > Settings. With the Synchronous-Pragma at 'Off' or '0', you're
> > risking DB-corruption.
> >
> > So, I would not touch the Synchronous-Property in your
> > case (leaving it at its default FULL(2)) - instead you should
> > wrap larger insert- or update-actions within a transaction -
> > that works fast as well.
> > Also consider using the binding-support of the wrapper
> > (the Command-Objects), to achieve faster (and more
> > typesafe) operations in "write direction".
> >
> > Olaf Schmidt
> >
> >
> >
> >
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> Regards,
> Bert
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to