Re: [sqlite] Probably not simple question

2005-12-08 Thread Wilson Yeung
I don't know of a portable representation of a byte other than a char. And while no one promises that a char is really a byte, I expect that too much code would break and so it would be many many years before this is changed in practice. Likewise, no one promises that sizeof(int) == 4, but vendor

Re: [sqlite] Probably not simple question

2005-12-08 Thread Allan Wind
On 2005-12-08T10:37:36-0800, Wilson Yeung wrote: > You're expected to cast your structure into an unsigned char *, > because in C/C++, the only portable way to represent a byte is with a > char/unsigned char. Off-topic, I suppose, but what is a portable representation of a byte? What does unsigned

Re: [sqlite] Re: SQL question - grouping records and more

2005-12-08 Thread Veysel Harun Sahin
Yes Igor. For now i do it with an aggreate function as you said. But i thought that the code can be more simple and selection run faster by using directly sql. As you said i could not be able to find any info about sql to handle this situation. Thanks. On 12/9/05, Igor Tandetnik <[EMAIL PROTECTE

[sqlite] Re: SQL question - grouping records and more

2005-12-08 Thread Igor Tandetnik
Veysel Harun Sahin wrote: I have table with the fields id, name and number. In the table there are several records with the same id and name but different numbers. For example: First record - id: 1, name: John, number: 5 Second record - id: 1, name: Joe, number: 4 Third record - id: 2, name: Ric

[sqlite] SQL question - grouping records and more

2005-12-08 Thread Veysel Harun Sahin
Hi, I have table with the fields id, name and number. In the table there are several records with the same id and name but different numbers. For example: First record - id: 1, name: John, number: 5 Second record - id: 1, name: Joe, number: 4 Third record - id: 2, name: Richard, number: 1 I want

Re[2]: [sqlite] Speed of a count operation

2005-12-08 Thread Teg
Hello Nathan, Thanks. Counting on the primary key made a HUGE difference in performance. I didn't really expect that but, am pleased with the results. I did the .explain and explain but, wasn't sure what it was telling me. C Thursday, December 8, 2005, 1:14:10 PM, you wrote: NK> On Thu, Dec

RE: [sqlite] Probably not simple question

2005-12-08 Thread erw2
Hallo, Thanks a lot, finally everything works well. Indeed, I have to learn much about SQL database usage, so sorry for that question. Regards WojciechW -Original Message- From: Wilson Yeung [mailto:[EMAIL PROTECTED] Sent: Thursday, December 08, 2005 7:38 PM To: sqlite-users@sqlite.org C

Re: [sqlite] Speed of a count operation

2005-12-08 Thread Nathan Kurz
On Thu, Dec 08, 2005 at 12:26:44PM -0500, Teg wrote: > I have a 6.5 gb database with 29,587 records in it. It takes about > 30-40 seconds for a count to return the first time I specify one in > "Sqlite3" (seeing this in my program as well). Subsequent "count" > operations are nearly instantaneous e

Re: [sqlite] Probably not simple question

2005-12-08 Thread Wilson Yeung
Oops. Line below should read: blob.setBinary((unsigned char *) &myIntDouble, sizeof(struct intDouble)); On 12/8/05, Wilson Yeung <[EMAIL PROTECTED]> wrote: > The setBinary() method takes two arguments, the unsigned char * the > size of the blob as a size_t. > > You're expected to cast your stru

Re: [sqlite] Probably not simple question

2005-12-08 Thread Wilson Yeung
The setBinary() method takes two arguments, the unsigned char * the size of the blob as a size_t. You're expected to cast your structure into an unsigned char *, because in C/C++, the only portable way to represent a byte is with a char/unsigned char. And really, what is your structure but a sequ

Re: [sqlite] sorting according to a value list?

2005-12-08 Thread Jay Sprenkle
On 12/7/05, Nathan Kurz <[EMAIL PROTECTED]> wrote: > Is there any way to sort according to the order of a value-list that > is specified with 'IN' according to the list? I've got something like: > > SELECT iid, title FROM titles WHERE iid IN (1168,80,2934,581,1631); > > Is it possible to get the r

Re: [sqlite] Probably not simple question

2005-12-08 Thread Noel Frankinet
erw2 wrote: I have follow your advice and had a look at CppSQLite. setBinary and getBinary functions work only on unsigned char, and size of intDouble is (on my PC) 8 bytes, so much more than unsigned char (1 byte). The question is how to correctly store such structure in db, and how to restore

[sqlite] Speed of a count operation

2005-12-08 Thread Teg
Using 3.2.7 I have a 6.5 gb database with 29,587 records in it. It takes about 30-40 seconds for a count to return the first time I specify one in "Sqlite3" (seeing this in my program as well). Subsequent "count" operations are nearly instantaneous even when I exit Sqlite3 and restart. I'm pretty

Re: [sqlite] sluggish performance in MacOS 10.4

2005-12-08 Thread John Stanton
Sigh Christian Smith wrote: On Thu, 8 Dec 2005, John Stanton wrote: My understanding of Sqlite is that transactions are locked by locking the entire database. Deadlocks can occur and the programmer must be aware of the possibility of a transaction temporarily failing due to a lock and of

Re: [sqlite] Probably not simple question

2005-12-08 Thread erw2
I have follow your advice and had a look at CppSQLite. setBinary and getBinary functions work only on unsigned char, and size of intDouble is (on my PC) 8 bytes, so much more than unsigned char (1 byte). The question is how to correctly store such structure in db, and how to restore it later? Rega

Re: [sqlite] sluggish performance in MacOS 10.4

2005-12-08 Thread Christian Smith
On Thu, 8 Dec 2005, John Stanton wrote: >My understanding of Sqlite is that transactions are locked by locking >the entire database. Deadlocks can occur and the programmer must be >aware of the possibility of a transaction temporarily failing due to a >lock and of the need to possibly resolve dea

Re: [sqlite] sluggish performance in MacOS 10.4

2005-12-08 Thread John Stanton
Christian Smith wrote: On Wed, 7 Dec 2005, John Stanton wrote: Christian Smith wrote: The massive overhead of MVCC is pointless when the DBMS is in a small scale application with at most a handful of concurrent transactions. Sqlite's locking method is quite appropriate at that level. Hav

RE: [sqlite] foreign keys? (sqlite3)

2005-12-08 Thread Griggs, Donald
Re: I've created a class that generates the necessary sql statements to describe the primary-foreign key relationship between two tables. Todd, I suspect there would be interest to some on the list. You may also want to review Cody Pisto's utility linked from page: http://www.sqlite.or

Re: [sqlite] sluggish performance in MacOS 10.4

2005-12-08 Thread Christian Smith
On Wed, 7 Dec 2005, John Stanton wrote: >Christian Smith wrote: >>>The massive overhead of MVCC is pointless when the DBMS is in a small >>>scale application with at most a handful of concurrent transactions. >>>Sqlite's locking method is quite appropriate at that level. >> >> >> >> Having never i

Re: [sqlite] Probably not simple question

2005-12-08 Thread drh
Nathan Kurz <[EMAIL PROTECTED]> wrote: > > Also, SQLite makes no guarantees as to the alignment of returned blobs. > > This could cause a random crash somewhere down the line. You could get > > around this by making a copy of the blob to memory obtained from malloc(). > > Can you offer more infor

Re: [sqlite] Probably not simple question

2005-12-08 Thread Dan Kennedy
typedef struct XY XY; struct XY { int x; int y; }; XY *pXY; /* When retrieving values, don't do this: */ pXY = (XY *)sqlite3_column_blob(...); /* Instead do this: */ pXY = (XY *)malloc(sizeof(XY)); memcpy(pXY, sqlite3_column_bloc(...), sizeof(XY)); --- Nathan Kurz <[EMAIL PROTECTED]>

Re: [sqlite] Probably not simple question

2005-12-08 Thread Noel Frankinet
[EMAIL PROTECTED] wrote: Hello, I have a following problem. In my program I have a vector of elements let say defined as follow: struct intDouble { int x; int y; }; Now, I would like to put the contents of this vector into sqlite table, to be able than read it back. Mayby someone can sugge