Re: [sqlite] COMMIT or ROLLBACK failure

2013-09-19 Thread Keith Medcalf
> On Thu, Sep 19, 2013 at 4:35 PM, Richard Hipp wrote: > > On Thu, Sep 19, 2013 at 5:50 PM, Igor Korot > wrote: > > > Now, AFAIU, I need to check if the COMMIT is successful. > > > But what should I do if it fails? Do I just report the failure to > > >

Re: [sqlite] COMMIT or ROLLBACK failure

2013-09-19 Thread Igor Korot
On Thu, Sep 19, 2013 at 4:35 PM, Richard Hipp wrote: > On Thu, Sep 19, 2013 at 5:50 PM, Igor Korot wrote: > > > > > Now, AFAIU, I need to check if the COMMIT is successful. > > But what should I do if it fails? Do I just report the failure to the > user? > >

Re: [sqlite] COMMIT or ROLLBACK failure

2013-09-19 Thread Richard Hipp
On Thu, Sep 19, 2013 at 5:50 PM, Igor Korot wrote: > > Now, AFAIU, I need to check if the COMMIT is successful. > But what should I do if it fails? Do I just report the failure to the user? > Do I need to call ROLLBACK? And what if it will also fail? > And in "else" branch -

Re: [sqlite] Sqlite on Windows 8.1 Metro Application returning CannotOpen Error

2013-09-19 Thread Joe Mistachkin
Dave Protasowski wrote: > > I'm using this library the relevant code snippet is: > https://github.com/koush/sqlite-net/blob/master/src/SQLite.cs#L150 > > While debugging I've confirmed that the call to SetDirectory is > returning SQLITE_OK (0). > Are you setting the temporary directory to a

Re: [sqlite] Is this code OK?

2013-09-19 Thread Igor Tandetnik
On 9/19/2013 5:43 PM, Igor Korot wrote: If you do pass a non-NULL pointer as the last parameter, then SQLite would allocate memory for it. You should then free said memory, or else you leak it. Yes, I understand that. My question was more about re-using the variable between to calls to SQLite.

[sqlite] COMMIT or ROLLBACK failure

2013-09-19 Thread Igor Korot
Hi, ALL, Consider following piece of code: int res = sqlite3_exec(..., "BEGIN"... ); if( res != SQLITE_OK ) { printf( "Error occured on begin transaction. Please try again." ); return; } // some operations on the database // if operations are successful sqlite3_exec( ...,

Re: [sqlite] Is this code OK?

2013-09-19 Thread Igor Korot
Hi, Igor, On Thu, Sep 19, 2013 at 5:54 AM, Igor Tandetnik wrote: > On 9/19/2013 2:55 AM, Igor Korot wrote: > >> Here is the code I'm trying to use: >> >> char *errmsg = NULL; >> sqlite3_exec( handle, "BEGIN", 0, 0, ); >> if( sqlite3_exec( , ) != SQLITE_OK ) >> > > As

Re: [sqlite] Sqlite on Windows 8.1 Metro Application returning CannotOpen Error

2013-09-19 Thread Dave Protasowski
> For the first argument to sqlite3_win32_set_directory(), are you passing a > > value of SQLITE_WIN32_TEMP_DIRECTORY_TYPE (which equals 2)? Yes > Is the call to sqlite3_win32_set_directory() being executed prior to opening > > the database and is it returning SQLITE_OK? > Yes to both I'm

Re: [sqlite] Is this code OK?

2013-09-19 Thread Igor Korot
Hi, Simon, On Thu, Sep 19, 2013 at 5:16 AM, Simon Slavin wrote: > > On 19 Sep 2013, at 9:09am, Stephan Beal wrote: > > > What's the > > difference between and calling sqlite3_errmsg()? > > No difference in terms of the result, they're just to cope

Re: [sqlite] Regression: Query takes 10x longer when using version 3.8.x

2013-09-19 Thread Richard Hipp
After laboriously translating your schema and query into something readable, I get script shown below. We (all SQLite developers have been consulted and agree) conclude that the result of the query is undefined. You are sorting on the rowid of a subquery. But the rowid of a subquery is

Re: [sqlite] A graphical tool to handle sqlite schema change(more than ALTER TABLE)

2013-09-19 Thread Kees Nuyt
On Wed, 18 Sep 2013 20:53:31 -0700 (PDT), niubao wrote: >Thank you very much Simon, for your detailed and very clear explanation on >this. I wonder if there is some materials, a tutorial or something, that >are dedicated to SQLite schema change for beginners? > >There seems

Re: [sqlite] Sqlite on Windows 8.1 Metro Application returning CannotOpen Error

2013-09-19 Thread Joe Mistachkin
Dave Protasowski wrote: > > I found this page describing how sqlite on Windows RT should set the temp > file directory. http://www.sqlite.org/c3ref/temp_directory.html > > I'm using sqlite3_win32_set_directory method (in C#) to do this but I've > noticed that in some instances sqlite is still

Re: [sqlite] A graphical tool to handle sqlite schema change(more than ALTER TABLE)

2013-09-19 Thread Peter Haworth
I have a tool that will do this for you and just about any other schema changte you can think of while preservbing the data and integrity of your database. Runs on WIndows and OSX and I could produce a Linux version if necessary. Check out SQLiteAdmin at www.lcsql.com Pete On Thu, Sep 19, 2013

Re: [sqlite] Regression: Query takes 10x longer when using version 3.8.x

2013-09-19 Thread Jared Albers
What is the status on this? Is there an official ticket for this so that I can track the issue without having to look for updates on the mailing list? Do you need more information from me? -Jared ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Regression: Query takes 10x longer when using version 3.8.x

2013-09-19 Thread Richard Hipp
On Thu, Sep 19, 2013 at 12:07 PM, Jared Albers wrote: > What is the status on this? Is there an official ticket for this so that I > can track the issue without having to look for updates on the mailing list? > The status is that I was unable to replicate the problem.

[sqlite] Sqlite on Windows 8.1 Metro Application returning Cannot Open Error

2013-09-19 Thread Dave Protasowski
Hey guys, I found this page describing how sqlite on Windows RT should set the temp file directory. http://www.sqlite.org/c3ref/temp_directory.html I'm using sqlite3_win32_set_directory method (in C#) to do this but I've noticed that in some instances sqlite is still returning cannot open errors

Re: [sqlite] Question about begin/commit

2013-09-19 Thread Jan Slodicka
Under normal circumstances only these stmts perform some DB activity: - BeginTransaction - ExecuteNonQuery - Commit SqliteCommand constructor as well as the following lines (setting parameters and command text) are memory constructs that prepare data for ExecuteNonQuery. If everything works

Re: [sqlite] Is this code OK?

2013-09-19 Thread Igor Tandetnik
On 9/19/2013 2:55 AM, Igor Korot wrote: Here is the code I'm trying to use: char *errmsg = NULL; sqlite3_exec( handle, "BEGIN", 0, 0, ); if( sqlite3_exec( , ) != SQLITE_OK ) As you are not checking the return value of the first sqlite3_exec, and are not using the error message it

Re: [sqlite] Is this code OK?

2013-09-19 Thread Simon Slavin
On 19 Sep 2013, at 9:09am, Stephan Beal wrote: > What's the > difference between and calling sqlite3_errmsg()? No difference in terms of the result, they're just to cope with two different programming styles. The function is provided for situations where you have

Re: [sqlite] Is this code OK?

2013-09-19 Thread Igor Korot
Stephan, On Thu, Sep 19, 2013 at 1:09 AM, Stephan Beal wrote: > On Thu, Sep 19, 2013 at 10:06 AM, Igor Korot wrote: > > > OK, so I guess I have to call sqlite3_free(). > > Now, I do have to execute "ROLLBACK" statement, right? > > > > Correct - IMO,

Re: [sqlite] Is this code OK?

2013-09-19 Thread Stephan Beal
On Thu, Sep 19, 2013 at 10:06 AM, Igor Korot wrote: > OK, so I guess I have to call sqlite3_free(). > Now, I do have to execute "ROLLBACK" statement, right? > Correct - IMO, you have all the pieces in the right place, you just need to free the errmsg string. (i assume you

Re: [sqlite] Is this code OK?

2013-09-19 Thread Igor Korot
Stephan, On Thu, Sep 19, 2013 at 12:46 AM, Stephan Beal wrote: > On Thu, Sep 19, 2013 at 8:55 AM, Igor Korot wrote: > > > Can I reuse errmsg variable like this or do I have to call sqlite3_free() > > and then execute "ROLLBACK" statement? > > > > Per

Re: [sqlite] Is this code OK?

2013-09-19 Thread Stephan Beal
On Thu, Sep 19, 2013 at 8:55 AM, Igor Korot wrote: > Can I reuse errmsg variable like this or do I have to call sqlite3_free() and then execute "ROLLBACK" statement? > Per the API docs: ** ^If an error occurs while evaluating the SQL statements passed into **

[sqlite] Is this code OK?

2013-09-19 Thread Igor Korot
Hi, ALL, Here is the code I'm trying to use: char *errmsg = NULL; sqlite3_exec( handle, "BEGIN", 0, 0, ); if( sqlite3_exec( , ) != SQLITE_OK ) { printf( "Error executing query: %s", sqlite3_errmsg( m_handle ) ); sqlite3_exec( handle, "ROLLBACK", 0, 0, ); } Can I reuse errmsg