Re: [sqlite] What is a Group By, having clause?

2008-12-09 Thread Asif Lodhi
Hi Christophe,

On 12/9/08, Christophe Leske <[EMAIL PROTECTED]> wrote:
> the difference between a normal "where"-clause and the "Group by", and 
> "having"

I used www.sqlcourse.com and sqlcourse2.com probably in the year 2000.
They had very good tutorials and also let your actually practice the
SQL online!

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


Re: [sqlite] Valgrind, writeJournalHdr and Syscall param write(buf) points to uninitialised byte(s).

2008-12-09 Thread Kent Dahl
On ti., 2008-12-09 at 11:29 -0500, D. Richard Hipp wrote:
> On Dec 9, 2008, at 11:23 AM, Kent Dahl wrote:
> > After running valgrind on my program that is using sqlite (3.6.6.2,
> > statically linked on Linux, Ubuntu 8.10) for a while, carving away all
> > the problems caused by my own code, I was left with the "Syscall param
> > write(buf) points to uninitialised byte(s)" error reported within the
> > call from writeJournalHdr.
> 
> The uninitialized space is harmless.  But if it worries you there is a  
> patch.  http://www.sqlite.org/cvstrac/chngview?cn=5968

Thanks, just the confirmation and additional information I was looking
for. 


> > (Sorry to be mentioning 'valgrind', which seems to be akin to a
> > four-letter word, on this list... ;)
> >
> 
> Why do you think this?  We love valgrind. 

When I first saw this error in valgrind, Googling pointed me to the old
PRNG issue with k[256] being uninitialized, quite a few ranting messages
about valgrind, the KDE and sqlite bugs pointing back and forth at each
other and a finally "funny-hmm" commit message ranting. So I thought it
prudent to don my asbestos underpants before posting this. :)


>  It's the useless and  
> annoying warning messages from VC++ that we hate.

Ah, thankfully I personally only worry about warnings that are
reproducible on Linux... 
Unfortunately, my code still has to work on VC++. :(

-- 
Mvh/Regards,

Kent Dahl
Software Developer

Industrial Control Design AS



Phone: +47 93 07 32 30

Breivika Industriveg 63
N-6018 Ålesund
Norway

[EMAIL PROTECTED]

www.icd.no


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the System Manager [EMAIL PROTECTED] and
delete the material from any computer.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Partial search with fts

2008-12-09 Thread Scott Hess
On Sat, Nov 29, 2008 at 7:56 PM, Rael Bauer <[EMAIL PROTECTED]> wrote:
> Previously someone advised that I use the "*" char to achieve partial search
> results with fts. eg ver* will match version. This works ok, but only for
> end parts of a word.
>
> Is there anyway to get partial matches for beginning or middle parts of a
> word?
>
> e.g. *sion - to match version or
> *si* to match version

Unfortunately, no.  Prefix searches are possible because the fts index
is stored in sorted order.  Doing something like *ed would involve a
full scan of the index, and would probably be very slow.

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


Re: [sqlite] number of term occurances in fts3

2008-12-09 Thread Scott Hess
On Mon, Dec 8, 2008 at 8:26 AM, Jos van den Oever <[EMAIL PROTECTED]> wrote:
> Can one retrieve the number of times a certain term occurs in an fts table?
> This can be useful for autocompletion comboboxes.

Unfortunately, this information isn't tracked in an easy-to-expose
fashion.  It would be nice to have in some future rev.

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


Re: [sqlite] convert sql for sqlite 2.8.17

2008-12-09 Thread Hariyanto Handoko
I tried without AS but still get same error : SQL error: no such column: f.type
Maybe sqlite 2.8.17 can't run that query

On Tue, Dec 9, 2008 at 1:50 PM, Jonas Sandman <[EMAIL PROTECTED]> wrote:
> Shouldn't it be
>
> select f.type, f.variety, f.price
> from
> fruits f
> where
> rowid in (select rowid from fruits where type = f.type order by
> price desc limit 1)
>
> ?
>
> No need for the 'AS' there.
>
> /Jonas
>
> On Tue, Dec 9, 2008 at 12:54 AM, Hariyanto Handoko <[EMAIL PROTECTED]> wrote:
>> I want to get one result from that query.
>> It ok if run under sqlite3.
>>
>> But when I try with with sqlite 2.8.17, I got this error.
>> SQL error: no such column: f.type
>> I tried add AS (Alias) but still got that errror message.
>>
>> select f.type, f.variety, f.price
>> from
>>  fruits AS f
>> where
>>  rowid in (select rowid from fruits where type = f.type order by
>> price desc limit 1)
>>
>> order by f.type asc, f.price desc;
>>
>> I got  from this old message : (
>> Re: [sqlite] Select the top N rows from each group)
>>
>> create table fruits (type text, variety text, price number);
>> create index fruit_type_price on fruits (type, price);
>> insert into fruits values ('apple', 'gala', 2.79);
>> insert into fruits values ('apple', 'fuji', 0.24);
>> insert into fruits values ('apple', 'limbertwig', 2.87);
>> insert into fruits values ('orange', 'valencia', 3.59);
>> insert into fruits values ('orange', 'navel', 9.36);
>> insert into fruits values ('pear', 'bradford', 6.05);
>> insert into fruits values ('pear', 'bartlett', 2.14);
>> insert into fruits values ('cherry', 'bing', 2.55);
>> insert into fruits values ('cherry', 'chelan', 6.33);
>>
>> result from query sqlite3 :
>> apple|limbertwig|2.87
>> cherry|chelan|6.33
>> orange|navel|9.36
>> pear|bradford|6.05
>>
>> How I can fix that sql so I can get same result in sqlite 2.8.17
>> tx
>>
>>
>> On Tue, Dec 9, 2008 at 2:12 AM, Martin Engelschalk
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> Hi,
>>>
>>> i thought that too, at first, but i think he wants to select one record
>>> for every type of fruit, namely the record with the highest price within
>>> one value of 'type' (I have difficulty saying what I mean in english.)
>>>
>>> However, the longer i look at the statement, the less sense it makes to
>>> me. Perhaps  Hariyanto Handoko would like to post what the statement is
>>> supposed to achieve.
>>>
>>> Martin
>>>
>>>
>>> ___
>>> 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
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Why SQLITE_LOCKED here?

2008-12-09 Thread Marcus Grimm
> Marcus Grimm wrote:
>> I skipped to use the busy handler and the busy timeout and do
>> the handling by my selve. typically like:
>
> Are you aware that your code is very similar to the default SQLite busy
> handler if you set a busy timeout?  I'd argue that the one shipped with
> SQLite is better since it was written by the same people who wrote
> SQLite :-)

Yes, it should do the same, I guess... ;)

When I started with sqlite I had some troubles since I was not sure
if the busy handler also deals with LOCKED state, at that time I
did get that state and thus I just did all my selve.
Today I would most likely try with the busy handler, but I'm
happy now as it is.

Anyway, you are right... but my version works now perfect, and sqlite
so far has been proven to be able to work very well even under
heavy load with multible connections open.

Marcus

>
> Roger
> ___
> 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] Why SQLITE_LOCKED here?

2008-12-09 Thread Roger Binns
Marcus Grimm wrote:
> I skipped to use the busy handler and the busy timeout and do
> the handling by my selve. typically like:

Are you aware that your code is very similar to the default SQLite busy
handler if you set a busy timeout?  I'd argue that the one shipped with
SQLite is better since it was written by the same people who wrote
SQLite :-)

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


Re: [sqlite] Why SQLITE_LOCKED here?

2008-12-09 Thread Igor Tandetnik
Marco Bambini <[EMAIL PROTECTED]> wrote:
> I have several threads inside an application and each thread opens a
> connection to the same database.
> The application has been compiled with SQLITE_THREADSAFE = 1.
> One of the threads (just one) open another database connection to the
> same database used by ALL threads for all the writing operations.
>
> So I have N threads and N+1 db connections ... and the one db
> connection is SHARED between all the threads just for WRITE operations
> (the others N are used just for READ operations on the db).
> I thought that this approach could prevent my app from receiving a
> SQLITE_LOCKED error... but sometimes it still occurs.

Do you, by any chance, enable shared cache mode, as in 
http://sqlite.org/sharedcache.html? I believe that's the only situation 
where SQLITE_LOCKED error is occured.

> Any idea of the reason of the error?

You have two connections, one of which is writing to a table and the 
other is reading the same table. I'm not sure why you believe your setup 
somehow prevents this.

Igor Tandetnik



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


[sqlite] RoundCube + SQLite?

2008-12-09 Thread Scott Baker
Has anyone here used RoundCube with SQLite? Apparently it still requries
SQLite 2.x and I can't find any modern Linux box that still ships 2.x. I
just need to run these commands:

http://www.perturb.org/tmp/sqlite.initial.sql

And get the 2.x binary DB from it. Is there a way to make SQLite 3 output
SQLite 2 files?

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


Re: [sqlite] sqlite database to postgresql

2008-12-09 Thread John Stanton
Dump the database as SQL, then execute the SQL with PostgreSQL.

Manisha De Silva wrote:
> Now that I have a textfile which has a sqlite database can this be added to a
> postgresql database? If so how?
> This message (and any associated files) is intended only for the use of the 
> individual to which it is addressed and may contain information that is 
> confidential, subject to copyright protection. If you are not the intended 
> recipient you are hereby notified that any dissemination, copying or 
> distribution of this message, and any associated files, is strictly 
> prohibited. If you have received this message in error, please notify us 
> immediately by replying to the message and deleting it from your computer. 
> Messages sent to and from us may be monitored.
> We do not accept responsibility for any errors or omissions that are present 
> in this message, or any attachment, that have arisen as a result of e-mail 
> transmission. Any views or opinions presented are solely those of the author 
> and do not necessarily represent those of the company.
> ePulse Limited
> Registered office: 4 Crown Place, London, EC2A 4BT 
> Registered in England No 3534157
> ___
> 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] data dump in sqlite

2008-12-09 Thread John Stanton
Open up a command prompt window.  Then key

sqlite3  

That will ring up a command line accessto your Sqlite database.

If you want a GUI interface there is a Firefox plugin which interfaces 
to Sqlite.  Try that or one of the very many Sqlite GUI interfaces like 
Sqlitespy.

Manisha De Silva wrote:
> Hi,
> 
> This is what I was trying to do :
> 
> I double clicked on sqlite3.exe
> Then it opens a sqlite prompt 
> 
> Now I need to a do a data dump of a file which resides in c:\spool\jsm.db
> where jsm.db is the sqlite database.
> 
> How can this be done?
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Griggs, Donald
> Sent: 09 December 2008 15:49
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] data dump in sqlite
> 
> I'm not certain I understand your question, but here goes:
> 
> Sqlite3.exe is a command-line interface, so you don't really "browse" at
> all.
> 
> However, you can specify the path and name of a database on the command
> line when you invoke sqlite3, e.g. (In windows):
> 
> Sqlite3 "c:\NiceDirectory_Without_spaces\MyDatabase.db" 
> 
> The quotes are usually optional, but not when your path contains spaces
> 
> ALSO, you may want to see the ATTACH command in the documentation.
> 
> Once inside sqlite3, the .databases command should produce SOME output,
> even if you haven't opened an existing database.   
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Manisha De Silva
> Sent: Tuesday, December 09, 2008 10:36 AM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] data dump in sqlite
> 
> I downloaded sqlite3.exe
> 
> I typed in .databases and it doesn't show any database. Actually I have
> sqlite db in C:\Program Files\Jabber Inc\Jabber XCP\var\spool and I want
> this to dump the data to a text file. 
> 
> I typed in sqlite> .databases
> 
> How can I browse to the specific folder name which contains the jsm.db
> sqlite db file This message (and any associated files) 
> =
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> This message (and any associated files) is intended only for the use of the 
> individual to which it is addressed and may contain information that is 
> confidential, subject to copyright protection. If you are not the intended 
> recipient you are hereby notified that any dissemination, copying or 
> distribution of this message, and any associated files, is strictly 
> prohibited. If you have received this message in error, please notify us 
> immediately by replying to the message and deleting it from your computer. 
> Messages sent to and from us may be monitored.
> We do not accept responsibility for any errors or omissions that are present 
> in this message, or any attachment, that have arisen as a result of e-mail 
> transmission. Any views or opinions presented are solely those of the author 
> and do not necessarily represent those of the company.
> ePulse Limited
> Registered office: 4 Crown Place, London, EC2A 4BT 
> Registered in England No 3534157
> ___
> 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] Valgrind, writeJournalHdr and Syscall param write(buf) points to uninitialised byte(s).

2008-12-09 Thread Martin.Engelschalk
Hi,

i remember the posts you mention, and I know these error reports from 
valgrind. I get them outside of sqlite also, and have learned to ignore 
them.

Martin

Kent Dahl schrieb:
> Hi.
>
> After running valgrind on my program that is using sqlite (3.6.6.2,
> statically linked on Linux, Ubuntu 8.10) for a while, carving away all
> the problems caused by my own code, I was left with the "Syscall param
> write(buf) points to uninitialised byte(s)" error reported within the
> call from writeJournalHdr.
>
> I saw a similar post in the archives, which may be the same issue:
> http://www.mail-archive.com/sqlite-users@sqlite.org/msg38091.html
> But the replies don't explain on _why_ it isn't a problem, hence my
> continued concern and this email. 
>
> Is this covered in a bug issue? The old #536 ticket looks similar, but
> as far as I can tell, the resolution mentioned is more on the PRNG code.
> (And the PRNG fix for valgrind is in 3.6.6.2.)
>   http://www.sqlite.org/cvstrac/tktview?tn=536
>
> Output from valgrind, using the example code at the bottom of
>   http://www.sqlite.org/quickstart.html 
> and run as:
>   valgrind ./testsql test.db "create table testtable(id INTEGER)"
>
> ==
> ==18100== Syscall param write(buf) points to uninitialised byte(s)
> ==18100==at 0x40007D2: (within /lib/ld-2.8.90.so)
> ==18100==by 0x8066B08: writeJournalHdr (sqlite3.c:12420)
> ==18100==by 0x8066D5F: pager_open_journal (sqlite3.c:31731)
> ==18100==by 0x80700A3: sqlite3BtreeBeginTrans (sqlite3.c:35905)
> ==18100==by 0x809956E: sqlite3VdbeExec (sqlite3.c:48875)
> ==18100==by 0x80885D7: sqlite3_step (sqlite3.c:45476)
> ==18100==by 0x8088F31: sqlite3_exec (sqlite3.c:66489)
> ==18100==  Address 0x42eb004 is 36 bytes inside a block of size 1,032
> alloc'd
> ==18100==at 0x4025D2E: malloc (vg_replace_malloc.c:207)
> ==18100==by 0x805AE7A: sqlite3MemMalloc (sqlite3.c:12830)
> ==18100==by 0x8049CC8: mallocWithAlarm (sqlite3.c:15992)
> ==18100==by 0x8049D96: sqlite3Malloc (sqlite3.c:16015)
> ==18100==by 0x804AF34: pcache1Alloc (sqlite3.c:28155)
> ==18100==by 0x804B05C: sqlite3PageMalloc (sqlite3.c:28219)
> ==18100==by 0x80685AB: sqlite3BtreeFactory (sqlite3.c:30603)
> ==18100==by 0x806EED0: openDatabase (sqlite3.c:85463)
> ==
>
> Could it be something like the journal header only is partly filled, but
> needs to be of certain block-size on disk, leaving trailing
> uninitialized bytes? 
>
> I'm not necessarily hoping for a solution as such. A pointer to a bug or
> code comment that explains why it is safe would suffice nicely.
>
> (Sorry to be mentioning 'valgrind', which seems to be akin to a
> four-letter word, on this list... ;)
>
> TIA.
>
>   
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Valgrind, writeJournalHdr and Syscall param write(buf) points to uninitialised byte(s).

2008-12-09 Thread D. Richard Hipp

On Dec 9, 2008, at 11:23 AM, Kent Dahl wrote:

> Hi.
>
> After running valgrind on my program that is using sqlite (3.6.6.2,
> statically linked on Linux, Ubuntu 8.10) for a while, carving away all
> the problems caused by my own code, I was left with the "Syscall param
> write(buf) points to uninitialised byte(s)" error reported within the
> call from writeJournalHdr.
>
>

The uninitialized space is harmless.  But if it worries you there is a  
patch.  http://www.sqlite.org/cvstrac/chngview?cn=5968


> (Sorry to be mentioning 'valgrind', which seems to be akin to a
> four-letter word, on this list... ;)
>

Why do you think this?  We love valgrind.  It's the useless and  
annoying warning messages from VC++ that we hate.


D. Richard Hipp
[EMAIL PROTECTED]



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


[sqlite] Valgrind, writeJournalHdr and Syscall param write(buf) points to uninitialised byte(s).

2008-12-09 Thread Kent Dahl
Hi.

After running valgrind on my program that is using sqlite (3.6.6.2,
statically linked on Linux, Ubuntu 8.10) for a while, carving away all
the problems caused by my own code, I was left with the "Syscall param
write(buf) points to uninitialised byte(s)" error reported within the
call from writeJournalHdr.

I saw a similar post in the archives, which may be the same issue:
http://www.mail-archive.com/sqlite-users@sqlite.org/msg38091.html
But the replies don't explain on _why_ it isn't a problem, hence my
continued concern and this email. 

Is this covered in a bug issue? The old #536 ticket looks similar, but
as far as I can tell, the resolution mentioned is more on the PRNG code.
(And the PRNG fix for valgrind is in 3.6.6.2.)
  http://www.sqlite.org/cvstrac/tktview?tn=536

Output from valgrind, using the example code at the bottom of
  http://www.sqlite.org/quickstart.html 
and run as:
  valgrind ./testsql test.db "create table testtable(id INTEGER)"

==
==18100== Syscall param write(buf) points to uninitialised byte(s)
==18100==at 0x40007D2: (within /lib/ld-2.8.90.so)
==18100==by 0x8066B08: writeJournalHdr (sqlite3.c:12420)
==18100==by 0x8066D5F: pager_open_journal (sqlite3.c:31731)
==18100==by 0x80700A3: sqlite3BtreeBeginTrans (sqlite3.c:35905)
==18100==by 0x809956E: sqlite3VdbeExec (sqlite3.c:48875)
==18100==by 0x80885D7: sqlite3_step (sqlite3.c:45476)
==18100==by 0x8088F31: sqlite3_exec (sqlite3.c:66489)
==18100==  Address 0x42eb004 is 36 bytes inside a block of size 1,032
alloc'd
==18100==at 0x4025D2E: malloc (vg_replace_malloc.c:207)
==18100==by 0x805AE7A: sqlite3MemMalloc (sqlite3.c:12830)
==18100==by 0x8049CC8: mallocWithAlarm (sqlite3.c:15992)
==18100==by 0x8049D96: sqlite3Malloc (sqlite3.c:16015)
==18100==by 0x804AF34: pcache1Alloc (sqlite3.c:28155)
==18100==by 0x804B05C: sqlite3PageMalloc (sqlite3.c:28219)
==18100==by 0x80685AB: sqlite3BtreeFactory (sqlite3.c:30603)
==18100==by 0x806EED0: openDatabase (sqlite3.c:85463)
==

Could it be something like the journal header only is partly filled, but
needs to be of certain block-size on disk, leaving trailing
uninitialized bytes? 

I'm not necessarily hoping for a solution as such. A pointer to a bug or
code comment that explains why it is safe would suffice nicely.

(Sorry to be mentioning 'valgrind', which seems to be akin to a
four-letter word, on this list... ;)

TIA.

-- 
Mvh/Regards,

Kent Dahl
Software Developer

Industrial Control Design AS



Phone: +47 93 07 32 30

Breivika Industriveg 63
N-6018 Ålesund
Norway

[EMAIL PROTECTED]

www.icd.no


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the System Manager [EMAIL PROTECTED] and
delete the material from any computer.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite database to postgresql

2008-12-09 Thread Manisha De Silva
Now that I have a textfile which has a sqlite database can this be added to a
postgresql database? If so how?
This message (and any associated files) is intended only for the use of the 
individual to which it is addressed and may contain information that is 
confidential, subject to copyright protection. If you are not the intended 
recipient you are hereby notified that any dissemination, copying or 
distribution of this message, and any associated files, is strictly prohibited. 
If you have received this message in error, please notify us immediately by 
replying to the message and deleting it from your computer. Messages sent to 
and from us may be monitored.
We do not accept responsibility for any errors or omissions that are present in 
this message, or any attachment, that have arisen as a result of e-mail 
transmission. Any views or opinions presented are solely those of the author 
and do not necessarily represent those of the company.
ePulse Limited
Registered office: 4 Crown Place, London, EC2A 4BT 
Registered in England No 3534157
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] data dump in sqlite

2008-12-09 Thread P Kishor
On 12/9/08, Manisha De Silva <[EMAIL PROTECTED]> wrote:
> I tried this line of code to do a data dump but it doesn't seem to work
>
>
>  sqlite> .dump sqlite3 c:\spool\jsm.db gzip -c > jsm.dump.gz
>  BEGIN TRANSACTION;
>  COMMIT;
>  sqlite>
>
>

You seriously need to read the docs and the help first before asking
such basic questions that have all been documented. Nevertheless, here
are step-by-step instructions

c:\> sqlite3 c:\spool\jsm.db
sqlite> .output jsm.sql
sqlite> .dump
sqlite> .quit
c:\>

You should be able to located jsm.sql on your c:\>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] data dump in sqlite

2008-12-09 Thread Manisha De Silva
I tried this line of code to do a data dump but it doesn't seem to work


sqlite> .dump sqlite3 c:\spool\jsm.db gzip -c > jsm.dump.gz
BEGIN TRANSACTION;
COMMIT;
sqlite>



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manisha De Silva
Sent: 09 December 2008 15:55
To: General Discussion of SQLite Database
Subject: Re: [sqlite] data dump in sqlite

Hi,

This is what I was trying to do :

I double clicked on sqlite3.exe
Then it opens a sqlite prompt 

Now I need to a do a data dump of a file which resides in c:\spool\jsm.db
where jsm.db is the sqlite database.

How can this be done?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Griggs, Donald
Sent: 09 December 2008 15:49
To: General Discussion of SQLite Database
Subject: Re: [sqlite] data dump in sqlite

I'm not certain I understand your question, but here goes:

Sqlite3.exe is a command-line interface, so you don't really "browse" at
all.

However, you can specify the path and name of a database on the command
line when you invoke sqlite3, e.g. (In windows):

Sqlite3 "c:\NiceDirectory_Without_spaces\MyDatabase.db" 

The quotes are usually optional, but not when your path contains spaces

ALSO, you may want to see the ATTACH command in the documentation.

Once inside sqlite3, the .databases command should produce SOME output,
even if you haven't opened an existing database.   

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manisha De Silva
Sent: Tuesday, December 09, 2008 10:36 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] data dump in sqlite

I downloaded sqlite3.exe

I typed in .databases and it doesn't show any database. Actually I have
sqlite db in C:\Program Files\Jabber Inc\Jabber XCP\var\spool and I want
this to dump the data to a text file. 

I typed in sqlite> .databases

How can I browse to the specific folder name which contains the jsm.db
sqlite db file This message (and any associated files) 
=
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
This message (and any associated files) is intended only for the use of the
individual to which it is addressed and may contain information that is
confidential, subject to copyright protection. If you are not the intended
recipient you are hereby notified that any dissemination, copying or
distribution of this message, and any associated files, is strictly
prohibited. If you have received this message in error, please notify us
immediately by replying to the message and deleting it from your computer.
Messages sent to and from us may be monitored.
We do not accept responsibility for any errors or omissions that are present
in this message, or any attachment, that have arisen as a result of e-mail
transmission. Any views or opinions presented are solely those of the author
and do not necessarily represent those of the company.
ePulse Limited
Registered office: 4 Crown Place, London, EC2A 4BT 
Registered in England No 3534157
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
This message (and any associated files) is intended only for the use of the 
individual to which it is addressed and may contain information that is 
confidential, subject to copyright protection. If you are not the intended 
recipient you are hereby notified that any dissemination, copying or 
distribution of this message, and any associated files, is strictly prohibited. 
If you have received this message in error, please notify us immediately by 
replying to the message and deleting it from your computer. Messages sent to 
and from us may be monitored.
We do not accept responsibility for any errors or omissions that are present in 
this message, or any attachment, that have arisen as a result of e-mail 
transmission. Any views or opinions presented are solely those of the author 
and do not necessarily represent those of the company.
ePulse Limited
Registered office: 4 Crown Place, London, EC2A 4BT 
Registered in England No 3534157
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] data dump in sqlite

2008-12-09 Thread Manisha De Silva
Hi,

This is what I was trying to do :

I double clicked on sqlite3.exe
Then it opens a sqlite prompt 

Now I need to a do a data dump of a file which resides in c:\spool\jsm.db
where jsm.db is the sqlite database.

How can this be done?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Griggs, Donald
Sent: 09 December 2008 15:49
To: General Discussion of SQLite Database
Subject: Re: [sqlite] data dump in sqlite

I'm not certain I understand your question, but here goes:

Sqlite3.exe is a command-line interface, so you don't really "browse" at
all.

However, you can specify the path and name of a database on the command
line when you invoke sqlite3, e.g. (In windows):

Sqlite3 "c:\NiceDirectory_Without_spaces\MyDatabase.db" 

The quotes are usually optional, but not when your path contains spaces

ALSO, you may want to see the ATTACH command in the documentation.

Once inside sqlite3, the .databases command should produce SOME output,
even if you haven't opened an existing database.   

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manisha De Silva
Sent: Tuesday, December 09, 2008 10:36 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] data dump in sqlite

I downloaded sqlite3.exe

I typed in .databases and it doesn't show any database. Actually I have
sqlite db in C:\Program Files\Jabber Inc\Jabber XCP\var\spool and I want
this to dump the data to a text file. 

I typed in sqlite> .databases

How can I browse to the specific folder name which contains the jsm.db
sqlite db file This message (and any associated files) 
=
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
This message (and any associated files) is intended only for the use of the 
individual to which it is addressed and may contain information that is 
confidential, subject to copyright protection. If you are not the intended 
recipient you are hereby notified that any dissemination, copying or 
distribution of this message, and any associated files, is strictly prohibited. 
If you have received this message in error, please notify us immediately by 
replying to the message and deleting it from your computer. Messages sent to 
and from us may be monitored.
We do not accept responsibility for any errors or omissions that are present in 
this message, or any attachment, that have arisen as a result of e-mail 
transmission. Any views or opinions presented are solely those of the author 
and do not necessarily represent those of the company.
ePulse Limited
Registered office: 4 Crown Place, London, EC2A 4BT 
Registered in England No 3534157
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] data dump in sqlite

2008-12-09 Thread Griggs, Donald
I'm not certain I understand your question, but here goes:

Sqlite3.exe is a command-line interface, so you don't really "browse" at
all.

However, you can specify the path and name of a database on the command
line when you invoke sqlite3, e.g. (In windows):

Sqlite3 "c:\NiceDirectory_Without_spaces\MyDatabase.db" 

The quotes are usually optional, but not when your path contains spaces

ALSO, you may want to see the ATTACH command in the documentation.

Once inside sqlite3, the .databases command should produce SOME output,
even if you haven't opened an existing database.   

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manisha De Silva
Sent: Tuesday, December 09, 2008 10:36 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] data dump in sqlite

I downloaded sqlite3.exe

I typed in .databases and it doesn't show any database. Actually I have
sqlite db in C:\Program Files\Jabber Inc\Jabber XCP\var\spool and I want
this to dump the data to a text file. 

I typed in sqlite> .databases

How can I browse to the specific folder name which contains the jsm.db
sqlite db file This message (and any associated files) 
=
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] data dump in sqlite

2008-12-09 Thread P Kishor
On 12/9/08, Manisha De Silva <[EMAIL PROTECTED]> wrote:
> I downloaded sqlite3.exe
>
>  I typed in .databases and it doesn't show any database. Actually I have
>  sqlite db in C:\Program Files\Jabber Inc\Jabber XCP\var\spool and I want this
>  to dump the data to a text file.
>
>  I typed in sqlite> .databases
>
>  How can I browse to the specific folder name which contains the jsm.db sqlite
>  db file
>

you really need to read the docs online first. Nevertheless, do the
following (assuming 'spool' is the name of your database)

c:\>sqlite3 C:\Program Files\Jabber Inc\Jabber XCP\var\spool
SQLite version xx
Enter ".help" for instructions
sqlite> .output spool.sql
sqlite> .dump 

Also, do enter ".help" on the sqlite command line to learn more.

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


Re: [sqlite] data dump in sqlite

2008-12-09 Thread Manisha De Silva
I downloaded sqlite3.exe

I typed in .databases and it doesn't show any database. Actually I have
sqlite db in C:\Program Files\Jabber Inc\Jabber XCP\var\spool and I want this
to dump the data to a text file. 

I typed in sqlite> .databases

How can I browse to the specific folder name which contains the jsm.db sqlite
db file
This message (and any associated files) is intended only for the use of the 
individual to which it is addressed and may contain information that is 
confidential, subject to copyright protection. If you are not the intended 
recipient you are hereby notified that any dissemination, copying or 
distribution of this message, and any associated files, is strictly prohibited. 
If you have received this message in error, please notify us immediately by 
replying to the message and deleting it from your computer. Messages sent to 
and from us may be monitored.
We do not accept responsibility for any errors or omissions that are present in 
this message, or any attachment, that have arisen as a result of e-mail 
transmission. Any views or opinions presented are solely those of the author 
and do not necessarily represent those of the company.
ePulse Limited
Registered office: 4 Crown Place, London, EC2A 4BT 
Registered in England No 3534157
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] What is a Group By, having clause?

2008-12-09 Thread Christophe Leske

> Think of HAVING as being analogous to WHERE. While WHERE applies to
> the TABLE, HAVING applies to the results of GROUP. Here is a contrive
yes, thank you.

-- 
Christophe Leske

www.multimedial.de - [EMAIL PROTECTED]
http://www.linkedin.com/in/multimedial
Lessingstr. 5 - 40227 Duesseldorf - Germany
0211 261 32 12 - 0177 249 70 31


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


Re: [sqlite] What is a Group By, having clause?

2008-12-09 Thread Christophe Leske
[EMAIL PROTECTED] wrote:
> http://www.w3schools.com/sql/default.asp
>   
Thanks! That is great!

-- 
Christophe Leske

www.multimedial.de - [EMAIL PROTECTED]
http://www.linkedin.com/in/multimedial
Lessingstr. 5 - 40227 Duesseldorf - Germany
0211 261 32 12 - 0177 249 70 31


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


Re: [sqlite] What is a Group By, having clause?

2008-12-09 Thread P Kishor
On 12/9/08, Christophe Leske <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  can someone point me to some docs where the difference between a normal
>  "where"-clause and the "Group by", and "having" statements are being
>  explained?
>

Think of HAVING as being analogous to WHERE. While WHERE applies to
the TABLE, HAVING applies to the results of GROUP. Here is a contrived
example

SELECT foo, Count(foo) AS count_of_foo
FROM TABLE
WHERE foo LIKE 'C%'
GROUP BY foo
HAVING count_of_foo > 1

The above will take all rows where 'foo' starts with 'C', sum the
value of each distinct 'foo', and then show only those that are more
than 1


>  I don´t quite understand what these are actually good for.
>
>  Thanks,
>
>  --
>  Christophe Leske
>
>  www.multimedial.de - [EMAIL PROTECTED]
>  http://www.linkedin.com/in/multimedial
>  Lessingstr. 5 - 40227 Duesseldorf - Germany
>  0211 261 32 12 - 0177 249 70 31
>
>
>  ___
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


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


Re: [sqlite] What is a Group By, having clause?

2008-12-09 Thread bartsmissaert
http://www.w3schools.com/sql/default.asp

RBS

> Hi,
>
> can someone point me to some docs where the difference between a normal
> "where"-clause and the "Group by", and "having" statements are being
> explained?
>
> I don´t quite understand what these are actually good for.
>
> Thanks,
>
> --
> Christophe Leske
>
> www.multimedial.de - [EMAIL PROTECTED]
> http://www.linkedin.com/in/multimedial
> Lessingstr. 5 - 40227 Duesseldorf - Germany
> 0211 261 32 12 - 0177 249 70 31
>
>
> ___
> 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] What is a Group By, having clause?

2008-12-09 Thread Christophe Leske
Hi,

can someone point me to some docs where the difference between a normal 
"where"-clause and the "Group by", and "having" statements are being 
explained?

I don´t quite understand what these are actually good for.

Thanks,

-- 
Christophe Leske

www.multimedial.de - [EMAIL PROTECTED]
http://www.linkedin.com/in/multimedial
Lessingstr. 5 - 40227 Duesseldorf - Germany
0211 261 32 12 - 0177 249 70 31


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


Re: [sqlite] data dump in sqlite

2008-12-09 Thread P Kishor
On Tue, Dec 9, 2008 at 8:59 AM, Manisha De Silva
<[EMAIL PROTECTED]> wrote:
> I want to do a data dump to a text file, how is it possible to do this in
> SQLite?

Look at the appropriately named .dump command in the sqlite3 shell.

By the way, do you realize that you have a 20 word message followed by
a 154 word signature and disclaimer. That disclaimer says that the
message is "for the use of the individual to which it is addressed"
and that "any... distribution of this message... is strictly
prohibited." All of that is made pointless by posting it to an email
list.

> This message (and any associated files) is intended only for the use of the 
> individual to which it is addressed and may contain information that is 
> confidential, subject to copyright protection. If you are not the intended 
> recipient you are hereby notified that any dissemination, copying or 
> distribution of this message, and any associated files, is strictly 
> prohibited. If you have received this message in error, please notify us 
> immediately by replying to the message and deleting it from your computer. 
> Messages sent to and from us may be monitored.
> We do not accept responsibility for any errors or omissions that are present 
> in this message, or any attachment, that have arisen as a result of e-mail 
> transmission. Any views or opinions presented are solely those of the author 
> and do not necessarily represent those of the company.
> ePulse Limited
> Registered office: 4 Crown Place, London, EC2A 4BT
> Registered in England No 3534157
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


[sqlite] data dump in sqlite

2008-12-09 Thread Manisha De Silva
I want to do a data dump to a text file, how is it possible to do this in
SQLite?
This message (and any associated files) is intended only for the use of the 
individual to which it is addressed and may contain information that is 
confidential, subject to copyright protection. If you are not the intended 
recipient you are hereby notified that any dissemination, copying or 
distribution of this message, and any associated files, is strictly prohibited. 
If you have received this message in error, please notify us immediately by 
replying to the message and deleting it from your computer. Messages sent to 
and from us may be monitored.
We do not accept responsibility for any errors or omissions that are present in 
this message, or any attachment, that have arisen as a result of e-mail 
transmission. Any views or opinions presented are solely those of the author 
and do not necessarily represent those of the company.
ePulse Limited
Registered office: 4 Crown Place, London, EC2A 4BT 
Registered in England No 3534157
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how sqlite use index

2008-12-09 Thread Martin.Engelschalk
Hello Rachmat,

by creating one and using a fitting where- or order-by - clause.
See http://www.sqlite.org/lang_createindex.html

perhaps you would like to ask you question with a litte bit morte detail?

Martin

Rachmat Febfauza schrieb:
> how to make sqlite use index? 
>
>
>
>   
> ___
> 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] how sqlite use index

2008-12-09 Thread Rachmat Febfauza
how to make sqlite use index? 



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


Re: [sqlite] Why SQLITE_LOCKED here?

2008-12-09 Thread Marcus Grimm
Hi,

I also spend some time with a similar application and sqlite
is doing quite well so far, however you will get BUSY states
and LOCK states under "normal" condition and you will need
to handle them.
I skipped to use the busy handler and the busy timeout and do
the handling by my selve. typically like:

---
prepare:

n = 0;
do
{
   rc = sqlite3_prepare_v2(db, SqlStr, -1, hs, 0);
   if( (rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED) )
   {
 n++;
 Sleep(SQLTM_TIME);
   }
}while( (n < SQLTM_COUNT) && ((rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED)));
---

step:
n = 0;
do
{
   rc = sqlite3_step(hs);
   if( (rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED) )
   {
 Sleep(SQLTM_TIME);
 n++;
   }
}while( (n < SQLTM_COUNT) && ((rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED)));



When you do a write operation it turns out to be useful to encapsulate them
with a exclusive transaction.
hope this helps

Marcus

Marco Bambini wrote:
> I have several threads inside an application and each thread opens a  
> connection to the same database.
> The application has been compiled with SQLITE_THREADSAFE = 1.
> One of the threads (just one) open another database connection to the  
> same database used by ALL threads for all the writing operations.
> 
> So I have N threads and N+1 db connections ... and the one db  
> connection is SHARED between all the threads just for WRITE operations  
> (the others N are used just for READ operations on the db).
> I thought that this approach could prevent my app from receiving a  
> SQLITE_LOCKED error... but sometimes it still occurs.
> Any idea of the reason of the error?
> Any idea about how to solve the issue without using the  
> sqlite3_busy_handler or sqlite3_busy_timeout functions?
> 
> Thanks a lot for the clarifications.

-- 
Marcus Grimm, MedCom GmbH Darmstadt, Rundeturmstr. 12, 64283 Darmstadt
Tel: +49(0)6151-95147-10
Fax: +49(0)6151-95147-20
--
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Why SQLITE_LOCKED here?

2008-12-09 Thread Marco Bambini
I have several threads inside an application and each thread opens a  
connection to the same database.
The application has been compiled with SQLITE_THREADSAFE = 1.
One of the threads (just one) open another database connection to the  
same database used by ALL threads for all the writing operations.

So I have N threads and N+1 db connections ... and the one db  
connection is SHARED between all the threads just for WRITE operations  
(the others N are used just for READ operations on the db).
I thought that this approach could prevent my app from receiving a  
SQLITE_LOCKED error... but sometimes it still occurs.
Any idea of the reason of the error?
Any idea about how to solve the issue without using the  
sqlite3_busy_handler or sqlite3_busy_timeout functions?

Thanks a lot for the clarifications.
-- 
Marco Bambini




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


[sqlite] reporting number of changes

2008-12-09 Thread Edzard Pasma
Hello,

The API function sqlite_changes reports the number of rows changed in the last 
update/insert/delete. I'd like to use this in a generic SQL-tracing tool and 
find it a bit inconvenient as the value can only be used if the statement was 
an update/insert/delete. Is there a reason that the value is not reset for 
other type of statements? Or is there an easy way to find if a statement was an 
update?

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