Re: [sqlite] translate time comparison statement

2006-01-11 Thread Dennis Cote
[EMAIL PROTECTED] wrote: Mark Wyszomierski <[EMAIL PROTECTED]> wrote: SELECT school_name from schools WHERE julianday('now') - julianday(arrival_date) > 7 Dennis Cote <[EMAIL PROTECTED]> wrote: SELECT school_name from schools WHERE date(arrival_date) < date('now', '-7 days');

Re: [sqlite] translate time comparison statement

2006-01-11 Thread Dennis Cote
Mark Wyszomierski wrote: You may want WHERE julianday(date('now')) - julianday(date(arrival_date)) > 7 Mark, You should still use the 'localtime' modifier on the 'now' value if your timestamps are local time since 'now' always returns UTC times. WHERE julianday(date('now',

Re: [sqlite] translate time comparison statement

2006-01-11 Thread drh
Mark Wyszomierski <[EMAIL PROTECTED]> wrote: > > SELECT school_name from schools WHERE julianday('now') - > julianday(arrival_date) > 7 > Dennis Cote <[EMAIL PROTECTED]> wrote: > > SELECT school_name from schools > WHERE date(arrival_date) < date('now', '-7 days'); > > SELECT school_name from

Re: [sqlite] translate time comparison statement

2006-01-11 Thread Mark Wyszomierski
Cool thanks, Mark On 1/11/06, Kurt Welgehausen <[EMAIL PROTECTED]> wrote: > > You may want > > WHERE julianday(date('now')) - julianday(date(arrival_date)) > 7 > > so that time of day isn't part of the comparison; otherwise, > you're correct. > > Regards >

Re: [sqlite] translate time comparison statement

2006-01-11 Thread Kurt Welgehausen
You may want WHERE julianday(date('now')) - julianday(date(arrival_date)) > 7 so that time of day isn't part of the comparison; otherwise, you're correct. Regards

Re: [sqlite] translate time comparison statement

2006-01-11 Thread Dennis Cote
Mark Wyszomierski wrote: Hi all, I'm trying to translate some MySQL to sqlite. Ran into a problem with this time comparison statement. I translated as best I could, it seems to work, is this alright? (I'm trying to see if any records are more than 7 days old, based on the value of

[sqlite] translate time comparison statement

2006-01-11 Thread Mark Wyszomierski
Hi all, I'm trying to translate some MySQL to sqlite. Ran into a problem with this time comparison statement. I translated as best I could, it seems to work, is this alright? (I'm trying to see if any records are more than 7 days old, based on the value of 'arrival_date' field): Original:

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread John Stanton
Imagine how different the IT world would be if Microsoft had hired computer scientists instead of lawyers. We can but dream. [EMAIL PROTECTED] wrote: "Robert Simpson" <[EMAIL PROTECTED]> wrote: Not quite so straightforward in Windows: Seems like nothing ever is. (sigh) My life would

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread Robert Simpson
Rats! It figures that I'd read this right after hitting the send button: (From MSDN) If a DLL declares any nonlocal data or object as __declspec( thread ), it can cause a protection fault if dynamically loaded. After the DLL is loaded with LoadLibrary, it causes system failure whenever the

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread Robert Simpson
- Original Message - From: <[EMAIL PROTECTED]> It makes the code smaller and faster to set a flag when malloc fails, rather than trying to test for the failure all the way back up the stack. The flag used to be a global variable. But that was causing problems for embedded device

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread drh
Teg <[EMAIL PROTECTED]> wrote: > Hello drh, > > Could you perhaps give us the rational for using TLS? How is it that > TLS is needed on cases where you run out of memory? It makes the code smaller and faster to set a flag when malloc fails, rather than trying to test for the failure all the way

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread Teg
Hello drh, Could you perhaps give us the rational for using TLS? How is it that TLS is needed on cases where you run out of memory? By using TLS you're essentially making SQlite thread aware where I'd prefer it to know nothing about thread contexts or whether it's running in a thread or not. How

Re: [sqlite] Porting SQL to run on a proprietary operating system

2006-01-11 Thread Axel Mammes
I gave up on this port. Far more complicated than what I initially thought. Guess I'll have to implement stupid flat files manually. :(( On 12/30/05, Jay Sprenkle <[EMAIL PROTECTED]> wrote: > Yes, most people load the data to persistant memory when shutting > down, or periodically > to save

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread Robert Simpson
- Original Message - From: <[EMAIL PROTECTED]> No. Thread-local storage is needed to recover from out-of-memory errors. It is not optional. There is one way to do this, but it might be ugly. The way I see it, the problem lies in the fact that you are never notified when a thread

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread Will Leshner
On Jan 11, 2006, at 7:43 AM, [EMAIL PROTECTED] wrote: Seems like nothing ever is. (sigh) My life would be so much simpler if Bill Gates has stayed in school long enough to take just one course in operating systems... LOL! That's about the funniest thing I've ever heard. Do we have

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread Miguel Angel Latorre Díaz
I'm the one who posted ticket 1601. I have a multithreaded sqlite tcp server, and it ran fine with 2.8.x and 3.x versions, but this "feature" is a stopper for me. I think there is no difference using a dll or not, there is no way to free that thread memory allocated, since that function it

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread drh
"Robert Simpson" <[EMAIL PROTECTED]> wrote: > > I haven't looked too closely at the thread local data stuff recently added > to SQLite, however, is there a way to have it default to off, and opt-in at > runtime? No. Thread-local storage is needed to recover from out-of-memory errors. It is

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread Robert Simpson
- Original Message - From: <[EMAIL PROTECTED]> In the unix world using pthreads, when you allocate thread-local storage, you specify a callback function to delete the storage when the thread terminates. This callback is the second argument to pthread_key_create(), See, for example,

RE: [sqlite] Thread handling in Windows

2006-01-11 Thread Fred Williams
Damn! Then he would have ALL the money, not just a few billion! :-) > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 11, 2006 9:44 AM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Thread handling in Windows > > > "Robert

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread Robert Simpson
- Original Message - From: <[EMAIL PROTECTED]> "Robert Simpson" <[EMAIL PROTECTED]> wrote: Not quite so straightforward in Windows: Seems like nothing ever is. (sigh) My life would be so much simpler if Bill Gates has stayed in school long enough to take just one course in

Re: [sqlite] Optimizing for space and speed

2006-01-11 Thread drh
Martin O'Leary <[EMAIL PROTECTED]> wrote: > On 1/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Martin O'Leary <[EMAIL PROTECTED]> wrote: > > > > > > Also, with regard to 3.3.0, the alpha release seems to slow down my > > > example query by about 20% (The virtual machine opcodes are > > >

Re: [sqlite] Optimizing for space and speed

2006-01-11 Thread Martin O'Leary
On 1/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Martin O'Leary <[EMAIL PROTECTED]> wrote: > > > > Also, with regard to 3.3.0, the alpha release seems to slow down my > > example query by about 20% (The virtual machine opcodes are > > identical). Is this a bug? > > > > A bug is when it

Re: [sqlite] Optimizing for space and speed

2006-01-11 Thread drh
Martin O'Leary <[EMAIL PROTECTED]> wrote: > > Also, with regard to 3.3.0, the alpha release seems to slow down my > example query by about 20% (The virtual machine opcodes are > identical). Is this a bug? > A bug is when it gets the wrong answer. Nevertheless we are concerned about

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread drh
"Robert Simpson" <[EMAIL PROTECTED]> wrote: > > Not quite so straightforward in Windows: > Seems like nothing ever is. (sigh) My life would be so much simpler if Bill Gates has stayed in school long enough to take just one course in operating systems... -- D. Richard Hipp <[EMAIL PROTECTED]>

[sqlite] Re: Thread handling in Windows

2006-01-11 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: In the unix world using pthreads, when you allocate thread-local storage, you specify a callback function to delete the storage when the thread terminates. Question: How do you do the same thing on windows? If you are building a DLL, you can use

RE: [sqlite] Thread handling in Windows

2006-01-11 Thread Brandon, Nicholas
>Question: How do you do the same thing on windows? >How do you get a thread to clean up its thread-local-storage >obtained using TlsAlloc() and TlsSetValue() when the >thread terminates? You may find this example useful: http://www.codeproject.com/threads/tls.asp Regards Nick

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread Robert Simpson
- Original Message - From: <[EMAIL PROTECTED]> In the unix world using pthreads, when you allocate thread-local storage, you specify a callback function to delete the storage when the thread terminates. This callback is the second argument to pthread_key_create(), See, for example,

Re: [sqlite] Thread handling in Windows

2006-01-11 Thread ralf . deininger
Every Windows DLL can provide a DllMain function. This function gets called whenever a thread gets created or destroyed. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dllmain.asp Some example code: /** \brief */ BOOL WINAPI DllMain( HINSTANCE hinstDLL,

Re: [sqlite] Optimizing for space and speed

2006-01-11 Thread drh
[EMAIL PROTECTED] wrote: > > The query as you have specified it runs in O(NlogN) time > where N is the number of rows in the table. Actually, the original query runs in O(N) time. I was mistaken. But I still think I am right in saying that my "manual" scheme runs in O(MlogN) time. So the

[sqlite] Thread handling in Windows

2006-01-11 Thread drh
In the unix world using pthreads, when you allocate thread-local storage, you specify a callback function to delete the storage when the thread terminates. This callback is the second argument to pthread_key_create(), See, for example,

Re: [sqlite] Optimizing for space and speed

2006-01-11 Thread drh
Martin O'Leary <[EMAIL PROTECTED]> wrote: > Hi guys, > > I have a table like the following: > > CREATE TABLE user_actions ( > uid INTEGER NOT NULL, > actionid INTEGER NOT NULL, > time INTEGER NOT NULL, > status INTEGER NOT NULL, > PRIMARY KEY (uid, actionid, time, status) >

[sqlite] Optimizing for space and speed

2006-01-11 Thread Martin O'Leary
Hi guys, I have a table like the following: CREATE TABLE user_actions ( uid INTEGER NOT NULL, actionid INTEGER NOT NULL, time INTEGER NOT NULL, status INTEGER NOT NULL, PRIMARY KEY (uid, actionid, time, status) ); And I want to carry out a query something like this: SELECT

[sqlite] RE: How to compile sqlite with VC6?

2006-01-11 Thread Steve O'Hara
There is a package in the SqliteWrappers WIKI to download that does all this - http://www.pivotal-solutions.co.uk/downloads/company/pssqlite.zip It's a nice VC6 DLL wrapper for VB6 & Java with source code. Dynamically binds to the sqlite.dll and sqlite3.dll at runtime so you don't need to