Re: [sqlite] Proper use of sqlite-amalgamation.

2008-04-03 Thread Dimitri
Hi,

> I just had several questions regarding SQLite. While at the download
> page, it states that sqlite-amalgamation is the "preferred" way of
> acquiring SQLite code. So I went ahead and downloaded the latest
> version (3.5.7). I get 3 source files and I am stuck. I tried reading
> the documentation but I guess I couldn't find any mention of how to
> use this "amalgamated" source code. So I searched the mailing list and
> realized that I was simply a gcc command away. I go ahead and compile
> it using:

There's a link in the download page:
http://www.sqlite.org/download.html
that points to:
http://www.sqlite.org/amalgamation.html

-- 
Dimitri
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 3.5.7 & TCL: "undefined symbol: sqlite3StrICmp"

2008-04-03 Thread Zbigniew Baniewski
On Thu, Apr 03, 2008 at 09:54:15PM -0500, John Stanton wrote:

> Install TCL

Another one? What for?
-- 
pozdrawiam / regards

Zbigniew Baniewski
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 3.5.7 & TCL: "undefined symbol: sqlite3StrICmp"

2008-04-03 Thread John Stanton
Zbigniew Baniewski wrote:
> I'm sorry to confirm the problem described at http://tinyurl.com/29wc8x
> 
> #v+
>   $ tclsh8.5 
>   % package require sqlite3 
>   couldn't load file "/usr/lib/sqlite3/libtclsqlite3.so.0": 
>   /usr/lib/sqlite3/libtclsqlite3.so.0: undefined symbol: sqlite3StrICmp
> #v-
> 
> Does there exist any cure?

Install TCL
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] 3.5.7 & TCL: "undefined symbol: sqlite3StrICmp"

2008-04-03 Thread Zbigniew Baniewski
I'm sorry to confirm the problem described at http://tinyurl.com/29wc8x

#v+
  $ tclsh8.5 
  % package require sqlite3 
  couldn't load file "/usr/lib/sqlite3/libtclsqlite3.so.0": 
  /usr/lib/sqlite3/libtclsqlite3.so.0: undefined symbol: sqlite3StrICmp
#v-

Does there exist any cure?
-- 
pozdrawiam / regards

Zbigniew Baniewski
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 3.5.7 Compile Fails On sqlite3.c

2008-04-03 Thread Robert L Cochran
Robert L Cochran wrote:
> Here is what I did:
>
> tar -xvzf sqlite-3.5.7.tar.gz
> cd sqlite-3.5.7
> mkdir bld
> cd !$
> ../configure --prefix=/usr/local/sqlite-3.5.7 --disable-tcl
> --enable-threadsafe
> make
>
> --
> (output of make is shown below)
>  
> [EMAIL PROTECTED] bld]$ make
> sed -e s/--VERS--/3.5.7/ ../src/sqlite.h.in | \
> sed -e s/--VERSION-NUMBER--/3005007/ >sqlite3.h
> gcc -g -O2 -o mkkeywordhash  ../tool/mkkeywordhash.c
> ./mkkeywordhash >keywordhash.h
> gcc -g -O2 -o lemon ../tool/lemon.c
> cp ../tool/lempar.c .
> cp ../src/parse.y .
> ./lemon  parse.y
> mv parse.h parse.h.temp
> gawk -f ../addopcodes.awk parse.h.temp >parse.h
> cat parse.h ../src/vdbe.c | gawk -f ../mkopcodeh.awk >opcodes.h
> sort -n -b -k 3 opcodes.h | gawk -f ../mkopcodec.awk >opcodes.c
> rm -rf tsrc
> mkdir -p tsrc
> cp ../src/alter.c ../src/analyze.c ../src/attach.c ../src/auth.c
> ../src/bitvec.c ../src/btmutex.c ../src/btree.c ../src/btree.h
> ../src/btreeInt.h ../src/build.c ../src/callback.c ../src/complete.c
> ../src/config.h ../src/date.c ../src/delete.c ../src/expr.c
> ../src/fault.c ../src/func.c ../src/hash.c ../src/hash.h ../src/insert.c
> ../src/journal.c ../src/legacy.c ../src/loadext.c ../src/main.c
> ../src/malloc.c ../src/mem1.c ../src/mem2.c ../src/mem3.c ../src/mem4.c
> ../src/mem5.c ../src/mutex.c ../src/mutex.h ../src/mutex_os2.c
> ../src/mutex_unix.c ../src/mutex_w32.c ../src/os.c ../src/os.h
> ../src/os_common.h ../src/os_unix.c ../src/os_win.c ../src/os_os2.c
> ../src/pager.c ../src/pager.h ../src/parse.y ../src/pragma.c
> ../src/prepare.c ../src/printf.c ../src/random.c ../src/select.c
> ../src/shell.c ../src/sqlite.h.in ../src/sqlite3ext.h ../src/sqliteInt.h
> ../src/sqliteLimit.h ../src/table.c ../src/tclsqlite.c ../src/tokenize.c
> ../src/trigger.c ../src/utf.c ../src/update.c ../src/util.c
> ../src/vacuum.c ../src/vdbe.c ../src/vdbe.h ../src/vdbeapi.c
> ../src/vdbeaux.c ../src/vdbeblob.c ../src/vdbefifo.c ../src/vdbemem.c
> ../src/vdbeInt.h ../src/vtab.c ../src/where.c keywordhash.h opcodes.c
> opcodes.h parse.c parse.h sqlite3.h ../ext/fts1/fts1.c
> ../ext/fts1/fts1.h ../ext/fts1/fts1_hash.c ../ext/fts1/fts1_hash.h
> ../ext/fts1/fts1_porter.c ../ext/fts1/fts1_tokenizer.h
> ../ext/fts1/fts1_tokenizer1.c ../ext/fts2/fts2.c ../ext/fts2/fts2.h
> ../ext/fts2/fts2_hash.c ../ext/fts2/fts2_hash.h ../ext/fts2/fts2_icu.c
> ../ext/fts2/fts2_porter.c ../ext/fts2/fts2_tokenizer.h
> ../ext/fts2/fts2_tokenizer.c ../ext/fts2/fts2_tokenizer1.c
> ../ext/fts3/fts3.c ../ext/fts3/fts3.h ../ext/fts3/fts3_hash.c
> ../ext/fts3/fts3_hash.h ../ext/fts3/fts3_icu.c ../ext/fts3/fts3_porter.c
> ../ext/fts3/fts3_tokenizer.h ../ext/fts3/fts3_tokenizer.c
> ../ext/fts3/fts3_tokenizer1.c ../ext/icu/icu.c tsrc
> rm tsrc/sqlite.h.in tsrc/parse.y
> touch .target_source
> tclsh8.4 ../tool/mksqlite3c.tcl
> ./libtool --mode=compile --tag=CC gcc  -g -O2 -DOS_UNIX=1 -I. -I../src
> -DNDEBUG   -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1
> -DSQLITE_OMIT_LOAD_EXTENSION=1 -c ../sqlite3.c
> mkdir .libs
>  gcc -g -O2 -DOS_UNIX=1 -I. -I../src -DNDEBUG -DSQLITE_THREADSAFE=1
> -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -c
> ../sqlite3.c  -fPIC -DPIC -o .libs/sqlite3.o
> gcc: ../sqlite3.c: No such file or directory
> gcc: no input files
> make: *** [sqlite3.lo] Error 1
> 
>
> I looked at the Makefile and it seems to me the problem is in the
> definition of TOP which is set to '..'. All the source files are
> apparently copied to the current directory '.' not '../'.
>
> Is there some new recommended way to build the source code than the one
> given in the README file?
>
> Thanks
>
>
> Bob Cochran
> Greenbelt, Maryland, USA
>
>
>
>   
Fixed with this change to Makefile...the line starting with < is what
works.

[EMAIL PROTECTED] bld]$ diff Makefile Makefile~
430c430
<   $(LTCOMPILE) -c ./sqlite3.c
---
>   $(LTCOMPILE) -c $(TOP)/sqlite3.c



Bob


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proper use of sqlite-amalgamation.

2008-04-03 Thread Amit
On Thu, Apr 3, 2008 at 3:24 PM, Matthew L. Creech <[EMAIL PROTECTED]> wrote:
> On Thu, Apr 3, 2008 at 5:39 PM, Amit <[EMAIL PROTECTED]> wrote:
>  >
>  >   1. Is there any documentation that I may have missed that addresses
>  >  the above issue? If not, there probably should be a wiki page
>  >  regarding this. I could create a wiki page with my notes regarding
>  >  this.
>  >
>
>  There's:
>
>  http://www.sqlite.org/cvstrac/wiki?p=TheAmalgamation
>
>  But it doesn't address specifics related to the build like this.
>

I checked to see if the page was editable by the general public and it
is. So should I go ahead and post my notes regarding amalgamation?

>
>  >   2. Compiling above without the "-lpthread -ldl" results in errors. I
>  >  simply looked at a mailing list post and stumbled upon the above
>  >  commands. Is this the right way to do it?
>
>  Yes.  FYI, as of 3.5.7 the autoconf-based build in the full
>  distribution uses the amalgamation by default when producing the
>  shared library and executables, and the non-autoconf build (if you
>  start by using Makefile.linux-gcc as a template) has targets to do the
>  same.  It links the library itself with "-lpthread -ldl", which is why
>  you don't have to add those lines if you're just linking a program
>  against the shared library - gcc is instructed automatically by
>  libsqlite3.so to link them in.
>

Ok that is good to know. I will play around with the source
distribution and try to figure out how to get it to work with python
2.5. According to the python 2.5 documentation, to build Python with
sqlite3, I need the libraries plus the header files. Installing the
source distribution installs the header files as well? Or do I need to
copy them to some standard location like /usr/local/include?

Thanks for the quick reply,
Amit
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] 3.5.7 Compile Fails On sqlite3.c

2008-04-03 Thread Robert L Cochran
Here is what I did:

tar -xvzf sqlite-3.5.7.tar.gz
cd sqlite-3.5.7
mkdir bld
cd !$
../configure --prefix=/usr/local/sqlite-3.5.7 --disable-tcl
--enable-threadsafe
make

--
(output of make is shown below)
 
[EMAIL PROTECTED] bld]$ make
sed -e s/--VERS--/3.5.7/ ../src/sqlite.h.in | \
sed -e s/--VERSION-NUMBER--/3005007/ >sqlite3.h
gcc -g -O2 -o mkkeywordhash  ../tool/mkkeywordhash.c
./mkkeywordhash >keywordhash.h
gcc -g -O2 -o lemon ../tool/lemon.c
cp ../tool/lempar.c .
cp ../src/parse.y .
./lemon  parse.y
mv parse.h parse.h.temp
gawk -f ../addopcodes.awk parse.h.temp >parse.h
cat parse.h ../src/vdbe.c | gawk -f ../mkopcodeh.awk >opcodes.h
sort -n -b -k 3 opcodes.h | gawk -f ../mkopcodec.awk >opcodes.c
rm -rf tsrc
mkdir -p tsrc
cp ../src/alter.c ../src/analyze.c ../src/attach.c ../src/auth.c
../src/bitvec.c ../src/btmutex.c ../src/btree.c ../src/btree.h
../src/btreeInt.h ../src/build.c ../src/callback.c ../src/complete.c
../src/config.h ../src/date.c ../src/delete.c ../src/expr.c
../src/fault.c ../src/func.c ../src/hash.c ../src/hash.h ../src/insert.c
../src/journal.c ../src/legacy.c ../src/loadext.c ../src/main.c
../src/malloc.c ../src/mem1.c ../src/mem2.c ../src/mem3.c ../src/mem4.c
../src/mem5.c ../src/mutex.c ../src/mutex.h ../src/mutex_os2.c
../src/mutex_unix.c ../src/mutex_w32.c ../src/os.c ../src/os.h
../src/os_common.h ../src/os_unix.c ../src/os_win.c ../src/os_os2.c
../src/pager.c ../src/pager.h ../src/parse.y ../src/pragma.c
../src/prepare.c ../src/printf.c ../src/random.c ../src/select.c
../src/shell.c ../src/sqlite.h.in ../src/sqlite3ext.h ../src/sqliteInt.h
../src/sqliteLimit.h ../src/table.c ../src/tclsqlite.c ../src/tokenize.c
../src/trigger.c ../src/utf.c ../src/update.c ../src/util.c
../src/vacuum.c ../src/vdbe.c ../src/vdbe.h ../src/vdbeapi.c
../src/vdbeaux.c ../src/vdbeblob.c ../src/vdbefifo.c ../src/vdbemem.c
../src/vdbeInt.h ../src/vtab.c ../src/where.c keywordhash.h opcodes.c
opcodes.h parse.c parse.h sqlite3.h ../ext/fts1/fts1.c
../ext/fts1/fts1.h ../ext/fts1/fts1_hash.c ../ext/fts1/fts1_hash.h
../ext/fts1/fts1_porter.c ../ext/fts1/fts1_tokenizer.h
../ext/fts1/fts1_tokenizer1.c ../ext/fts2/fts2.c ../ext/fts2/fts2.h
../ext/fts2/fts2_hash.c ../ext/fts2/fts2_hash.h ../ext/fts2/fts2_icu.c
../ext/fts2/fts2_porter.c ../ext/fts2/fts2_tokenizer.h
../ext/fts2/fts2_tokenizer.c ../ext/fts2/fts2_tokenizer1.c
../ext/fts3/fts3.c ../ext/fts3/fts3.h ../ext/fts3/fts3_hash.c
../ext/fts3/fts3_hash.h ../ext/fts3/fts3_icu.c ../ext/fts3/fts3_porter.c
../ext/fts3/fts3_tokenizer.h ../ext/fts3/fts3_tokenizer.c
../ext/fts3/fts3_tokenizer1.c ../ext/icu/icu.c tsrc
rm tsrc/sqlite.h.in tsrc/parse.y
touch .target_source
tclsh8.4 ../tool/mksqlite3c.tcl
./libtool --mode=compile --tag=CC gcc  -g -O2 -DOS_UNIX=1 -I. -I../src
-DNDEBUG   -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1
-DSQLITE_OMIT_LOAD_EXTENSION=1 -c ../sqlite3.c
mkdir .libs
 gcc -g -O2 -DOS_UNIX=1 -I. -I../src -DNDEBUG -DSQLITE_THREADSAFE=1
-DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -c
../sqlite3.c  -fPIC -DPIC -o .libs/sqlite3.o
gcc: ../sqlite3.c: No such file or directory
gcc: no input files
make: *** [sqlite3.lo] Error 1


I looked at the Makefile and it seems to me the problem is in the
definition of TOP which is set to '..'. All the source files are
apparently copied to the current directory '.' not '../'.

Is there some new recommended way to build the source code than the one
given in the README file?

Thanks


Bob Cochran
Greenbelt, Maryland, USA



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Virtual table used to query big external database

2008-04-03 Thread Scott Hess
You can _generally_ work around this kind of problem using sub-selects. So 
instead of:

SELECT x FROM fts_table WHERE fts_table MATCH "y" OR fts_table MATCH "z";

You might write:

SELECT x FROM fts_table WHERE rowid IN (SELECT rowid FROM fts_table WHERE 
fts_table MATCH "y") OR rowid IN (SELECT rowid FROM fts_table WHERE 
fts_table MATCH "z");

Of course, you could probably phrase it eleven different ways, I'm not 
suggesting that the above is the most efficient way, just that you can 
sometimes perturb your query to make things work better :-). Note that the 
above change would work best if you don't expect many hits.

Also, I'm making no representation about the state of SQLite's ability to 
optimize the original query (you'd rather have written it fts_table MATCH "y 
OR z" from the get-go). But if the original poster is already thinking of 
using a virtual table to give access to masses of external data, writing 
queries in this somewhat more complicated fashion may make a lot of sense.

-scott



2008/4/1 Ben Harper <[EMAIL PROTECTED]>:
> The only limitation imposed by SQL that I can think of would be
> inefficiencies in its query plan builder. That is the part that
> figures out how to use the indexes available in the database in order
> to execute the SQL query most efficiently. So it really depends on
> what type of SQL queries you are going to be running against this huge
> DB.
> The dangers are easy to evaluate:
> Create a quick-and-dirty dummy virtual table mechanism, and respond to
> the xBestIndex/xFilter functions. You will notice that for certain
> queries, xBestIndex/xFilter does not get used. That means that the
> SQLite engine is going to have to walk through your entire table,
> evaluating the conditions on each field. This is obviously what you
> wish to avoid. As an example, I noticed briefly (I did not investigate
> thoroughly) that having an OR condition in a query would prevent the
> indexes from being used. That was some time ago, and it was before the
> rewrite of the SQL VM, so I don't know if that still applies. You'll
> have to investigate your potential queries yourself. A simple query
> such as "WHERE myvalue > 100" should definitely invoke the use of your
> own indexes.
> 
> Ben
> 
> 
> 
> 
> On Tue, Apr 1, 2008 at 10:12 PM, Aladdin Lampé <[EMAIL PROTECTED]> 
wrote:
> >
> > Hi all!
> >
> > Very often, when people ask this list why they have trouble managing in 
sqlite a "big table" (50 million lines or more than 10 Go), they are told 
that sqlite is an embedded database and is not meant to be used for very big 
databases/tables.
> >
> > I'm currently in the process of designing a specific, read-only, sqlite 
"virtual table" in order to enable sqlite to access data stored in an 
external database which is specially designed to handle very big tables.
> >
> > My final objective is to be able to easily query a big external table 
(stored in another database) through the - excellent - sqlite interface.
> >
> > Now I have this terrible doubt: will the existing sqlite "limitations" 
for big sqlite tables also apply to my read-only virtual tables?
> >
> > Thus... am I currently losing my time developing such a "virtual table" 
with this objective in mind? Or is there a better way to achieve my 
objective?
> >
> > Thank you for your help!
> >
> > _
> > Votre contact a choisi Hotmail, l'e-mail ultra sécurisé. Créez un compte 
gratuitement !
> > http://www.windowslive.fr/hotmail/default.asp
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proper use of sqlite-amalgamation.

2008-04-03 Thread Matthew L. Creech
On Thu, Apr 3, 2008 at 5:39 PM, Amit <[EMAIL PROTECTED]> wrote:
>
>   1. Is there any documentation that I may have missed that addresses
>  the above issue? If not, there probably should be a wiki page
>  regarding this. I could create a wiki page with my notes regarding
>  this.
>

There's:

http://www.sqlite.org/cvstrac/wiki?p=TheAmalgamation

But it doesn't address specifics related to the build like this.

>   2. Compiling above without the "-lpthread -ldl" results in errors. I
>  simply looked at a mailing list post and stumbled upon the above
>  commands. Is this the right way to do it?

Yes.  FYI, as of 3.5.7 the autoconf-based build in the full
distribution uses the amalgamation by default when producing the
shared library and executables, and the non-autoconf build (if you
start by using Makefile.linux-gcc as a template) has targets to do the
same.  It links the library itself with "-lpthread -ldl", which is why
you don't have to add those lines if you're just linking a program
against the shared library - gcc is instructed automatically by
libsqlite3.so to link them in.

-- 
Matthew L. Creech
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Windows XP, where should I place the Sqlite .DLL's for best Sqlite operation, for usage with other COM components?

2008-04-03 Thread Clark Christensen
Pretty much any folder in the PATH will do.

You can put it \windows\system32\ but that can be a pain to get to and 
remember.  I usually create one or more folders to hold non-Windows misc 
binaries, and add those to the system PATH.  The most recent is C:\usr\bin\ for 
executables, and C:\usr\lib\ for DLLs.  Since I have both Windows, and Linux 
boxes here, those are easier for me to remember.

 -Clark

- Original Message 
From: Paul Newcum <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Thursday, April 3, 2008 1:09:09 PM
Subject: [sqlite] Windows XP, where should I place the Sqlite .DLL's for best 
Sqlite operation, for usage with other COM components?

For Windows XP, where should I place the Sqlite .DLL's for best Sqlite 
operation, and for usage with other COM components?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Proper use of sqlite-amalgamation.

2008-04-03 Thread Amit
Hi everyone,

This is my first time diving into SQLite and I am very excited about
this. Thanks to all the developers.

I just had several questions regarding SQLite. While at the download
page, it states that sqlite-amalgamation is the "preferred" way of
acquiring SQLite code. So I went ahead and downloaded the latest
version (3.5.7). I get 3 source files and I am stuck. I tried reading
the documentation but I guess I couldn't find any mention of how to
use this "amalgamated" source code. So I searched the mailing list and
realized that I was simply a gcc command away. I go ahead and compile
it using:

$ gcc sqlite3.c

and it works! But then now what? I guess I have to embed this onto my
source code in some way? So further searching leads to a post stating
that "shell.c" should be compiled along with sqlite3.c to obtain the
sqlite3 shell. But there was no instruction on how to do that. So I
experimented around and found out that the following works:

$ gcc -o sqlite3 sqlite3.c shell.c -lpthread -ldl

I am now able to execute the sqlite3 application and play around with
a database. Thus comes the questions,

 1. Is there any documentation that I may have missed that addresses
the above issue? If not, there probably should be a wiki page
regarding this. I could create a wiki page with my notes regarding
this.

 2. Compiling above without the "-lpthread -ldl" results in errors. I
simply looked at a mailing list post and stumbled upon the above
commands. Is this the right way to do it?

 3. I am writing a program under python 2.5. And from various readings
it seems like sqlite3 is bundled with it?
  * If so, how is it used?
  * If not, how do I use the amalgamated version of sqlite with python 2.5?

Any comments or suggestions would be of great help.

Thanks,
Amit
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_finalize(pReadStmt); and sqlite3_close(pDB);

2008-04-03 Thread D. Richard Hipp

On Apr 3, 2008, at 5:09 PM, Joanne Pham wrote:
> Hi All,
> Should we always call sqlite3_finalize(pReadStmt); and  
> sqlite3_close(pDB) after we have done with read/write to database.  
> Or sqlite3_finalize(pReadStmt) is good enough.
> Please advice what is the sequence of statement that we should call  
> after we are done with database activities(read/write).

It is sufficient to call only sqlite3_finalize() and not  
sqlite3_close() in the
sense that your data will be written into the database file.  But  
until you
call sqlite3_close(), the database will remain open which uses some
memory and at least one file descriptor.  If you really are never  
going to
use the database again (or at least not soon) it is better to call
sqlite3_close() too.



D. Richard Hipp
[EMAIL PROTECTED]



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_aggregate_context with C++ classes

2008-04-03 Thread D. Richard Hipp

On Apr 3, 2008, at 3:39 PM, Steven Fisher wrote:
> Can Final be called without Step first being called?

Yes.

>
>
> If Step is called, will Final always be called?

Yes

D. Richard Hipp
[EMAIL PROTECTED]



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3_finalize(pReadStmt); and sqlite3_close(pDB);

2008-04-03 Thread Joanne Pham
Hi All,
Should we always call sqlite3_finalize(pReadStmt); and sqlite3_close(pDB) after 
we have done with read/write to database. Or sqlite3_finalize(pReadStmt) is 
good enough.
Please advice what is the sequence of statement that we should call after we 
are done with database activities(read/write).
Thanks,
JP


  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Windows XP, where should I place the Sqlite .DLL's for best Sqlite operation, for usage with other COM components?

2008-04-03 Thread Kees Nuyt
On Thu, 3 Apr 2008 16:09:09 -0400, you wrote:

> For Windows XP, where should I place the 
> Sqlite .DLL's for best Sqlite operation,
> and for usage with other COM components?

There is no easy answer, but enough information to
base your decision upon:

http://msdn2.microsoft.com/en-us/library/ms682586.aspx
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Count(1)

2008-04-03 Thread Scott Hess
A little bit more info:  SELECT COUNT(*) is implemented as a full
table scan, so SQLite is visiting every row in the table, which will
get slower and slower as the table gets bigger and the database
fragments.  This differs from many database engines (which implement
an optimization for this)  Doing the trigger thing means that it only
visits the specific row that contains the count.

-scott


On Thu, Apr 3, 2008 at 5:03 AM, P Kishor <[EMAIL PROTECTED]> wrote:
> On 4/3/08, Mahalakshmi.m <[EMAIL PROTECTED]> wrote:
>  > Hi,
>  >
>  >  I am having 4 records in my Harddisk.
>  >  My Processor speed is 400 Mhz.
>  >
>  >  For "SELECT COUNT(1) FROM MUSIC ;" its getting more time to display the
>  >  count.
>  >  I have also tried with "SELECT COUNT(*) FROM MUSIC ;This also take more
>  >  time.
>
>  SELECT Count(whatever) takes time. There is no way around that.
>
>
>  >  Is there any other way we can get the Total number of records.
>
>  If speed of getting total number of records is important to you, keep
>  a running total in a separate "count_rows" table, and update that
>  total via TRIGGERs as you insert into, delete from  or update your
>  tables. Then retrieve the total from the count_rows table instead of
>  using COUNT. Here is the idea...
>
>  CREATE TABLE count_rows (tablename, count_of_rows);
>  CREATE TRIGGERs AFTER (DELETE|INSERT|UPDATE) ON table
>   ... UPDATE count_rows SET count_of_rows = ? WHERE tablename = 'table' ...
>
>
>  Then, later on, instead of
>
>  SELECT COUNT(*) FROM table
>
>  You do
>
>  SELECT count_of_rows FROM count_rows WHERE tablename = ?
>
>
>  Search the archives. Many of your questions will be answered.
>
>
>
>
>  >  Please help to solve this.
>  >
>  >  Thanks & Regards,
>  >  Mahalakshmi
>  >
>  >
>  >  ___
>  >  sqlite-users mailing list
>  >  sqlite-users@sqlite.org
>  >  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>  >
>
>
>  --
>  Puneet Kishor http://punkish.eidesis.org/
>  Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
>  Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
>
>
> ___
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3_aggregate_context with C++ classes

2008-04-03 Thread Steven Fisher
Can Final be called without Step first being called?

If Step is called, will Final always be called?

I know the intention is to call sqlite3_aggregate_context with the  
size I really need and not allocate anything myself, but I want to  
store a pointer to a C++ class in the aggregate context. Is it enough  
to dispose of the pointer in Final, or is this a potential leak? Will  
calling sqlite3_aggregate_context in Final sometimes do the initial  
allocation, and if so can it be easily avoided?

Thanks...
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Count(1)

2008-04-03 Thread Ken
You could use a trigger to keep the running total in a seperate table.


"Mahalakshmi.m" <[EMAIL PROTECTED]> wrote: Hi,

I am having 4 records in my Harddisk.
My Processor speed is 400 Mhz.

For "SELECT COUNT(1) FROM MUSIC ;" its getting more time to display the
count.
I have also tried with "SELECT COUNT(*) FROM MUSIC ;This also take more
time.
Is there any other way we can get the Total number of records.
Please help to solve this.

Thanks & Regards,
Mahalakshmi


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to recover from database corruption? (and why does it happen?)

2008-04-03 Thread Luca Olivetti
En/na Luca Olivetti ha escrit:

> En/na Dennis Cote ha escrit:
>> The original corruption may well have been caused by omitting the thread 
>> safe option on the version of SQLite you were using.
> 
> Pheew, I hope it is really so.

A quick follow-up: everything has been working fine for almost one month
(crossing fingers anyway) with sqlite compiled with --enable-threadsafe.

Bye
-- 
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004  Fax +34 93 5883007

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Count(1)

2008-04-03 Thread P Kishor
On 4/3/08, Mahalakshmi.m <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I am having 4 records in my Harddisk.
>  My Processor speed is 400 Mhz.
>
>  For "SELECT COUNT(1) FROM MUSIC ;" its getting more time to display the
>  count.
>  I have also tried with "SELECT COUNT(*) FROM MUSIC ;This also take more
>  time.

SELECT Count(whatever) takes time. There is no way around that.

>  Is there any other way we can get the Total number of records.

If speed of getting total number of records is important to you, keep
a running total in a separate "count_rows" table, and update that
total via TRIGGERs as you insert into, delete from  or update your
tables. Then retrieve the total from the count_rows table instead of
using COUNT. Here is the idea...

CREATE TABLE count_rows (tablename, count_of_rows);
CREATE TRIGGERs AFTER (DELETE|INSERT|UPDATE) ON table
 ... UPDATE count_rows SET count_of_rows = ? WHERE tablename = 'table' ...


Then, later on, instead of

SELECT COUNT(*) FROM table

You do

SELECT count_of_rows FROM count_rows WHERE tablename = ?


Search the archives. Many of your questions will be answered.



>  Please help to solve this.
>
>  Thanks & Regards,
>  Mahalakshmi
>
>
>  ___
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Count(1)

2008-04-03 Thread Mahalakshmi.m
Hi,

I am having 4 records in my Harddisk.
My Processor speed is 400 Mhz.

For "SELECT COUNT(1) FROM MUSIC ;" its getting more time to display the
count.
I have also tried with "SELECT COUNT(*) FROM MUSIC ;This also take more
time.
Is there any other way we can get the Total number of records.
Please help to solve this.

Thanks & Regards,
Mahalakshmi


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Trigger's actions and callbacks

2008-04-03 Thread Vladimir Volkov



D. Richard Hipp wrote:
> 
> 
> SQLite is not reentrant through the update hook.
> 
> 
> D. Richard Hipp
> [EMAIL PROTECTED]
> 
> 

Thanks a lot.
I would consider using user-defined functions as callbacks with updated data
in its parameters.
-- 
View this message in context: 
http://www.nabble.com/Trigger%27s-actions-and-callbacks-tp16418413p16467330.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Does SQLite require 64-bit integers?

2008-04-03 Thread Gerhard Häring
I need to know if SQLite works at all if the platform doesn't have a 
64-bit integer type.

I see that SQLite has some #ifdefing like

#ifdef SQLITE_INT64_TYPE

that seems to be for the case when the platform does not have the type 
natively, but I don't see where this would actually be implemented.

If SQLite does indeed require the platform to have a native 64-bit 
integer type, then I can remove a few untested and silly #ifdef 
HAVE_LONG_LONG parts from my own code.

Thanks

-- Gerhard
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users