Re: [sqlite] What is the best way to store date value in sqlite

2005-02-21 Thread Jay
Ah, sorry, didn't know about the ole version. I'll have to check to see if they implemented that in Excel etc. I had a lot of trouble with it under Access and Excel --- "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > HI Jay, > > CTime::GetTime() return time_t which is long integer. > > Ming

Re: [sqlite] SQLite Tutorial: Request For Comments

2005-02-21 Thread Robert L Cochran
[EMAIL PROTECTED] wrote: The html has been cleaned up on the tutorial: http://prdownloads.sourceforge.net/souptonuts/README_sqlite_tutorial.html?download Has this been updated recently for the 3.1.x series? Thanks Bob Cochran

RE: [sqlite] What is the best way to store date value in sqlite

2005-02-21 Thread Dennis Volodomanov
Not correct (fully) - the CTime class does have this limit, but not COleDateTime (quote from MSDN: "The COleDateTime class handles dates from 1 January 100 - 31 December .") And you can access the double using COleDateTime::m_dt member variable. For comparison it's best to use GetYear(),

Re: [sqlite] What is the best way to store date value in sqlite

2005-02-21 Thread [EMAIL PROTECTED]
HI Jay, CTime::GetTime() return time_t which is long integer. Ming Jay wrote: The MFC date is stored as a floating point number, the unix date as a long integer. The MFC style date, used through out windows has a maximum date of somewhere around 2038AD. The unix variant goes several thousand years

Re: [sqlite] tricky date time problem

2005-02-21 Thread Jay
--- Lloyd Thomas <[EMAIL PROTECTED]> wrote: > I have a query which calculates the number of events during an hour > by the > minute. It needs to work out which minute has the most events and > the > average events during that hour. So it should return an array of 60 > results > for an hour

Re: [sqlite] What is the best way to store date value in sqlite

2005-02-21 Thread Jay
The MFC date is stored as a floating point number, the unix date as a long integer. The MFC style date, used through out windows has a maximum date of somewhere around 2038AD. The unix variant goes several thousand years farther. You could certainly store the float date as a float type field but

Re: [sqlite] What is the best way to store date value in sqlite

2005-02-21 Thread Jay
--- "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Anyway get get Unix Epoch Time in Windows MFC, or win32? Yes, the same way you do in unix. long ago; time( & ago ); = - "Lord Tarlington gazed upon the crazed Egyptian hieroglyphics on the walls of

[sqlite] sqlite_exec_printf and length modifiers

2005-02-21 Thread Tomas Franzén
Hi, Does SQLite's sqlite_exec_printf function accept length modifiers, like printf from stdio does? It doesn't seem like it does, which is bad for me who want to insert 64 bit integers (using the ll modifier). If it doesn't, any other idea of how I can convert 64 bit integers to strings before

Re: [sqlite] tricky date time problem

2005-02-21 Thread Roger Binns
I have a query which calculates the number of events during an hour by the minute. It needs to work out which minute has the most events and the average events during that hour. So it should return an array of 60 results for an hour where I can use the MAX() feature in php to find the peak

Re: [sqlite] tricky date time problem

2005-02-21 Thread Lloyd Thomas
I am trying to simplify my query but seem to be failing at the first hurdle. While if I do select * from event_id from eveny_data where event_time between '2004-04-07 10:00:00' and '2004-04-07 10:59:59'; returns 15 rows select * from event_id from eveny_data where event_time between

Re: [sqlite] What is the best way to store date value in sqlite

2005-02-21 Thread Uriel_Carrasquilla
You can use SQLite for this purpose (instead of C) as described in http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions. I don't use C under Microsoft so I can't help you there (I only use C under Linux). I do know that making Jan 1, 1970 00:00:00 the same as 0 seconds, you could write

Re: [sqlite] What is the best way to store date value in sqlite

2005-02-21 Thread [EMAIL PROTECTED]
Anyway get get Unix Epoch Time in Windows MFC, or win32? [EMAIL PROTECTED] wrote: Ming: I asked the same question about two weeks ago to this same list. I was directed to the following location: http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions I ended up saving my date/time in Unix

[sqlite] What is the best way to store date value in sqlite

2005-02-21 Thread [EMAIL PROTECTED]
Hi All, I want to store MFC date (CTime or COleDateTime) value in sqlite, but don't know what is the best way to store it. I am running into trouble when I store date as Text in sqlite, because I can't no longer apply sqlite date time functions( datetime(), date()...) to it. Result in I can't

Re: [sqlite] Feature request

2005-02-21 Thread D. Richard Hipp
On Mon, 2005-02-21 at 13:48 -0800, Jay wrote: > How about the ability to use the aliased column name in the > where, having, and order by clauses? > > I.E. > > SELECT People, ROUND(Sales,2) AS blah > FROM list_table > GROUP BY People > ORDER BY blah Works fine when I try it. -- D. Richard Hipp

[sqlite] tricky date time problem

2005-02-21 Thread Lloyd Thomas
I have a query which calculates the number of events during an hour by the minute. It needs to work out which minute has the most events and the average events during that hour. So it should return an array of 60 results for an hour where I can use the MAX() feature in php to find the peak

[sqlite] Feature request

2005-02-21 Thread Jay
How about the ability to use the aliased column name in the where, having, and order by clauses? I.E. SELECT People, ROUND(Sales,2) AS blah FROM list_table GROUP BY People ORDER BY blah = - "Lord Tarlington gazed upon the crazed Egyptian hieroglyphics on

Re: [sqlite] sluggish operation on os x?

2005-02-21 Thread Asko Kauppi
Very much so. And even to make it a runtime-changeable pragma. (Because, otherwise things like fink packages would have a difficult decision to make. only the application really knows, whether syncing is absolutely required, and to which degree. If the fink author needs to make the choice,

Re: [sqlite] sluggish operation on os x?

2005-02-21 Thread bbum
On Feb 21, 2005, at 11:44 AM, Curtis King wrote: On 21-Feb-05, at 11:11 AM, [EMAIL PROTECTED] wrote: OK -- so, you are willing to accept the risk of non-recoverable database corruption in the event of power outage or other kinds of catastrophic system failure (including the plug being pulled on

Re: [sqlite] ORDER BY / HAVING clauses and aliased field names

2005-02-21 Thread Krzysztof Kotowicz
Jay napisaÅ(a): There is no way I know of to avoid doing this. I couldn't find one in Oracle either. You can refer to them by their number: Select a, b, c FROM t Order by 1 is the same as: Select a, b, c FROM t Order by a If only this worked in HAVING clauses ;) But i guess HAVING 1 =

Re: [sqlite] sluggish operation on os x?

2005-02-21 Thread Curtis King
On 21-Feb-05, at 11:11 AM, [EMAIL PROTECTED] wrote: OK -- so, you are willing to accept the risk of non-recoverable database corruption in the event of power outage or other kinds of catastrophic system failure (including the plug being pulled on a FireWire drive without it being properly

Re: [sqlite] sluggish operation on os x?

2005-02-21 Thread Curtis King
On 21-Feb-05, at 10:39 AM, [EMAIL PROTECTED] wrote: It is a trade off between guaranteed data integrity and performance. If there happen to be a bunch of other apps writing to the disk when you do a SQLite transaction, then all of that data has to be flushed to the disk. As Domnic said,

Re: [sqlite] sluggish operation on os x?

2005-02-21 Thread bbum
On Feb 21, 2005, at 9:54 AM, James Berry wrote: On Feb 21, 2005, at 9:40 AM, Curtis King wrote: I noticed this as well, so I profiled my call and found sync was taking forever. I removed the following fcntl call, rc = fcntl(fd, F_FULLFSYNC, 0);. Performance was back to normal. Here are some

Re: [sqlite] sluggish operation on os x?

2005-02-21 Thread James Berry
On Feb 21, 2005, at 9:40 AM, Curtis King wrote: I noticed this as well, so I profiled my call and found sync was taking forever. I removed the following fcntl call, rc = fcntl(fd, F_FULLFSYNC, 0);. Performance was back to normal. Here are some comments about F_FULLFSYNC, off the darwin list just

RE: [sqlite] Making a SEQUENCE?

2005-02-21 Thread Brown, Dave
Ok - yes that works. Actually my problem was that I was using one of the GUI client interfaces to SQL lite, and it doesn't display returned results from SELECT statements when using transactions. I had actually tried the transaction approach but thought nothing was getting returned. Doh... Doing

Re: [sqlite] sluggish operation on os x?

2005-02-21 Thread Curtis King
I noticed this as well, so I profiled my call and found sync was taking forever. I removed the following fcntl call, rc = fcntl(fd, F_FULLFSYNC, 0);. Performance was back to normal. ck

Re: [sqlite] ORDER BY / HAVING clauses and aliased field names

2005-02-21 Thread Jay
--- Krzysztof Kotowicz <[EMAIL PROTECTED]> wrote: > >>WHERE 1 > >> > >> > >What is this supposed to do? It's not a boolean expression. > > > > > AFAIK it would render the same result as 1=1 (it seems that it casts > to > boolean true), at least that behaviour was observed in MySQL. >

Re: [sqlite] 2 question about SQLite types

2005-02-21 Thread Jay
--- Witold Czarnecki <[EMAIL PROTECTED]> wrote: > SELECT TYPEOF(ROUND(1)); > ... returns 'text'. Is it OK? Sorry, I asked this question 2 days ago > but I still don't know - is it a bug or not? yes but there's a fix checked in > 2. > sqlite> CREATE TABLE test(id INTEGER NOT NULL PRIMARY KEY

Re: [sqlite] Getting a list of most recent queries

2005-02-21 Thread Sijmen Mulder
> If you are talking about SQLite in general, I believe the answer is "only > if you save 'the last 10 executed SQL commands' you've performed. It > shouldn't be difficult to set up a table to hold those, and a wrapper > function that updates that table every time a query is run. Well, I'm using

Re: [sqlite] Getting a list of most recent queries

2005-02-21 Thread Brass Tilde
> > If you are talking about SQLite in general, I believe the answer is "only > > if you save 'the last 10 executed SQL commands' you've performed. It > > shouldn't be difficult to set up a table to hold those, and a wrapper > > function that updates that table every time a query is run. > >

Re: [sqlite] Getting a list of most recent queries

2005-02-21 Thread Sijmen Mulder
Hi, If you are talking about SQLite in general, I believe the answer is "only if you save 'the last 10 executed SQL commands' you've performed. It shouldn't be difficult to set up a table to hold those, and a wrapper function that updates that table every time a query is run. Well, I'm using

Re: [sqlite] Getting a list of most recent queries

2005-02-21 Thread Brass Tilde
> Hi there, > > Is it possible to get a list of say, the last 10 executed SQL commands? This > would be very usefull for debugging purposes for example. The FAQ doesn't > answer the question. If you are using the command line utility in a DOS shell in Windows, the up arrow key will show you every

Re: [sqlite] 3.1.3 does not compile on Fedora3

2005-02-21 Thread Rani Pinchuk
Hi all, As I wrote earlier today, I have already submitted this as a bug with the work-around (i.e. to install the needed library or to configure without the tcl) for version 3.1.2. I am not sure what the rest of you prefer - should we write to the list about bug we find, should we fill in the

Re: [sqlite] 3.1.3 does not compile on Fedora3

2005-02-21 Thread Igor Gorbounov
D. Richard Hipp wrote: [...] I am mistaken. It appears I changed the Makefile for 3.1.0 so that it compiles the TCL interface by default. If this is not what you want, just add --disable-tcl to ./configure. This option didn't help in my case - only adding Tcl-devel rpm package does solve the

Re: [sqlite] 3.1.3 does not compile on Fedora3

2005-02-21 Thread D. Richard Hipp
On Mon, 2005-02-21 at 06:08 -0500, D. Richard Hipp wrote: > The file tclsqlite.c is the TCL interface to SQLite. > You do not need to compile that file in order to build > just the SQLite library. You do need the TCL interface > in order to do "make test" because most of the test code > is

Re: [sqlite] 3.1.3 does not compile on Fedora3

2005-02-21 Thread D. Richard Hipp
On Mon, 2005-02-21 at 10:18 +0300, Igor Gorbounov wrote: > Hi, All! > sqlite-3.1.3.tar.gz doesn't compile on Fedora Core 3 Linux. Compiler > complains > on some Tcl stuff: > > gcc -g -O2 -DOS_UNIX=1 -DHAVE_USLEEP=1 -I. -I./src -DNDEBUG > -I/usr/include -DSQLITE_OMIT_CURSOR -c

RE: [sqlite] Making a SEQUENCE?

2005-02-21 Thread Steve O'Hara
Hi Dave, Wrap your update and select inside a transaction - the transaction is atomic in this regard and locks the table after the update and doesn't let it go until the commit/rollback. Others can read (they get the uncommitted values of course) but can't update. You will always get the latest

Re: [sqlite] 3.1.3 does not compile on Fedora3

2005-02-21 Thread Igor Gorbounov
Corwin Burgess wrote: Igor Gorbounov wrote: [...] At this point I remembered that the last time I compiled sqlite3 was on Fedora Core 1. I don't remembered where I got it but I had downloaded tcl8.4.7-src.tar.gz and installed it. After I installed it on this distro, tcl.h was found and the

[sqlite] Getting a list of most recent queries

2005-02-21 Thread Sijmen Mulder
Hi there, Is it possible to get a list of say, the last 10 executed SQL commands? This would be very usefull for debugging purposes for example. The FAQ doesn't answer the question. Thanks, Sijmen Mulder

[sqlite] 2 question about SQLite types

2005-02-21 Thread Witold Czarnecki
Hello, two questions: 1. SELECT TYPEOF(ROUND(1)); ... returns 'text'. Is it OK? Sorry, I asked this question 2 days ago but I still don't know - is it a bug or not? 2. sqlite> CREATE TABLE test(id INTEGER NOT NULL PRIMARY KEY UNIQUE, fld INTEGER); sqlite> INSERT INTO test(fld) VALUES(1);

Re: [sqlite] How to compile sqlite-3.1.3 on Fedora 3?

2005-02-21 Thread Rani Pinchuk
I submitted a bug report about it, where I also explained how to work around this problem. http://www.sqlite.org/cvstrac/tktview?tn=1123 Rani On Mon, 2005-02-21 at 08:30, Igor Gorbounov wrote: > Hi, All! > sqlite-3.1.3.tar.gz doesn't compile on Fedora Core 3 Linux. Compiler > complains > on

Re: [sqlite] 3.1.3 does not compile on Fedora3

2005-02-21 Thread Corwin Burgess
Igor Gorbounov wrote: Hi, All! sqlite-3.1.3.tar.gz doesn't compile on Fedora Core 3 Linux. Compiler complains on some Tcl stuff: gcc -g -O2 -DOS_UNIX=1 -DHAVE_USLEEP=1 -I. -I./src -DNDEBUG -I/usr/include -DSQLITE_OMIT_CURSOR -c ./src/tclsqlite.c -fPIC -DPIC -o .libs/tclsqlite.o

RE: [sqlite] Making a SEQUENCE?

2005-02-21 Thread Brown, Dave
I read that faq, but I dont see how that solves this yet. I understand how the insert will autoincrement, but I need to do "increment + return new value" in one atomic operation. If I just issue an insert, then try to use the new value from that table, I'm not guaranteed that someone else hasn't

Re: [sqlite] Making a SEQUENCE?

2005-02-21 Thread Ulrik Petersen
Hi again, Brown, Dave wrote: Is it possible to create the behaviour of a sequence with SQLite? I need to do something like this: [pseudocode] var id = SELECT next_val FROM my_sequence; INSERT INTO table1 VALUES(id, ...); INSERT INTO table2 VALUES(id, ...); I forgot to say that if you want to

Re: [sqlite] Making a SEQUENCE?

2005-02-21 Thread Ulrik Petersen
Hi Dave, Brown, Dave wrote: Is it possible to create the behaviour of a sequence with SQLite? I need to do something like this: [pseudocode] var id = SELECT next_val FROM my_sequence; INSERT INTO table1 VALUES(id, ...); INSERT INTO table2 VALUES(id, ...); This should return the next value, AND

[sqlite] sluggish operation on os x?

2005-02-21 Thread Asko Kauppi
Finally getting my SQLite3 code working, I'm experiencing awfully slow performance when writing individual data on OS X. Linux (Ubuntu) is lightning fast, Win32 is.. tolerable, but OS X really crawls. I've tried both with built-in sources, and the new SQLite3 fink module. Same behaviour. Is

[sqlite] Making a SEQUENCE?

2005-02-21 Thread Brown, Dave
Is it possible to create the behaviour of a sequence with SQLite? I need to do something like this: [pseudocode] var id = SELECT next_val FROM my_sequence; INSERT INTO table1 VALUES(id, ...); INSERT INTO table2 VALUES(id, ...); This should return the next value, AND also increment it so that