Re: [sqlite] 64 bit compatibility of sqlite 3.5.7

2009-06-04 Thread Mark Spiegel
For 32 bits it should be a long, for 64 bites, a 64 bit integer type. For example __int64 in Windows. sqlite3_intptr_t has to be large enough to hold the larger of an integer or a pointer on each platform. We had to fix this too... Gopala Surya wrote: > Hi All > We have been using sqlite

Re: [sqlite] Concat two fields for LIKE query?

2009-06-04 Thread John Machin
On 5/06/2009 7:46 AM, Andrés G. Aragoneses wrote: > Igor Tandetnik wrote: >> "Andrés G. Aragoneses" >> wrote: >>> My query, which I want to make it return the first row: >>> >>> SELECT * FROM SomeTable WHERE Path+FileName LIKE '%user/File%' >> SELECT * FROM SomeTable WHERE Path

Re: [sqlite] Concat two fields for LIKE query?

2009-06-04 Thread P Kishor
2009/6/4 "Andrés G. Aragoneses" : > Igor Tandetnik wrote: >> "Andrés G. Aragoneses" >> wrote: >>> My query, which I want to make it return the first row: >>> >>> SELECT * FROM SomeTable WHERE Path+FileName LIKE '%user/File%' >> >> SELECT * FROM SomeTable WHERE

Re: [sqlite] Concat two fields for LIKE query?

2009-06-04 Thread Igor Tandetnik
"Andrés G. Aragoneses" wrote: > Igor Tandetnik wrote: >> "Andrés G. Aragoneses" >> wrote: >>> My query, which I want to make it return the first row: >>> >>> SELECT * FROM SomeTable WHERE Path+FileName LIKE '%user/File%' >> >> SELECT * FROM SomeTable WHERE

Re: [sqlite] Concat two fields for LIKE query?

2009-06-04 Thread Andrés G. Aragoneses
Igor Tandetnik wrote: > "Andrés G. Aragoneses" > wrote: >> My query, which I want to make it return the first row: >> >> SELECT * FROM SomeTable WHERE Path+FileName LIKE '%user/File%' > > SELECT * FROM SomeTable WHERE Path || FileName LIKE '%user/File%'; > > In SQL, string

Re: [sqlite] Concat two fields for LIKE query?

2009-06-04 Thread Igor Tandetnik
"Andrés G. Aragoneses" wrote: > My query, which I want to make it return the first row: > > SELECT * FROM SomeTable WHERE Path+FileName LIKE '%user/File%' SELECT * FROM SomeTable WHERE Path || FileName LIKE '%user/File%'; In SQL, string concatenation operator is ||, not +.

[sqlite] Concat two fields for LIKE query?

2009-06-04 Thread Andrés G. Aragoneses
Schema: CREATE TABLE SomeTable ( ID INTEGER NOT NULL PRIMARY KEY, Path TEXT, FileName TEXT ) Content (2 rows): 1 /home/user/ File.mp3 2 /home/user/M/ File.mp3 My query, which I want to make it return the first row: SELECT * FROM

Re: [sqlite] Inconsistency in the treatment of numbers?

2009-06-04 Thread Jay A. Kreibich
On Thu, Jun 04, 2009 at 02:14:19PM -0700, PFudd scratched on the wall: > Hi.. > > I'm not sure if I've found a bug or not. I've created a table like so: > > CREATE TABLE desc (number primary key, full_line); Lacking a type, the affinity will be NONE. That means no conversion will be done.

[sqlite] Inconsistency in the treatment of numbers?

2009-06-04 Thread PFudd
Hi.. I'm not sure if I've found a bug or not. I've created a table like so: CREATE TABLE desc (number primary key, full_line); Then I've loaded it with taxonomy numbers from NCBI (where "9606" means "Homo Sapiens", for instance). sqlite> select * From desc where number="9606"; 9606|Homo

Re: [sqlite] Getting last inserted rowid?

2009-06-04 Thread Igor Tandetnik
John Elrick wrote: > Nuno Lucas wrote: >> If you open a sqlite shell and do: >> >> SQLite version 3.6.14.2 >> Enter ".help" for instructions >> Enter SQL statements terminated with a ";" >> sqlite> begin; >> sqlite> begin; > > Since we are discussing threads here, the

Re: [sqlite] Getting last inserted rowid?

2009-06-04 Thread John Elrick
Nuno Lucas wrote: > On Wed, Jun 3, 2009 at 11:22 PM, Nikolaus Rath wrote: > >> Nuno Lucas writes: >> >>> On Wed, Jun 3, 2009 at 2:41 AM, Nikolaus Rath wrote: >>> Nuno Lucas writes:

[sqlite] 64 bit compatibility of sqlite 3.5.7

2009-06-04 Thread Gopala Surya
Hi All We have been using sqlite version 3.5.7 for our development in a 32 bit environment. We are moving to 64 bit and I am trying to build sqlite3.c. I see that sqlite3.c ver 3.5.7 has a typedef as follows: typedef int sqlite3_intptr_t; This causes the compiler to complain about

Re: [sqlite] SQL lite memory problem

2009-06-04 Thread D. Richard Hipp
On Jun 4, 2009, at 2:57 PM, Mohey Eldin Hamdy wrote: > According to http://www.sqlite.org/cvstrac/wiki?p=SizeOfSqlite > > with no optimization the maximum size should be 513 KB. > > The problem is that in three different cases on three different Linux > distributions, which are Fedora 7.0,

Re: [sqlite] SQL lite memory problem

2009-06-04 Thread Mihai Limbasan
Most likely you compiled the sources with debugging symbols turned on. Are the resulting binaries still too big after you've run strip on them? On 06/04/2009 09:57 PM, Mohey Eldin Hamdy wrote: > According to http://www.sqlite.org/cvstrac/wiki?p=SizeOfSqlite > >with no optimization the

[sqlite] SQL lite memory problem

2009-06-04 Thread Mohey Eldin Hamdy
According to http://www.sqlite.org/cvstrac/wiki?p=SizeOfSqlite with no optimization the maximum size should be 513 KB. The problem is that in three different cases on three different Linux distributions, which are Fedora 7.0, Debian and ubuntu the size is usually 1.3 MB. Does any body know

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Simon Slavin
On 4 Jun 2009, at 2:48pm, Mark Hamburg wrote: > One of the questions that I believe was raised but not answered on > this thread was how to make sure that you don't have circular > relationships particularly given that SQLite isn't good at scanning > the tree. I don't think it can be done

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread John Elrick
John Machin wrote: > On 5/06/2009 12:59 AM, Griggs, Donald wrote: > >> Regarding: >>I could start the id initially with 10 to allocate >> >> That WOULD allow for a bunch of bull.;-) >> > > Don't horse about with IDs with attached meaning; it's a cow of a > concept whose

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread John Machin
On 5/06/2009 12:59 AM, Griggs, Donald wrote: > Regarding: >I could start the id initially with 10 to allocate > > That WOULD allow for a bunch of bull.;-) Don't horse about with IDs with attached meaning; it's a cow of a concept whose outworking could well be catastrophic and

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Griggs, Donald
Regarding: I could start the id initially with 10 to allocate That WOULD allow for a bunch of bull.;-) ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Jan
Hi Mark, I think that wont work: Scenario: A calf is born from a mother within your flock but from a father outside. The father appears for the first time and you are not able to gather information on his father (or grand-grand father). Therefore his father is NULL. But later you get the

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Mark Hamburg
One of the questions that I believe was raised but not answered on this thread was how to make sure that you don't have circular relationships particularly given that SQLite isn't good at scanning the tree. If you can control the id's then simply require that the id of the child be greater

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread P Kishor
On Thu, Jun 4, 2009 at 7:31 AM, Fred Williams wrote: > > Nothing to do with relational databases, but if you are developing for a > future animal husbandry environment I would plan on supporting clones.  Like > it philosophically or not. sadly, SQLite doesn't have

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Fred Williams
Nothing to do with relational databases, but if you are developing for a future animal husbandry environment I would plan on supporting clones. Like it philosophically or not. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]on Behalf Of

Re: [sqlite] Getting last inserted rowid?

2009-06-04 Thread Nuno Lucas
On Wed, Jun 3, 2009 at 11:22 PM, Nikolaus Rath wrote: > Nuno Lucas writes: >> On Wed, Jun 3, 2009 at 2:41 AM, Nikolaus Rath wrote: >>> Nuno Lucas writes: On Tue, May 26, 2009 at 5:17 PM, Nikolaus Rath

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Ibrahim A
Jan schrieb: > thx Ibrahim. Give me some time to digest yours and other suggestions. > > But it seems I will end up with a adjunct list PLUS something. Of course > you are right: I need to store many other information for each animal. I > definitely need to use a database (sqlite of course). It

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Jan
thx Ibrahim. Give me some time to digest yours and other suggestions. But it seems I will end up with a adjunct list PLUS something. Of course you are right: I need to store many other information for each animal. I definitely need to use a database (sqlite of course). It will be used for

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Ibrahim A
One further advice : The fastest solution for your Problem would be to create a Array with fixed size Entries to describe the relationship between animals. in C you would simply end up with a struct like : struct ancestors { integer id_father ; integer id_mother ; } ; If you have a

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Ibrahim A
Jan schrieb: > Hi, > > I am planning a database for animal breeding. I need to store the > relations between individuals and therefore I have to build something > like a tree structure. But of course with two parents (There wont be > cloned animals in the database .-) afaik) > > I read a little

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread Ibrahim A
Assumptions : Your database scheme contains this declarations CREATE TABLE data ( num INTEGER, di CHAR(4), data CHAR(12), time1 INTEGER, time2 INTEGER, format CHAR(1) ); CREATE UNIQUE INDEX i_data ON data ( num, di, time1 ); You want to do : A)

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread Simon Slavin
On 4 Jun 2009, at 7:39am, liubin liu wrote: > INSERT OR REPLACE INTO data (num, di, time1) VALUES (12, '1290', > '732e4a39', 8323000, 8323255, 22); > > the sqlite3 report a error: > SQL error: 6 values for 3 columns > > Does It mean the method isn't the right way? Here are 6 values: >

Re: [sqlite] sqlite programmed in C++ ...

2009-06-04 Thread John Stanton
To make technical decisions using emotion rather than logic is not a good approach. One should choose the best methodology for the particular project, not be self indulgent and choose the one you like. Recently we wrote an embedded application in C, permitting us to use the available C

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread Martin.Engelschalk
Hi, what do you mean by "command"? The command line tool takes commands entered by the user, such as SQL - statements. These do not have returncodes. If an error occurs, the command line tool will print out the error message. The functions of the sqlite3 library have returncodes, but they can

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread liubin liu
and I think of another question: how to know the return value of a command IN the command-line mode of sqlite3? Martin Engelschalk wrote: > > Hi, > > First, you have to declare the index as unique: > > CREATE UNIQUE INDEX i_data ON data (num, di, time1); > > or - depending on your database

Re: [sqlite] sqlite programmed in C++

2009-06-04 Thread Jean-Denis Muys
This is funny how language trends get interesting and sometimes a bit emotional too. We all have an opinion on them, and here is mine :-) The basic idea going around in this thread is a very conservative "C is best because 1) it's universally portable, and/or 2) it's very close to the machine (ie

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread liubin liu
Yeah! Thank you very very much! this way could get my goal. but I am afraid the sql will cause some sqlite3 err? Martin Engelschalk wrote: > > Hi, > > First, you have to declare the index as unique: > > CREATE UNIQUE INDEX i_data ON data (num, di, time1); > > or - depending on your

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread Martin.Engelschalk
Hi, First, you have to declare the index as unique: CREATE UNIQUE INDEX i_data ON data (num, di, time1); or - depending on your database design, declare a primary key with these three fields. Second, the error message says it all: You supplied three column - names, but 6 values. Martin

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread liubin liu
column name and table name is my fault, :) the sql "INSERT OR REPLACE INTO table () VALUES ()" is equal with "INSERT INTO table VALUES()" so It can't achieve my goal. Harold Wood Meyuni Gani wrote: > > Well you have a column named data and a table named data, but the biggest > issue is you

Re: [sqlite] Db design question (so. like a tree)

2009-06-04 Thread Jan
Thanks Dennis and Jay. I'll go through your posts. It seems your approach "extends" the list model i'd like to use. All other approaches seem to be very (too) complex. It is somehow strange that something as universal and simple like a family tree is so hard to maintain/create with a database.

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread Harold Wood
Well you have a column named data and a table named data, but the biggest issue is you only supplied 3 column names but in the values list you have 6 values.   --- On Thu, 6/4/09, liubin liu <7101...@sina.com> wrote: From: liubin liu <7101...@sina.com> Subject: Re: [sqlite] how to compose the

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread liubin liu
Thank you a lot! I created a table: CREATE TABLE data ( num INTEGER, di CHAR(4), data CHAR(12), time1 INTEGER, time2 INTEGER, format CHAR(1) ); and create a index: CREATE INDEX i_data ON data (num, di, time1); I want to do: first tell whether there is a record in the table "data" according to