Re: [sqlite] Newbee Question

2007-04-04 Thread miguel manese

You have to link against sqlite's shared lib, e.g. in linux

$ gcc -L/path/to/sqlite/stuffs -I/path/to/sqlite/stuffs -lsqlite prog.c

(the 2nd is a capital i, the 3rd a small L)

Cheers,
M. Manese

On 4/4/07, nshaw [EMAIL PROTECTED] wrote:


I upgraded from 3.3.1.3 to 3.3.1.4.  Up till now, I've been experimenting
with SQLite3 via the CLP.  Now, I'm trying to access a DB via a C program
but I'm getting errors.  Here's a small code fragment:

#include stdio.h
#include stdlib.h
#include sqlite3.h

int main (int argc, char **argv)
{
sqlite3 *db; /* from the definitive guide to sqlite */

char *zErr;
int rc;
char *sql;

rc = sqlite3_open (Family.db, db);

return 0;
}

The error I get is (.text+0x16): undefined reference to 'sqlite3_open'.

Any help will be greatly appreciated.
Thanks,

Nick.

--
View this message in context: 
http://www.nabble.com/Newbee-Question-tf3521982.html#a9825045
Sent from the SQLite mailing list archive at Nabble.com.


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




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



[sqlite] What query should I use?

2007-04-04 Thread erw2
Hi,
I have a table with a following data:

IdText1   Text2   Text3   Text4
---
11001 11 test03   test13
21002 11 test01   test11
31003 12 test04   test12
41004 12 test02   test34
51004 12   test06   test56
61005 11   test17   test67
71005 12   test07   test57
81006 13 test05   test98
91007 13 test02   test93
10   1008 14 test01   test03
...   .....   ..
 
Now, I would like to select only the rows when Text2 change. So the
result of such query should look like:
 
IdText1   Text2   Text3   Text4
---
11001 11  test03   test13
31003 12  test04   test12
61005 11test17   test67
71005 12  test07   test57
81006 13  test05   test98
10   1008 14  test01   test03
...   .....   ..

How should this query look like?

Regards
Wojciech W.


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



[sqlite] Re: What query should I use?

2007-04-04 Thread Igor Tandetnik

erw2 [EMAIL PROTECTED] wrote:

I have a table with a following data:

IdText1   Text2   Text3   Text4
---
11001 11 test03   test13
21002 11 test01   test11
31003 12 test04   test12
41004 12 test02   test34
51004 12test06   test56
61005 11test17   test67
71005 12test07   test57
81006 13 test05   test98
91007 13 test02   test93
10   1008 14 test01   test03
...   .....   ..

Now, I would like to select only the rows when Text2 change. So the
result of such query should look like:

IdText1   Text2   Text3   Text4
---
11001 11  test03   test13
31003 12  test04   test12
61005 11 test17   test67
71005 12  test07   test57
81006 13  test05   test98
10   1008 14  test01   test03
...   .....   ..

How should this query look like?


select * from tableName t1
where t1.Text2 != (
   select t2.Text2 from tableName t2
   where t2.Id  t1.Id
   order by t2.Id desc limit 1
);

Igor Tandetnik

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



[sqlite] Data integrity in extreme situations

2007-04-04 Thread Yves Goergen
Hi,

I'm intending to use the SQLite database in a desktop e-mail
application. Since most e-mails are quite valuable to me, I'd like to
know if SQLite databases can get corrupted during normal use and
exceptional situations like a sudden application/OS crash, power failure
or access blocking through a virus scanner. Can it happen that under
these circumstances all/arbitrary data from the database file can be
lost or does that only affect the data currently being written, if any.
How does it relate to transactions? I'm considering doing a full
database backup each time the application quits but keeping the entire
file twice may take much disk space. Maybe using two files, one for
current e-mails and one as growing archive (that doesn't change often),
would be a possibility.

-- 
Yves Goergen LonelyPixel [EMAIL PROTECTED]
Visit my web laboratory at http://beta.unclassified.de

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



Re: [sqlite] What query should I use?

2007-04-04 Thread Gussimulator

try the DISTINCT keyword ?



- Original Message - 
From: erw2 [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Wednesday, April 04, 2007 4:14 PM
Subject: [sqlite] What query should I use?



Hi,
I have a table with a following data:

IdText1   Text2   Text3   Text4
---
11001 11 test03   test13
21002 11 test01   test11
31003 12 test04   test12
41004 12 test02   test34
51004 12test06   test56
61005 11test17   test67
71005 12test07   test57
81006 13 test05   test98
91007 13 test02   test93
10   1008 14 test01   test03
...   .....   ..

Now, I would like to select only the rows when Text2 change. So the
result of such query should look like:

IdText1   Text2   Text3   Text4
---
11001 11  test03   test13
31003 12  test04   test12
61005 11 test17   test67
71005 12  test07   test57
81006 13  test05   test98
10   1008 14  test01   test03
...   .....   ..

How should this query look like?

Regards
Wojciech W.


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




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



Re: [sqlite] Data integrity in extreme situations

2007-04-04 Thread P Kishor

On 4/4/07, Yves Goergen [EMAIL PROTECTED] wrote:

Hi,

I'm intending to use the SQLite database in a desktop e-mail
application. Since most e-mails are quite valuable to me, I'd like to
know if SQLite databases can get corrupted during normal use and
exceptional situations like a sudden application/OS crash, power failure
or access blocking through a virus scanner. Can it happen that under
these circumstances all/arbitrary data from the database file can be
lost or does that only affect the data currently being written, if any.
How does it relate to transactions? I'm considering doing a full
database backup each time the application quits but keeping the entire
file twice may take much disk space. Maybe using two files, one for
current e-mails and one as growing archive (that doesn't change often),
would be a possibility.




if it is any consolation/encouragement, Apple's Mail.app version 2.x
onward use SQLite as the data store.

--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
-
collaborate, communicate, compete
=

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



[sqlite] SQL and SQLite pronounciation?

2007-04-04 Thread Dennis Cote

Hi All,

I have a simple question; how do you pronounce SQL and SQLite?

I have heard some people pronounce SQL like sequel, others like 
squeal, and others like three words ess cue el. Which do you prefer?


How about SQLite? Is it ess cue light or something else like sequel 
light?


I prefer ess cue el and ess cue light myself.

Dennis Cote



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



Re: [sqlite] SQL and SQLite pronounciation?

2007-04-04 Thread P Kishor

On 4/4/07, Dennis Cote [EMAIL PROTECTED] wrote:

Hi All,

I have a simple question; how do you pronounce SQL and SQLite?


See-quell

See-que-lite




--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
-
collaborate, communicate, compete
=

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



Re: [sqlite] SQL and SQLite pronounciation?

2007-04-04 Thread Joel Cochran

I prefer the ess cue ell version.  And I can never remmeber that there is
only one el, so I end up saying ess cue ell light even though I know its
wrong.

--
Joel Cochran


On 4/4/07, Dennis Cote [EMAIL PROTECTED] wrote:


Hi All,

I have a simple question; how do you pronounce SQL and SQLite?

I have heard some people pronounce SQL like sequel, others like
squeal, and others like three words ess cue el. Which do you prefer?

How about SQLite? Is it ess cue light or something else like sequel
light?

I prefer ess cue el and ess cue light myself.

Dennis Cote




-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] SQL and SQLite pronounciation?

2007-04-04 Thread Alberto Simões

On 4/4/07, Joel Cochran [EMAIL PROTECTED] wrote:

I prefer the ess cue ell version.  And I can never remmeber that there is
only one el, so I end up saying ess cue ell light even though I know its
wrong.


Join the club, Joel.
I do the same, myself. With the only difference that I pronounce the
'S' 'Q' and 'L' letters in Portuguese.

Cheers

--
Alberto Simões

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



[sqlite] Math functions

2007-04-04 Thread Nathan Biggs
Does anyone know if there is a floor function in sqlite, or of a way to
implement it.


Re: [sqlite] Math functions

2007-04-04 Thread anis chaaba

yes you can implement math functions with user defined functions by the
sqlite3_create_function. sqlite.org is your freind :)

2007/4/4, Nathan Biggs [EMAIL PROTECTED]:


Does anyone know if there is a floor function in sqlite, or of a way to
implement it.



[sqlite] sqlite server

2007-04-04 Thread Dave Dyer

I've revived the sqlite server demo at http://www.it77.de/sqlite/sqlite.htm
and updated the API to sqlite 3.   

This project defines a very simple sqlite server which operates local 
sqlite databases, and a simple client which links with a lightweight
library containing a plug-compatible subset of the full sqlite C api.

Essentially, if you have a simple enough program which uses sqlite,
you can link with this library instead and connect to a remote sqlite
database.

There are many reasons why this simple client/server pair is ONLY
a demo, and not suitable to be deployed outside of your sandbox;
but there are also plenty of reasons why a networked sqlite might
be preferable to a standard networked database such as mysl.

-- OK, that's the announcement, now for the question.  I'm planning
to make this demo available, but if a show of hands indicates enough
immediate interest, this could be set up at sourceforge or elsewhere
as a real project.   Please send ddyer-sqlite at real-me.net a message
(no need to flood the mailing list) if you (a) would like a copy to play
with (b) would be interested in participating in an open source
project to make a deployable network database.  


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



Re: [sqlite] SQL and SQLite pronounciation?

2007-04-04 Thread Cesar Rodas

S. Q. Lite... that is my pronunciation and as I read in a book that is its
pronunciation

On 04/04/07, Alberto Simões [EMAIL PROTECTED] wrote:


On 4/4/07, Joel Cochran [EMAIL PROTECTED] wrote:
 I prefer the ess cue ell version.  And I can never remmeber that there
is
 only one el, so I end up saying ess cue ell light even though I know
its
 wrong.

Join the club, Joel.
I do the same, myself. With the only difference that I pronounce the
'S' 'Q' and 'L' letters in Portuguese.

Cheers

--
Alberto Simões


-
To unsubscribe, send email to [EMAIL PROTECTED]

-





--
Cesar Rodas
http://www.cesarodas.com/
Mobile Phone: 595 961 974165
Phone: 595 21 645590
[EMAIL PROTECTED]
[EMAIL PROTECTED]


RE: [sqlite] SQL and SQLite pronounciation?

2007-04-04 Thread Griggs, Donald
 re: S. Q. Lite... that is my pronunciation...

And calling it squirrelite is simply a tongue-in-cheek affectionate
affectation   ;-)


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



Re: [sqlite] SQL and SQLite pronounciation?

2007-04-04 Thread Martin Pelletier

I use a twist on the various versions listed so far: es cue el-ait.

Hearing sequel for SQL always makes me cringe.

Dennis Cote wrote:

I have a simple question; how do you pronounce SQL and SQLite?



--
Martin Pelletier
Informatique / Software Development
Infodev Electronic Designers International Inc.
Tel : +1 (418) 681-3539, poste /ext. 114
Fax : +1 (418) 681-1209


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



Re: [sqlite] SQL and SQLite pronounciation?

2007-04-04 Thread Clark Christensen
Personally, I use sequel and sequel-light.  I think I remember from DRH's 
Google presentation video he uses ess cue el ite for his product.

 -Clark

- Original Message 
From: Dennis Cote [EMAIL PROTECTED]
To: sqlite-users sqlite-users@sqlite.org
Sent: Wednesday, April 4, 2007 1:24:39 PM
Subject: [sqlite] SQL and SQLite pronounciation?

Hi All,

I have a simple question; how do you pronounce SQL and SQLite?

I have heard some people pronounce SQL like sequel, others like 
squeal, and others like three words ess cue el. Which do you prefer?

How about SQLite? Is it ess cue light or something else like sequel 
light?

I prefer ess cue el and ess cue light myself.

Dennis Cote



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





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



Re: [sqlite] Re: SQL help

2007-04-04 Thread Clark Christensen
Igor,

Amazing.  Thanks very much for your help.  You get credit in my code comments 
:-))

 -Clark

- Original Message 
From: Igor Tandetnik [EMAIL PROTECTED]
To: SQLite sqlite-users@sqlite.org
Sent: Tuesday, April 3, 2007 12:20:57 PM
Subject: [sqlite] Re: SQL help

Clark Christensen cdcmicro-/[EMAIL PROTECTED]
wrote:
 I have a table, as described below, where I need to find out if the
 tech_id in question has at least some modules in a particular
 collection (coll_id), and they're all complete.

select coalesce(min(is_complete), 0) from tech_modules
where tech_id=? and coll_id=?;

This returns 0 if there's at least one record with is_complete=0 (min 
will select it), or if there are no matching records at all (min will 
produce NULL, coalesce will convert it to 0).

Igor Tandetnik 


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





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



Re: [sqlite] SQL and SQLite pronounciation?

2007-04-04 Thread Doug Currie
On Wednesday, April 04, 2007 Martin Pelletier wrote: 

 I use a twist on the various versions listed so far: es cue el-ait.

 Hearing sequel for SQL always makes me cringe.

Yeah. In some circles, sequel is reserved for the original SEQUEL
query language were first published in 1974 by Don Chamberlin and Ray
Boyce at the ACM–SIGFIDET Workshop on Data Description, whereas ess
cue ell is used for subsequent standardized versions of the language.

e

-- 
Doug Currie
Londonderry, NH, USA


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



[sqlite] Re: Math functions

2007-04-04 Thread Igor Tandetnik

Nathan Biggs [EMAIL PROTECTED] wrote:

Does anyone know if there is a floor function in sqlite, or of a way
to implement it.


cast(expr as integer) truncates towards zero, in case it helps.

Igor Tandetnik

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



Re: [sqlite] Math functions

2007-04-04 Thread Liam Healy

Please see http://sqlite.org/contrib under extension-functions.tgz.

On 4/4/07, Nathan Biggs [EMAIL PROTECTED] wrote:


Does anyone know if there is a floor function in sqlite, or of a way to
implement it.



Re: [sqlite] Data integrity in extreme situations

2007-04-04 Thread drh
Yves Goergen [EMAIL PROTECTED] wrote:
 Hi,
 
 I'm intending to use the SQLite database in a desktop e-mail
 application. Since most e-mails are quite valuable to me, I'd like to
 know if SQLite databases can get corrupted during normal use and
 exceptional situations like a sudden application/OS crash, power failure
 or access blocking through a virus scanner. Can it happen that under
 these circumstances all/arbitrary data from the database file can be
 lost or does that only affect the data currently being written, if any.
 How does it relate to transactions? I'm considering doing a full
 database backup each time the application quits but keeping the entire
 file twice may take much disk space. Maybe using two files, one for
 current e-mails and one as growing archive (that doesn't change often),
 would be a possibility.
 

SQLite is highly resistant to corruption resulting for an
Application crash, OS crash, or power failure.  But that
doesn't mean it never happens.

Read more at http://www.sqlite.org/lockingv3.html, especially
section 6.0: How To Corrupt Your Database Files.  There have
been bugs in SQLite that have caused corruption.  For a list
of them, see http://www.sqlite.org/cvstrac/wiki?p=DatabaseCorruption

I keep all of my email going back years in an SQLite database, FWIW.
See http://www.sqlite.org/cvstrac/wiki?p=ExperimentalMailUserAgent

It has already been reported that Apple Mail keeps all its metadata
in an SQLite database.  (There was quite a stir in the Mac community
a few weeks ago when somebody discovered and blogged that you could
substantially increase the speed of Apple Mail by running VACUUM on
its database!)  There are other popular mail user agents that also
store either metadata or mail text or both in SQLite databases. But
since I am under a bewildering array of NDAs and am not really sure
what I can and cannot say, I'll say no more about that.  :-)

--
D. Richard Hipp  [EMAIL PROTECTED]


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



[sqlite] Re: Default sqlite memory management policy

2007-04-04 Thread Rich Rattanni

On 4/3/07, Rich Rattanni [EMAIL PROTECTED] wrote:

All:
   I was wondering exactly how SQLite handles freeing memory used
from the heap when compiled without SQLITE_ENABLE_MEMORY_MANAGEMENT?

   Will absolutely no memory be freed, or is there some default
memory management scheme used?



Let me explain my question better...
SQLITE on my system has been compiled without the
SQLITE_ENABLE_MEMORY_MANAGEMENT define.  I have a thread that writes a
hundred or so samples into a database every 30 seconds.  I do not open
and close the database pointer each time, but I do prepare and
finalize a statement for each transaction.  I have notices that the
memory used by my program slowly but surely increases as the program
runs (about 24 hrs sees a 40%+ increase in system memory).  I have
checked, and rechecked the program for any memory leaks on my part,
but I have no found any obvious ones.  I just wanted to know if
sqlite, as compiled for my system, will use as much memory as it sees
fit in a particular thread if compiled without
SQLITE_ENABLE_MEMORY_MANAGEMENT?

Can anyone answer this for me?

--
Thanks in advance,
Rich

P.S. Sorry to repost, if there are no takers I will not repost again,
I just thought my first message was lacking any real question so I
wanted to clarify the original.

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



Re: [sqlite] Re: Default sqlite memory management policy

2007-04-04 Thread Dan Kennedy
On Wed, 2007-04-04 at 23:36 -0400, Rich Rattanni wrote:
 On 4/3/07, Rich Rattanni [EMAIL PROTECTED] wrote:
  All:
 I was wondering exactly how SQLite handles freeing memory used
  from the heap when compiled without SQLITE_ENABLE_MEMORY_MANAGEMENT?
 
 Will absolutely no memory be freed, or is there some default
  memory management scheme used?
 
 
 Let me explain my question better...
 SQLITE on my system has been compiled without the
 SQLITE_ENABLE_MEMORY_MANAGEMENT define.  I have a thread that writes a
 hundred or so samples into a database every 30 seconds.  I do not open
 and close the database pointer each time, but I do prepare and
 finalize a statement for each transaction.  I have notices that the
 memory used by my program slowly but surely increases as the program
 runs (about 24 hrs sees a 40%+ increase in system memory).  I have
 checked, and rechecked the program for any memory leaks on my part,
 but I have no found any obvious ones.  I just wanted to know if
 sqlite, as compiled for my system, will use as much memory as it sees
 fit in a particular thread if compiled without
 SQLITE_ENABLE_MEMORY_MANAGEMENT?
 
 Can anyone answer this for me?

Defining the SQLITE_ENABLE_MEMORY_MANAGEMENT includes the 
following APIs in the build:

  int sqlite3_release_memory(int N);
  int sqlite3_set_soft_heap_limit(int N);

See the comments above these two functions in sqlite3.h for
details.

SQLite should not leak memory whether this macro is defined
or not. How large are the leaks you are seeing?

Dan.



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



Re: [sqlite] Default sqlite memory management policy

2007-04-04 Thread drh
Rich Rattanni [EMAIL PROTECTED] wrote:
 On 4/3/07, Rich Rattanni [EMAIL PROTECTED] wrote:
  All:
 I was wondering exactly how SQLite handles freeing memory used
  from the heap when compiled without SQLITE_ENABLE_MEMORY_MANAGEMENT?
 
 Will absolutely no memory be freed, or is there some default
  memory management scheme used?
 
 
 Let me explain my question better...
 SQLITE on my system has been compiled without the
 SQLITE_ENABLE_MEMORY_MANAGEMENT define.  I have a thread that writes a
 hundred or so samples into a database every 30 seconds.  I do not open
 and close the database pointer each time, but I do prepare and
 finalize a statement for each transaction.  I have notices that the
 memory used by my program slowly but surely increases as the program
 runs (about 24 hrs sees a 40%+ increase in system memory).  I have
 checked, and rechecked the program for any memory leaks on my part,
 but I have no found any obvious ones.  I just wanted to know if
 sqlite, as compiled for my system, will use as much memory as it sees
 fit in a particular thread if compiled without
 SQLITE_ENABLE_MEMORY_MANAGEMENT?
 
 Can anyone answer this for me?
 

SQLite does not leak memory, if that what you are asking.
You do not need to compile with SQLITE_ENABLE_MEMORY_MANAGEMENT
in order to prevent memory leaks.

The SQLITE_ENABLE_MEMORY_MANAGEMENT macro is used to enable
two APIs used for tighter control of memory on resource
limited embedded devices:

sqlite3_release_memory()
sqlite3_soft_heap_limit()

I recommend you run your program in valgrind to find out where
the memory is leaking.

--
D. Richard Hipp  [EMAIL PROTECTED]


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



Re: [sqlite] Data integrity in extreme situations

2007-04-04 Thread Joe Wilson
--- [EMAIL PROTECTED] wrote:
 It has already been reported that Apple Mail keeps all its metadata
 in an SQLite database.  (There was quite a stir in the Mac community
 a few weeks ago when somebody discovered and blogged that you could
 substantially increase the speed of Apple Mail by running VACUUM on
 its database!) 

VACUUM is one way to get the entire sqlite database into the OS disk cache. 

Here's another way:

  cat ~/Library/Mail/Envelope\ Index /dev/null

The Apple Mail speedup in both cases is not as dramatic after a reboot, though.


 

No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 

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



[sqlite] Re: SQL and SQLite pronounciation?

2007-04-04 Thread A. Pagaltzis
* Dennis Cote [EMAIL PROTECTED] [2007-04-04 22:30]:
 I prefer ess cue el and ess cue light myself.

That’s what I say.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/

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