[sqlite] What is the preferred way to create SQLite databases?

2007-11-29 Thread Mark Brown
Hi-

What is the preferred way to create SQLite databases?  Ideally, I would like
to have the entire schema in a file, and then generate the DB from that, as
we make changes to the schema often.

We're currently using something called SQLite Database Browser, but I am
becoming concerned that the version of SQLite it is using is not the same as
the version of SQLite we are using in our application.

My developers all have Windows machines, but our application that uses
SQLite runs on vxWorks.

Thanks,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] RE: Doubtful code in os_unix.c

2007-11-29 Thread Mark Brown
My fix is to REMOVE the lines of code I mentioned.  The malloc is done
outside of this method already.

Thanks,
Mark


> -Original Message-
> From: Alexandre Balaban [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, November 29, 2007 11:13 AM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] RE: Doubtful code in os_unix.c
> 
> 
> Hi Simon,
> 
> yes but here this is not a memory leak issue i was talking about, but
> rather a crash :
> 
>  if( pNew==0 ){
>[...]
>releaseLockInfo(pNew->pLock);
>^- Here
>releaseOpenCnt(pNew->pOpen);
>^- and here
> 
> But okay, locking style aren't working yet under Unix and 
> will be worked
> on soon.
> 
> Regards,
> 
> Alex.
> 
> --
> ---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
> ---
> 
> 



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] ftruncate() for values greater than file size

2007-11-29 Thread Mark Brown
Hi-

I have finally tracked down a bug that has plagued by vxWorks port.  It
appears that our file system's implementation of ftruncate() does not like
to "truncate" a file larger than its current size, and returns EINVAL for
this operation.

My question...assuming that I can't get ftruncate to actually expand the
size of the database file by using this larger value, will SQLite have any
trouble with that?  If not, I'm just proposing I add a little check in this
method to get the current size of the file and then make sure that whatever
is passed to ftruncate does not exceed this value.

Thanks!
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Running SQLite tests

2007-11-26 Thread Mark Brown
Hi-

Is there any documentation on how one would run the SQLite tests?  I'm
thinking it would be an excellent test for my particular platform port.  I'm
seeing the test directory in CVS, but not exactly sure what to do with the
test files.

Thanks,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] SQLite 3.5.2 - Unix - Memory issue?

2007-11-26 Thread Mark Brown
Ah, yes.  My mistake.  Thanks.

> 
> The locking style has absolutely nothing to do with
> threads.  Locking style is what kind of file locks
> are used to prevent separate processes from updating
> the same database as the same time.  SQLite uses
> posix advisory locks by default.  Not all systems
> support posix advisory locks correctly, which is the
> reason for providing alternatives.
> --
> D. Richard Hipp <[EMAIL PROTECTED]>



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] SQLite 3.5.2 - Unix - Memory issue?

2007-11-21 Thread Mark Brown
I was using the noLocking style.  Is that essentially what you get with
SQLITE_THREADSAFE = 0?

Thanks,
Mark


> 
> I recommend that you *not* use LOCKING_STYLE.  It is
> disabled by default.  Dan and I have a note to go back
> and get the LOCKING_STYLE stuff working, but we have not
> gotten around to that yet, being distracted by more
> pressing issues.



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] SQLite 3.5.2 - Unix - Memory issue?

2007-11-21 Thread Mark Brown
Hi-

I am currently migrating over from 3.4 to 3.5.2.  I am creating a custom
VFS, but it is essentially the same as unix.

As I was going through the code, there was a particular section that made me
think that it may not have been migrated correctly.

In the fillInUnixFile() method (and assuming that
SQLITE_ENABLE_LOCKING_STYLE is defined), my concern is at line 2196:

  pNew = sqlite3_malloc( sizeof(unixFile) );

(in context, the surrounding code is:)

  pNew->dirfd = -1;
  pNew->h = h;
  SET_THREADID(pNew);
  pNew = sqlite3_malloc( sizeof(unixFile) );  /* <--- This line */
  if( pNew==0 ){
close(h);
enterMutex();
releaseLockInfo(pNew->pLock);
releaseOpenCnt(pNew->pOpen);
leaveMutex();
return SQLITE_NOMEM;
  }else{
switch(lockingStyle) {

It seems like the allocation will wipe out previous set values and cause a
memory leak.  Could someone verify?

Thanks,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] How to get 3.4.2 code

2007-11-12 Thread Mark Brown
Ah, that makes sense.  Thanks!

> 
> Mark,
> 
> I was talking about using the sqlite download page at 
> http://www.sqlite.org/download.html.
> 
> If you right click on a link (like the one for 
> sqlite3-3_5_2.zip under 
> Precompiled Binaries For Windows) and select "copy the link location" 
> (at least that's the command using Firefox), you will have a 
> link to the 
> specified file on the clipboard.
> 
> If you then paste that file name into your browser's address bar you 
> will have a URL like this http://www.sqlite.org/sqlite-3_5_2.zip that 
> you can edit. If you now change the 5 in that URL to a 4 and 
> then press 
> enter, you will start a download of sqlite-3_4_2.zip.
> 
> If you want you can simply type in the URL to start the download.
> 
> All the old versions are still on the server, they just don't have 
> clickable links on the download page, so you have to enter 
> the filename 
> with the desired version manually (or by editing a very similar URL 
> using copy and paste to minimize typing errors).



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] How to get 3.4.2 code

2007-11-09 Thread Mark Brown
Ahh...I think I figured it out.  Clicking the "Show Milestones" button was
very helpful!



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] How to get 3.4.2 code

2007-11-09 Thread Mark Brown
Hi Dennis-

Thanks for the reply.

How do I know what version of the file was part of 3.4.2 and what is part of
3.5?  I'm seeing version numbers of 1.171, for example.

Thanks,
Mark

> Mark,
> 
> Go to the download page, copy the link for the file you want 
> (with the 
> current 3..5.2 version number), paste the link into your browser's 
> address bar, then edit the link and change the version number to the 
> version you want. All the old files are still on the server, 
> there just 
> aren't any links so you have to type them in manually.
> 
> HTH
> Dennis Cote



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] How to get 3.4.2 code

2007-11-09 Thread Mark Brown
Hi-

Could someone please remind me how I can download SQLite code for version
3.4.2 from CVS?  Was there some sort of tag made that I can use?

I'm hesitant to upgrade to 3.5.x just because I'm not sure how much it has
been test driven and we are close to release.  Maybe I am being overly
concerned, and 3.5.x is actually much more stable than 3.4.x?

Thanks,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Soft Heap Limit

2007-11-09 Thread Mark Brown
Hi-

I'm currently using SQLite 3.4.1 and have been reading with interest the
large database thread.  I learned about the soft heap limit feature and was
considering using it.

While reading about the bug fixes for 3.4.2 and soft heap limit, I came
across a sample of setting the soft heap limit to 5000 bytes, in which
Ticket 2565 (http://www.sqlite.org/cvstrac/tktview?tn=2565) indicates is a
low value.

I'm wondering how much memory SQLite typically uses, especially if using the
default disabled soft heap limit.  The reason I wonder is that we have a
single thread process all of our SQLite calls, and the thread has a stack
size of 16K.  I'm wondering if we're going to be running into lots of memory
problems without the soft heap limit in place, and if I chose to set the
soft limit to, say, 2K, is performance going to suffer greatly.

Just looking for some tuning adivce.

Thanks,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Moving database connections across threads

2007-09-20 Thread Mark Brown
Thanks, John, for your reply.  We also had the same idea about wanting to
avoid the SQLITE_BUSY possibilities, and just have callers wait.

So, I think if I understand your response correctly, by having THREADSAFE=0
we have effectively commented out any code that would be trying to use
fcntrl(), and hence, we should have no problem (from a SQLite point of view)
of having multiple threads use the same connection, as long as we are
correctly controlling access to this connection with our own mutexes.

Is that right?

Thanks,
Mark

> -Original Message-
> From: John Stanton [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 19, 2007 6:54 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Moving database connections across threads
> 
> 
> The underlying issue with thread misbehaviour is that POSIX 
> file locks 
> are process specific, not thread specific requiring some 
> tormented logic 
> .  You only need the POSIX locks if you have multiple access 
> to the same 
> database and are writing to the database.
> 
> If you have a multi-threaded application and synchronize access using 
> pthread rwlocks or on Windows read/write locks made from a mutex and 
> event or semaphore then you can ignore the POSIX locks.  If 
> your traffic 
> rate is not very high you can just use a mutex around the 
> Sqlite calls 
> for synchronization.
> 
> In our threaded applications we use either rwlocks or a mutex 
> and have 
> the bonus of not having to add application logic to handle a 
> BUSY state 
> and endure busy waits and other polling indignities since the threads 
> just block when there is contention.
> 
> If you have network connected files (like SMB or NFS) or multiple 
> processes on one machine you will need the POSIX locks.
> 



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Moving database connections across threads

2007-09-19 Thread Mark Brown
Hi-

We have an application that wraps SQLite 3.4.1.  Due to some vxWorks
platform issues with non-standard posix behavior, we are considering
compiling SQLite with THREADSAFE = 0, and then having our application make
sure that only one thread can access SQLite at a time.  I was wondering
about the restriction regarding moving database connections across threads.

>From the FAQ:

"The restriction on moving database connections across threads was relaxed
somewhat in version 3.3.1.  With that and subsequent versions, it is safe to
move a connection handle across threads as long as the connection is not
holding any fcntl() locks. You can safely assume that no locks are being
held if no transaction is pending and all statements have been finalized."  

Our application has one thread that opens the database connection and other
threads that use the connection to execute SQL.  All statements are created
at start-up, executed as needed, and then finalized on shutdown.  So, we do
violate the finalize criteria mentioned above.  However, does this still
apply if THREADSAFE = 0?

Let's assume that our application can correctly protect from multiple
threads executing code in the SQLite library at the same time, and also
allows only one transaction to occur at a time.

Thanks for your help,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] SQLite Database Browser for creating databases

2007-08-23 Thread Mark Brown
Hi-
 
We are currently creating databases using this open source tool.  According
to the documentation, it is using version 3.3.5 of SQLite.  I was wondering
if there are any problems with creating a database with the tool, but then
using the database with an application that is using SQLite 3.4.1?  Would
the format of the database be compatible?
 
Thanks,
Mark


RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Mark Brown
No, not a soft link.  :)

Based on other posts I have read about threading performance and SQLite, it
seems like most people like to use a single thread.  I'm going to change our
application to use a system-wide mutex for thread synchronization and see if
that improves our results.  I'm still thinking our problems may be low-level
file i/o bugs with our OS, so perhaps taking out the file-based .lock scheme
will help.

Thanks,
Mark


> -Original Message-
> From: Ken [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 15, 2007 12:39 PM
> To: sqlite-users@sqlite.org
> Subject: RE: [sqlite] SQLITE_BUSY error in multi-threaded environment
> 
> 
> It should not.
> 
> As long as those two connections are not used across threads 
> and point to truely different databases.
> 
> They wouldn't be a soft link would they? I
> 
> 



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Mark Brown
Hi John-

There is a .lock file for each database.  From my understanding, that should
prohibit 2 connections from using the same database at the same time.
However, that is not the situation I am wondering about.  I am specifically
wondering if database activity on a connection to DB 1 would have any effect
on database activity on a different connection to DB2.

Thanks,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Mark Brown
Hi Andre-

After rereading your post, I wanted to confirm something.  In your example
below, are thread1 and thread2 connected to the same database, or different
databases?  In my scenario, the threads are connected to different
databases, so I'm not sure if it is the same situation.

Thanks,
Mark


> -Original Message-
> From: Andre du Plessis [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 15, 2007 5:05 AM
> To: sqlite-users@sqlite.org
> Subject: RE: [sqlite] SQLITE_BUSY error in multi-threaded environment
> 
> 
> Being a newbie to SQLite I've had the same problems working 
> with SQLite
> so maybe I can help, 
> It does not matter how well your database is synchronized, a common
> pitfall I had was that I would have a query object with an open cursor
> which prevents any other statement from committing to the database.
> 
> So for example:
> THREAD1 THREAD2
> LOCK
> QUERY   
> UNLOCK  LOCK
> (Step through query)BEGIN TRANSACTION
> INSERTS
> COMMIT <- SQLite busy error here 
> UNLOCK 
>  



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Mark Brown
Hi Andre-

Thank you for your insight.  Looks like we have some redesign scheduled for
today.  :)

Thanks,
Mark


> -Original Message-
> From: Andre du Plessis [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 15, 2007 5:05 AM
> To: sqlite-users@sqlite.org
> Subject: RE: [sqlite] SQLITE_BUSY error in multi-threaded environment
> 
> 
> Being a newbie to SQLite I've had the same problems working 
> with SQLite
> so maybe I can help, 



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-14 Thread Mark Brown
Hi-

I've got an application that has many different SQLite databases.  Each
database connection is opened in its own thread.  Each database has only one
connection.

I created some test cases that create a database and schema on the fly and
perform various SELECT, INSERTS, UPDATES on it.  The tests execute while the
rest of the system is running normally.

What I am seeing is that while I only have one database connection to my
test case database, and my operations on this database are done
sequentially, I have seen at random times a return of SQLITE_BUSY on either
a prepare or execute of a statement.

On a guess, I decided to stop all other database activity going on in the
system (db activity on different threads on different databases), and so
far, my test cases pass just fine.

What I was wondering is if there is any chance that database activity into
SQLite from other db connections could somehow influence my db activity on
my test database in returning a SQLITE_BUSY error.

I'm using SQLite 3.4.1 with the dotlock mechanism for thread protection on a
vxWorks custom hardware configuration.  With other problems I have had, they
turned out to be some file i/o method failing due to our custom h/w, so most
likely this is the problem, but just thought I would ask.

Thanks,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] SELECT ORDER BY failure

2007-07-19 Thread Mark Brown
No, we are actually filling in the parameter with a valid integer value.  I
was just trying to say it was a parameter.


> 
> Are you actually searching for records where F is the string "?"
> 
> If so, why don't you try WHERE F="?" instead of leaving it with the
> ? unquoted.



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Multiple connections - stale cache?

2007-07-10 Thread Mark Brown
My final post on this issue...vxWorks has confirmed a bug in their fstat()
implementation.  I'm hoping for a quick resolution.  Thanks for the help.

Mark


> 
> Just a follow-up for the group...
> 
> Richard was able to determine that my platform is having 
> trouble with an
> fstat() call to get the size of files on my file system.  



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Multiple connections - stale cache?

2007-06-28 Thread Mark Brown
Just a follow-up for the group...

Richard was able to determine that my platform is having trouble with an
fstat() call to get the size of files on my file system.  Specifically, the
call is returning a size of 0 when it should be 11K.  I am investigating the
vxWorks platform and have found that fstat() behaves correctly when I step
through my code via a debugger but not when I run it without the debugger.

This behavior is very similar to other problems we were seeing in the past
where code seemed to work while stepping through the debugger but not when
running straight out.

I have called in vxWorks support, and I'll keep the group posted of the
results.

Thanks so much!
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Multiple connections - stale cache?

2007-06-27 Thread Mark Brown
Hi-

No, I am not confident that my file locking code is working.  For vxWorks, I
needed to alter the .lock functionality, as it wouldn't compile.  Pretty
much changes such as calling stat() instead of lstat(), etc.  However, for
this example, I do know that the two threads operate serially (ie, it is
never the case that more than one SQL operation will be happening at a
time).

I have some more diagnostic information.  I'm now showing the database
connection and the SQL *about* to be executed.  I have tried to trim the
output to only show relative data, as well as changing the actual SQL
table/column names for privacy.

Here is the diagnostic output at the point the counter value was unexpected:


REPEAT TEST 1
-
DBC: 10944678 DB Counter: -61 SQL:BEGIN;
DBC: 10944678 DB Counter: -61 SQL:DELETE FROM Table1
DBC: 10944678 DB Counter: -61 SQL:DELETE FROM Table2
DBC: 10944678 DB Counter: -61 SQL:DELETE FROM Table3
DBC: 10944678 DB Counter: -61 SQL:DELETE FROM Table4
DBC: 10944678 DB Counter: -61 SQL:DELETE FROM Table5
DBC: 10944678 DB Counter: -61 SQL:DELETE FROM Table6
DBC: 10944678 DB Counter: -61 SQL:DELETE FROM Table7
DBC: 10944678 DB Counter: -61 SQL:DELETE FROM Table8
DBC: 10944678 DB Counter: -61 SQL:COMMIT;
DBC: 10944678 DB Counter: -68 SQL:INSERT INTO Table4(Col1, Col2, Col3)
VALUES (1, 1, 32751)

Here is some info around counter value -68 when it got to it during the
first test (not during the repeat of the test):

---
BEGIN TEST 1
-
DBC: 10944678 DB Counter: -70 SQL:BEGIN;
DBC: 10944678 DB Counter: -70 SQL:UPDATE Table1 SET Col1=1, Col2='Joe'
DBC: 10944678 DB Counter: -70 SQL:UPDATE Table2 SET Col1=30, Col2=0
DBC: 10944678 DB Counter: -70 SQL:COMMIT;
DBC: 10944678 DB Counter: -69 SQL:SELECT SessionNumber FROM MyTable
DBC: 10944678 got sess num = 333000
DBC: 8650883 DB Counter: -69 SQL:SELECT SessionNumber, SessionState FROM
MyTable
DBC: 8650883 Got session number: 333000
DBC: 8650883 DB Counter: -69 SQL:BEGIN;
DBC: 8650883 updating sess info, num = 35
DBC: 8650883 DB Counter: -69 SQL:UPDATE MyTable SET SessionNumber=?,
SessionState=?
DBC: 8650883 DB Counter: -69 SQL:UPDATE Table1 SET Col1=?, Col2=?, Col3=?
DBC: 8650883 DB Counter: -69 SQL:DELETE FROM Table5 WHERE Id=(SELECT Id FROM
Table8 WHERE Col4=?)
DBC: 8650883 DB Counter: -69 SQL:SELECT Id FROM Table5 ORDER BY
SequenceNumber DESC
DBC: 8650883 DB Counter: -69 SQL:COMMIT;
DBC: 8650883 DB Counter: -68 SQL:UPDATE Table8 SET Col1=? WHERE Col2=? AND
Col3=?
DBC: 8650883 DB Counter: -67 SQL:UPDATE Table8 SET Col1=? WHERE Col2=? AND
Col3=?


If you need the exact SQL statements without trimmed output, just let me
know, and I can send it to you privately.

Thanks for your help,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Multiple connections - stale cache?

2007-06-26 Thread Mark Brown
I have some odd results to report on the db counter.

I put some diagnostic code in our database wrapper class to write out the db
counter whenever a statement is executed.  It will print out for every
statement executed whether the statement is a SELECT or UPDATE or BEGIN
TRANSACTION.

Richard had mentioned reading out bytes 24-27.  Assuming this is a
zero-based index, I was seeing the 28th byte in the file changing by 1, so I
think I'm looking at the right value.  And, not knowing if the counter was
little or big endian, I just printed out all 4 bytes.

Here's the truncated results of what I saw (removing a lot of duplicated DB
Counter print outs) - the interesting part is what happens to the counter
number in the second execution of the test, as it starts shifting around.
Does this information help?


BEGIN TEST 1
-
DB Counter 0:0:42:-100
DB Counter 0:0:42:-100
DB Counter 0:0:42:-99
DB Counter 0:0:42:-98
DB Counter 0:0:42:-98
DB Counter 0:0:42:-98
DB Counter 0:0:42:-98
DBC1: Re-initializing session number to 333000
DB Counter 0:0:42:-98
DB Counter 0:0:42:-98
DB Counter 0:0:42:-98
DB Counter 0:0:42:-98
DB Counter 0:0:42:-97
DBC1: got sess num = 333000
DB Counter 0:0:42:-97
DBC2: Got session number: 333000
DB Counter 0:0:42:-97
DBC2: about to update sess info, num = 35
DB Counter 0:0:42:-97
DB Counter 0:0:42:-97
DB Counter 0:0:42:-96
DB Counter 0:0:42:-95
DB Counter 0:0:42:-94
DB Counter 0:0:42:-93
DB Counter 0:0:42:-93
DB Counter 0:0:42:-93
DB Counter 0:0:42:-93
DB Counter 0:0:42:-93
DB Counter 0:0:42:-92
DB Counter 0:0:42:-91
DB Counter 0:0:42:-90
DB Counter 0:0:42:-90
DB Counter 0:0:42:-90
DB Counter 0:0:42:-90
DBC2: Got session number: 35
DB Counter 0:0:42:-90
DBC2: about to update sess info, num = 350100
DB Counter 0:0:42:-90
DB Counter 0:0:42:-90
DB Counter 0:0:42:-89
DB Counter 0:0:42:-89
DB Counter 0:0:42:-89
DBC2: Got session number: 350100

-- END TEST --


REPEAT TEST 1
-
DB Counter 0:0:42:-89
DB Counter 0:0:42:-89
DB Counter 0:0:42:-89
DB Counter 0:0:42:-89
DB Counter 0:0:42:-96   <-- What did my code do to cause this?  I think
we're doing a bunch of (delete from table) operations on several other
tables in this database.
DB Counter 0:0:42:-95
DB Counter 0:0:42:-95
DB Counter 0:0:42:-95
DB Counter 0:0:42:-95
DB Counter 0:0:42:-95
DBC1: Re-initializing session number to 333000
DB Counter 0:0:42:-95
DB Counter 0:0:42:-95
DB Counter 0:0:42:-95
DB Counter 0:0:42:-95
DB Counter 0:0:42:-94
DBC1: got sess num = 333000
DB Counter 0:0:42:-94
DBC2: Got session number: 350100   < Wrong value
DB Counter 0:0:42:-94
DB Counter 0:0:42:-88  <--- counter went back to previous value
DB Counter 0:0:42:-87
DB Counter 0:0:42:-86
DB Counter 0:0:42:-85
DB Counter 0:0:42:-85
DB Counter 0:0:42:-85
DB Counter 0:0:42:-85
DB Counter 0:0:42:-84
DB Counter 0:0:42:-83
DB Counter 0:0:42:-82
DB Counter 0:0:42:-82
DB Counter 0:0:42:-82
DB Counter 0:0:42:-82
DBC2: Got session number: 350100

Thanks for any help,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Multiple connections - stale cache?

2007-06-26 Thread Mark Brown
Hi Richard and Joe-

It probably is some application error in our code.  What puzzles me is that
calling sqlite3_enable_shared_cache(1) appears to fix (or at least change)
the behavior.  Not sure if that triggers any ideas as to what our problem
might be.

Your suggestion of looking at the database counter is a good one.  I can
change our app to simply read those bytes and print out the value prior to
each statement we execute.  Is that what you were thinking?

We currently have the following command line switches:
-DOS_OTHER=1 -DNO_TCL -DSQLITE_DISABLE_LFS -DTHREADSAFE
-DSQLITE_ENABLE_LOCKING_STYLE

Essentially, we are on vxWorks operating system, but our build looks just
like OS_UNIX.  The THREADSAFE and SQLITE_ENABLE_LOCKING_STYLE are new
options we added recently, but we have the problem without these as well.  I
did have to comment out most of the locking styles except the .lock style
(which we are using) due to unavailability of certain headers and
functionality on vxWorks.

Thanks for your help,
Mark



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Multiple connections - stale cache?

2007-06-26 Thread Mark Brown
Thanks for the quick reply.  Unfortunately, we are developing code on the
vxWorks platform, so I don't think sample code would be of use.  We have
seen the problem for some time now...at least from 3.3.12.  The submitter of
the ticket appears to have the exact same scenario as us.  Hopefully he can
submit same sample code that will help you track down the problem.

Would there be any diagnostics (i.e. printfs) that I could enable that might
be of use?


> 
> See ticket #2458.
> 
>http://www.sqlite.org/cvstrac/tktview?tn=2458
> 
> If you can get us a reproducible test case, that will be much
> appreciated.
> 
> --
> D. Richard Hipp <[EMAIL PROTECTED]>



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Multiple connections - stale cache?

2007-06-26 Thread Mark Brown
Hi-
 
We have a scenario where we have two different database connections to the
same database.  Each database connection is running on a separate thread,
but in this situation, we are only using one connection at a time.  We are
finding that sometimes one database connection will do a "select" on the
table and not get the correct value that the other database connection
recently updated.  The connections are obtained at the beginning of the
program and not closed until the very end.
 
Essentially, we run a series of tests that are successful, then we run the
same tests again, this time failing.
 
DBC1 - begin transaction
DBC1 - sets value to 333000
DBC1 - commit transaction
DBC1 - gets value out, is 333000
DBC2 - gets value out, is 333000
DBC2 - begin transaction
DBC2 - sets value to 35
DBC2 - commit transaction
DBC2 - gets value out, is 35
DBC2 - sets value to 350100
DBC2 - gets value out, is 350100
 
*Repeat test*
 
DBC1 - begin transaction
DBC1 - sets value to 333000
DBC1 - commit transaction
DBC1 - gets value out, is 333000
DBC2 - gets value out, is 350100
 
I have noticed that if we make a call to sqlite3_enable_shared_cache just
prior to each database connection being opened, the end result is that DBC2
will get the correct value at the beginning of the second test.
 
Not really knowing the underlying details, it almosts looks like DBC2
doesn't realize the db was changed and uses what it last thought the db held
for that value.
 
Any thoughts on why we are seeing what we see?  I could add the call to
enable the shared cache, but I really want to understand why it doesn't work
without it.
 
Thanks,
Mark