Re: [sqlite] Bug or it makes sense?

2004-06-25 Thread Nuno Lucas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Miguel Angel Latorre Díaz wrote:
|Kenneth:
|Thanks, I see your point, but that was just an example, put an "insert" or
|"delete" command instead of the "create table", and that row would be
|"inserted" or "deleted" without executing a rollback due to the SQL error.
|I haven't tested though. But perhaps, as you said, the create table makes
|its own transaction, but that shouldn't bother the rest of statements
|included in the explicit "outer transaction". Should it?
|
|I might be missing something but any number of statements surrounded by a
|begin/commit should all be done or undone.
|
|
|
I don't know if it should be considered a bug or a feature, but what
happens is that it works as expected if you issued the all the commands
in a sentence (that is all in the same line).
When they are separate, sqlite considers it is your responsibility to
check the error returned, as the rollback has occurred already.
That case also baffled me the first time I noticed it.
Regards,
~Nuno Lucas


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFA3LKo24S9OitwspoRAiPcAJ4l0dvzT3JDLw+p08rTbxWijRbbVwCfSdUJ
dnd7Z9K+0C/iQ64Ph5RZovU=
=3Nwf
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [sqlite] Bug or it makes sense?

2004-06-25 Thread Kurt Welgehausen
This is the usual behavior.  Read the sections BEGIN TRANSACTION
and ON CONFLICT in lang.html, especially the explanation of the
ABORT algorithm.

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] Bug or it makes sense?

2004-06-25 Thread Miguel Angel Latorre Díaz
Kenneth:
Thanks, I see your point, but that was just an example, put an "insert" or
"delete" command instead of the "create table", and that row would be
"inserted" or "deleted" without executing a rollback due to the SQL error.
I haven't tested though. But perhaps, as you said, the create table makes
its own transaction, but that shouldn't bother the rest of statements
included in the explicit "outer transaction". Should it?

I might be missing something but any number of statements surrounded by a
begin/commit should all be done or undone.


- Original Message - 
From: "kenneth long" <[EMAIL PROTECTED]>
To: "Miguel_Angel_Latorre_Díaz" <[EMAIL PROTECTED]>
Sent: Friday, June 25, 2004 7:31 PM
Subject: Re: [sqlite] Bug or it makes sense?


> Miguel,
>
> I suspect that similar to most SQL languages the
> "Create" statements are their own transactions and
> perform an automatic commit.. Thats the way Oracle
> performs as do many others.
>
>
>
> --- Miguel_Angel_Latorre_Díaz
> <[EMAIL PROTECTED]> wrote:
> > Ok. But if one just does (also tried with the .read
> > metacommand):
> > sqlite3_exec (db, "begin; create table foo (value1
> > integer, value2 integer);
> > just an error; commit;", rest of params...)
> >
> > should it do the same?
> > To me, the "begin; ..." is a whole multi statement
> > which should be done
> > whitin a transaction because of the "begin". So, all
> > or nothing, but I get a
> > mixture.
> >
> >
> >
> -
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
> >
>
>
>
>
> __
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] Bug or it makes sense?

2004-06-25 Thread Miguel Angel Latorre Díaz
Ok. But if one just does (also tried with the .read metacommand):
sqlite3_exec (db, "begin; create table foo (value1 integer, value2 integer);
just an error; commit;", rest of params...)

should it do the same?
To me, the "begin; ..." is a whole multi statement which should be done
whitin a transaction because of the "begin". So, all or nothing, but I get a
mixture.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] Bug or it makes sense?

2004-06-25 Thread Miguel Angel Latorre Díaz
Ok. But if one just does:
sqlite3_exec ("begin; create table foo (value1 integer, value2 integer);
just an error; commit;", ...)

should it do the same?




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] Bug or it makes sense?

2004-06-25 Thread Brass Tilde
> SQLite version 3.0.1
> Enter ".help" for instructions
> sqlite> .tables
> sqlite> begin;
> sqlite> create table foo (value1 integer, value2 integer);
> sqlite> just an error;
> SQL error: near "just": syntax error
> sqlite> commit;
> sqlite> .tables
> foo
> sqlite>

> This was using "shell :memory:" but same happens using a file.
> Why foo table still exists?

Perhaps because you told it to commit the changes after the error occurred.
If you didn't want the changes saved in the event of an error, you should
cancel the transaction.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[sqlite] Bug or it makes sense?

2004-06-25 Thread Miguel Angel Latorre Díaz
SQLite version 3.0.1
Enter ".help" for instructions
sqlite> .tables
sqlite> begin;
sqlite> create table foo (value1 integer, value2 integer);
sqlite> just an error;
SQL error: near "just": syntax error
sqlite> commit;
sqlite> .tables
foo
sqlite>

This was using "shell :memory:" but same happens using a file.
Why foo table still exists?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]