Re: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Jay Sprenkle
> A transactions is exactly like the original poster stated it. > > Assuming all Update, Select, Insert Commands are Atomic. A transaction > allows the user to group a bunch of commands together and state they should > be considered atomic, whereas if there is "a failure", then none of them are >

Re: [sqlite] nested functions in select

2005-05-12 Thread D. Richard Hipp
On Thu, 2005-05-12 at 21:50 -0400, Doug Henry wrote: > I was trying to do something like: select count(distinct(something)) from > table; SELECT count(*) FROM (SELECT DISTINCT something FROM table); -- D. Richard Hipp <[EMAIL PROTECTED]>

[sqlite] nested functions in select

2005-05-12 Thread Doug Henry
I was trying to do something like: select count(distinct(something)) from table; it seems this is invalid, although they work individually. Is there a way to get something like this to work in sqlite? Thanks.

RE: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread John Buck
A transactions is exactly like the original poster stated it. Assuming all Update, Select, Insert Commands are Atomic. A transaction allows the user to group a bunch of commands together and state they should be considered atomic, whereas if there is "a failure", then none of them are committed.

Re: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Jay Sprenkle
> > > MySql works like you described.. Frankly im surprised Postgres doesn't . > > Id imagine there must be a "continue trnasaction" command or something. > > You can define a 'savepoint' inside a transaction. If something goes > wrong you roll back to the savepoint and continue from there. > >

Re: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Gé Weijers
John Buck wrote: > MySql works like you described.. Frankly im surprised Postgres doesn't . > Id imagine there must be a "continue trnasaction" command or something. You can define a 'savepoint' inside a transaction. If something goes wrong you roll back to the savepoint and continue from there.

RE: [sqlite] BEGIN & COMMIT: useful for SELECT?

2005-05-12 Thread Luc Vandal
Hi Steven, This is a pretty rough example. I have my own sqlite wrapper but this could give you an idea: if( nCount > 0 ) { nRetBegin = m_sql.Exec( "BEGIN;", &szError ); for(INT i=0;imailto:[EMAIL PROTECTED] Sent: May 12, 2005 5:41 PM To: sqlite-users@sql

Re: [sqlite] BEGIN & COMMIT: useful for SELECT?

2005-05-12 Thread steven frierdich
Does anyone have any sample code on doing transactions in sqllite, and know of a website where I can read up oh how transactions work? Thanks Steve D. Richard Hipp wrote: On Thu, 2005-05-12 at 15:19 -0400, Luc Vandal wrote: are transactions only useful for when we're writting or updating the d

Re: [sqlite] BEGIN & COMMIT: useful for SELECT?

2005-05-12 Thread D. Richard Hipp
On Thu, 2005-05-12 at 15:19 -0400, Luc Vandal wrote: > are transactions only useful > for when we're writting or updating the database? Transactions are also useful when you do multiple SELECTs and you want to be sure that no other process changes the database in the between two of your SELECTs.

[sqlite] Congrats Dr. Hipp!

2005-05-12 Thread Jay Sprenkle
SQLite - destined for PHP glory By Team Register Published Wednesday 11th May 2005 13:10 GMT SQLiteSite offer SQLite is the next big thing in the PHP web development world - the popular, easy-to-use database is supported by, and bundled with PHP 5. SQLite is a small, fast, embeddable database and

Re: [sqlite] BEGIN & COMMIT: useful for SELECT?

2005-05-12 Thread Martin Engelschalk
Hi Luc, you got it: Transactions are only used when changing data, not reading it. If you only read data, you need not concern yourself with transactions. However, there are side effects: When using sqlite, you must sqlite3_finalize() all statements before ending a transaction (commit), or else

[sqlite] BEGIN & COMMIT: useful for SELECT?

2005-05-12 Thread Luc Vandal
Hi! That's probably a no brainer for you guys but are transactions only useful for when we're writting or updating the database? Buy using transactions when fetching data, do I improve anything or I shouldn't do that? Thanks! Luc

RE: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Michael Evenson
My understanding is that a SQL database server that supports stored procedures will behave that way in a stored procedure (same is true for triggers). But there is nothing to stop a command from executing just because the previous command failed. If one is 'faking' stored procedures by executing co

[sqlite] java class to connect to an sqlite DB

2005-05-12 Thread majed chatti
Hi all any one have a java class to connect to an an sqlite data base. thaks for help _ Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos mails, photos et vidéos

RE: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Vladimir Zelinski
I'm very familiar with transactions in Oracle & Sybase. The provide with mechanism to figure out state if SQL execution and COMMIT or ROLLBACK. I did not find any way to do that in SQLITE, but it has specific syntax like this bellow: BEGIN TRANSACTION ON CONFLICT ROLLBACK; END TRANSACTION; w

RE: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Brandon, Nicholas
This may not be the solution for you but I use the "on conflict" (http://www.sqlite.org/lang_conflict.html) algorithms when creating tables to automatically rollback when trying to insert duplicate contents. Nick -Original Message- From: John Buck [mailto:[EMAIL PROTECTED] Sent: 12 May 2

RE: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread John Buck
MySql works like you described.. Frankly im surprised Postgres doesn't . Id imagine there must be a "continue trnasaction" command or something. -- JB -Original Message- From: Thomas Briggs [mailto:[EMAIL PROTECTED] Sent: Thursday, May 12, 2005 12:25 PM To: sqlite-users@sqlite.org Subje

RE: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Thomas Briggs
> > This isn't an SQLite thing either... All databases work > this way, as > >far as I'm aware. > > > > > Postgres refuses to process any further sql statements in a > transaction > after an error occurs with > one of the sql statements. Heh. I should have said that "all databases wit

RE: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread John Buck
I can think of no way to implement complex atomic transactions with rollbacks in a flat SQL script. You need some sort of higher level language to make decisions about results .. IE C++ etc.. -- JB -Original Message- From: Vladimir Zelinski [mailto:[EMAIL PROTECTED] Sent: Thursday, Ma

Re: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread John LeSueur
Thomas Briggs wrote: A transaction is a way to make a group of things that happens atomic, but an SQL statement that generates an error doesn't really make anything happen, so it has no impact on the transaction itself or any of the other actions within it. That kinda the whole point, in a way -

RE: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Thomas Briggs
A transaction is a way to make a group of things that happens atomic, but an SQL statement that generates an error doesn't really make anything happen, so it has no impact on the transaction itself or any of the other actions within it. That kinda the whole point, in a way - one statement fail

Re: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Vladimir Zelinski
Here is the problem. My external program builds sql script and places into file my_script.sql Then I execute statement "sqlite3 my_db < my_script.sql" as a system call from my external program. I can check result of execution this statement and it always returns 0 (success) regardless of actual SQL

RE: [sqlite] database table is locked

2005-05-12 Thread Thomas Briggs
Aha! Now I understand what's going on. I have been completely missing the fact that everyone is trying to update the same table they're reading from. I know that's obvious to you guys, but I completely missed that subtle fact. Everything makes sense now. Thanks for your patience. :)

RE: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread John Buck
Any return other then 0 from the API function you use to exec your SQL statement is a fail. -- JB -Original Message- From: Vladimir Zelinski [mailto:[EMAIL PROTECTED] Sent: Thursday, May 12, 2005 10:31 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Does sqlite really support trans

Re: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Jay Sprenkle
On 5/12/05, Vladimir Zelinski <[EMAIL PROTECTED]> wrote: > I understand that. Question is HOW I can check if > statement failed or successful? What variable contains > status of the result of execution. The return code from the call that executes it. Are you running SQL via code or from the comman

Re: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Vladimir Zelinski
I understand that. Question is HOW I can check if statement failed or successful? What variable contains status of the result of execution. Vladimir --- Gé Weijers <[EMAIL PROTECTED]> wrote: > Vladimir, > > When you execute individual statements and > sqlite3_step or sqlite3_exec > returns an er

Re: [sqlite] Does sqlite really support transaction?

2005-05-12 Thread Gé Weijers
Vladimir, When you execute individual statements and sqlite3_step or sqlite3_exec returns an error code you should execute a 'ROLLBACK' in stead of a 'COMMIT'. So the logic is: exec "BEGIN" perform a bunch of statements if(all statements successful) exec "COMMIT" else exec "ROLLBACK" Ide

[sqlite] Does sqlite really support transaction?

2005-05-12 Thread Vladimir Zelinski
Of course, I read documentation and saw that transaction is a supported feature. But I can't get to work it. In order to make sure that we talk about the same thing I understand transaction as atomic operation. One or more data modification language statements can be placed within transaction. Onl

Re: [sqlite] UPDATE/JOIN?

2005-05-12 Thread thatsanicehatyouhave
I actually do create the new row on the "newdb" database, then attach it to the "main" one. Sorry if my notation was not clear. I'm not getting a "no such column" error - I do get a result - but it's not the one that I'm expecting. I suspect I have to accomplish what I need in code. Cheers, De

Re: [sqlite] database table is locked

2005-05-12 Thread Martin Engelschalk
Sorry, when i wrote compile() i meant sqlite3_prepare(). Martin Engelschalk schrieb: @Thomas Briggs, Jay Sprenckle I use the C Api described at http://www.sqlite.org/capi3ref.html. My code seemed to work with sqlite 3.0.7, but I cannot be too sure because my project is in development. It would tak

Re: [sqlite] database table is locked

2005-05-12 Thread Martin Engelschalk
@Thomas Briggs, Jay Sprenckle I use the C Api described at http://www.sqlite.org/capi3ref.html. My code seemed to work with sqlite 3.0.7, but I cannot be too sure because my project is in development. It would take some time to check with 3.0.7 My code worked roughly like this: I created an upda

RE: [sqlite] database table is locked

2005-05-12 Thread Thomas Briggs
> update column in result row so I won't process it again. How exactly were you doing this? Building an SQL string and executing with sqlite3_exec, or did you prepare a parameterized UPDATE statement (using sqlite3_prepare) and executing it multiple times with sqlite3_step? -Tom

Re: [sqlite] database table is locked

2005-05-12 Thread Jay Sprenkle
I had the same problem. I wrote a daemon to email people who signed up for a service and never logged in. (offering help). In pseudo code I did this: select * from people where user never logged in; for each row in result set { email offer to help; update column in result

Re: [sqlite] database table is locked

2005-05-12 Thread Martin Engelschalk
Thank you, Thomas. I used a temporary table, and now it works. However, it seems that my code worked with sqlite 2. Can this be? Martin Thomas Fjellstrom schrieb: On May 12, 2005 04:59 am, Martin Engelschalk wrote: Hello, i open cursor on a table and retrieve rows from it. For every row i decide

RE: [sqlite] database table is locked

2005-05-12 Thread Thomas Briggs
This question seems to come up often, and I'm still confused as to what problems people are having. What APIs are you using to perform these steps? In particular, when you want to update a row, are you using a prepared query that is executed multiple times, or are you creating an SQL statemen

Re: [sqlite] UPDATE/JOIN?

2005-05-12 Thread Jay Sprenkle
I believe your sql is wrong: There is no 'new_id' in attached.keyword. The alter table was applied to the other table. UPDATE attached.keyword SET new_id = keyword.id WHERE label = keyword.label; On 5/11/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > I'm wondering if SQLite suppo

Re: [sqlite] database table is locked

2005-05-12 Thread Thomas Fjellstrom
On May 12, 2005 04:59 am, Martin Engelschalk wrote: > Hello, > > i open cursor on a table and retrieve rows from it. > For every row i decide whether to update it. However, when executing > the update I get the error "database table is locked". > My application is the only one working on the table

[sqlite] database table is locked

2005-05-12 Thread Martin Engelschalk
Hello, i open cursor on a table and retrieve rows from it. For every row i decide whether to update it. However, when executing the update I get the error "database table is locked". My application is the only one working on the table. Is it illegal to update a table while selecting from it or am