Re: [sqlite] Easyer way ?

2005-09-23 Thread Reid Thompson

Richard Nagle wrote:


is there a easier way of typing in data to Sqlite.

sqlite> insert into car (md_num, md_name, style, year)
   ...> values (1, 'Honda', 'Coupe', 1983)
   ...> ;

Man, just 806 more listing
just looking for some short cuts, or helper apps...etc.
to cut down some of the typing.

Thanks -
Richard


do you already have the data in another format?
csv?, excel?, space delimited?
just about any consistent format can be handled via one of many of the 
scripting languages.


Re: [sqlite] Easier way ?

2005-09-23 Thread D. Richard Hipp
On Fri, 2005-09-23 at 13:00 -0400, Richard Nagle wrote:
> is there a easier way of typing in data to Sqlite.
> 
> sqlite> insert into car (md_num, md_name, style, year)
> ...> values (1, 'Honda', 'Coupe', 1983)
> ...> ;
> 
> Man, just 806 more listing
> just looking for some short cuts, or helper apps...etc.
> to cut down some of the typing.
> 

Use a script to read and parse your original data source.
An example (untested) TCL script for pipe-separated data
is shown below.  Similar things are doable in other
scripting languages.

  package require sqlite3
  sqlite3 db new_database.db
  set in [open input_file.txt]
  db transaction {
while {![eof $in]} {
  set line [split [gets $in] |]
  foreach {md_num md_name style year} $line {
db eval {INSERT INTO car VALUES($md_num, $md_name,
  $style, $year)}
  }
}
  }




Re: [sqlite] Re: Re: sqlite3_busy_timeout

2005-09-23 Thread Doug Hanks
Thanks, Igor.

On 9/23/05, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
> Doug Hanks wrote:
> > Let me see if I understand this correctly:
> >
> > So calling sqlite3_busy_time() allows you sleep for a max of N ms if
> > the database is busy.  Basically this function polls for you?
>
> This is one way to describe it.
>
> > When
> > the database is free, it will return with SQLITE_DONE or SQLITE_ROW?
>
> Not it, but whatever function you called to initiate the request -
> sqlite3_step, sqlite3_execute. You only call sqlite3_busy_timeout once
> to set up the timeout on the database handle, and it affects all future
> operations.
>
> > What happens if the database never gets free?  Will
> > sqlite3_busy_timeout() just return SQLITE_BUSY?
>
> Again, not sqlite3_busy_timeout, but the function that initiated the
> request. Yes, it will wait for the specified time, and if it still
> cannot proceed, it'll fail with SQLITE_BUSY.
>
> Igor Tandetnik
>
>


--
- Doug Hanks = dhanks(at)gmail(dot)com


[sqlite] Re: Re: sqlite3_busy_timeout

2005-09-23 Thread Igor Tandetnik

Doug Hanks wrote:

Let me see if I understand this correctly:

So calling sqlite3_busy_time() allows you sleep for a max of N ms if
the database is busy.  Basically this function polls for you?


This is one way to describe it.


When
the database is free, it will return with SQLITE_DONE or SQLITE_ROW?


Not it, but whatever function you called to initiate the request - 
sqlite3_step, sqlite3_execute. You only call sqlite3_busy_timeout once 
to set up the timeout on the database handle, and it affects all future 
operations.



What happens if the database never gets free?  Will
sqlite3_busy_timeout() just return SQLITE_BUSY?


Again, not sqlite3_busy_timeout, but the function that initiated the 
request. Yes, it will wait for the specified time, and if it still 
cannot proceed, it'll fail with SQLITE_BUSY.


Igor Tandetnik 



[sqlite] Easyer way ?

2005-09-23 Thread Richard Nagle

is there a easier way of typing in data to Sqlite.

sqlite> insert into car (md_num, md_name, style, year)
   ...> values (1, 'Honda', 'Coupe', 1983)
   ...> ;

Man, just 806 more listing
just looking for some short cuts, or helper apps...etc.
to cut down some of the typing.

Thanks -
Richard


Re: [sqlite] Re: sqlite3_busy_timeout

2005-09-23 Thread Doug Hanks
Let me see if I understand this correctly:

So calling sqlite3_busy_time() allows you sleep for a max of N ms if
the database is busy.  Basically this function polls for you?  When
the database is free, it will return with SQLITE_DONE or SQLITE_ROW?

What happens if the database never gets free?  Will
sqlite3_busy_timeout() just return SQLITE_BUSY?

On 9/23/05, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
> Doug Hanks wrote:
> > Can someone please explain to me, in laymen's terms, what
> > sqlite3_busy_timeout() is used for?
> >
> >>  This routine sets a busy handler that sleeps for a while when a
> >> table is locked. The handler will sleep multiple times until at
> >> least "ms" milliseconds of sleeping have been done. After "ms"
> >> milliseconds of sleeping, the handler returns 0 which causes
> >> sqlite3_exec() to return SQLITE_BUSY.
> >
> > Perhaps an example with an explaination is in order?
>
> Suppose you are trying to perform a select, but there's an update
> currently in progress. Without sqlite3_busy_timeout or explicit busy
> handler, your operation will fail immediately with SQLITE_BUSY. But if
> you set up sqlite3_busy_timeout, SQLite will automatically retry your
> operation several times before erroring out. Hopefully the writing
> transaction completes before the timeout has expired, and your select is
> allowed to proceed.
>
> Igor Tandetnik
>
>


--
- Doug Hanks = dhanks(at)gmail(dot)com


[sqlite] Re: sqlite3_busy_timeout

2005-09-23 Thread Igor Tandetnik

Doug Hanks wrote:

Can someone please explain to me, in laymen's terms, what
sqlite3_busy_timeout() is used for?


 This routine sets a busy handler that sleeps for a while when a
table is locked. The handler will sleep multiple times until at
least "ms" milliseconds of sleeping have been done. After "ms"
milliseconds of sleeping, the handler returns 0 which causes
sqlite3_exec() to return SQLITE_BUSY.


Perhaps an example with an explaination is in order?


Suppose you are trying to perform a select, but there's an update 
currently in progress. Without sqlite3_busy_timeout or explicit busy 
handler, your operation will fail immediately with SQLITE_BUSY. But if 
you set up sqlite3_busy_timeout, SQLite will automatically retry your 
operation several times before erroring out. Hopefully the writing 
transaction completes before the timeout has expired, and your select is 
allowed to proceed.


Igor Tandetnik



[sqlite] sqlite3_busy_timeout

2005-09-23 Thread Doug Hanks
Can someone please explain to me, in laymen's terms, what
sqlite3_busy_timeout() is used for?

>  This routine sets a busy handler that sleeps for a while when a table is 
> locked. The handler
> will sleep multiple times until at least "ms" milliseconds of sleeping have 
> been done. After
> "ms" milliseconds of sleeping, the handler returns 0 which causes 
> sqlite3_exec() to return
> SQLITE_BUSY.

Perhaps an example with an explaination is in order?

--
- Doug Hanks = dhanks(at)gmail(dot)com


Re: [sqlite] PRAGMA CACHE_SIZE recommendation for large number of inserts

2005-09-23 Thread Martin Engelschalk

Hello,

I do millions of inserts in one transaction, and have tried many 
different pragmas.
pragma cache_size had very little impact on the speed of inserts (around 
2%).
I think the size of the records might play a role here (mine are around 
100 -200 bytes).

However, PRAGMA synchronous = OFF is very important.

Martin.


deb f schrieb:


I'd like to improve the speed of inserts (am inserting in a
transaction) and would like to change my pragma cache_size to
help.

Are there any recommendations with how to come up with the right
cache_size value?

thx


Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag
 



[sqlite] PRAGMA CACHE_SIZE recommendation for large number of inserts

2005-09-23 Thread deb f
I'd like to improve the speed of inserts (am inserting in a
transaction) and would like to change my pragma cache_size to
help.

Are there any recommendations with how to come up with the right
cache_size value?

thx


Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


[sqlite] With Rollup

2005-09-23 Thread de f
Is there any intention of implementing the "With Rollup". 

Or are there any extensions which might be helpful in
implementing.


Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


[sqlite] Re: BLOB dumping & printing

2005-09-23 Thread Igor Tandetnik

Igor Tandetnik <[EMAIL PROTECTED]> wrote:

You can (kind of) post from the newsgroup - just hit Reply to Author
instead of Reply to Group (or equivalent in your newsreader) and
change the To: address to
[EMAIL PROTECTED] This message is
posted this way.


If you read my previous message from GMane, the email address above will 
be mangled. I meant "sqlite-users at sqlite.org"


Igor Tandetnik 



[sqlite] Re: BLOB dumping & printing

2005-09-23 Thread Igor Tandetnik

Lapo Luchini wrote:

PS: I prefer to read the ML from gmane newsgroup interface, is there
any way I can be added to the people that can post without actually
needing to receive the emails also?


You can (kind of) post from the newsgroup - just hit Reply to Author 
instead of Reply to Group (or equivalent in your newsreader) and change 
the To: address to [EMAIL PROTECTED] This message is posted this 
way.


There does not seem to be any way to stop getting emails short of 
unsubscribing, but you can set up a filter in your mail reader to drop 
them on the floor.


Igor Tandetnik 



[sqlite] BLOB dumping & printing

2005-09-23 Thread Lapo Luchini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I think I found a small glitch or, maybe, consider it a request for
enhancement ;-)

% sqlite3 prova  
SQLite version 3.2.5
Enter ".help" for instructions
sqlite> CREATE TABLE a(b);
sqlite> INSERT INTO a VALUES (X'41424300500051');
sqlite> .dump
BEGIN TRANSACTION;
CREATE TABLE a(b);
INSERT INTO "a" VALUES(X'41424300500051');
COMMIT;
sqlite> .mode insert
sqlite> SELECT * FROM a;
INSERT INTO table VALUES('ABC');

It would be nice for ".mode insert" to print a command that would
actually re-create the same data, the same as ".dump" (the obvious
difference is that .dump can't filter data in any way, it just dumps
it all) or, at least, it would be very nice if the already existing
function that "prints binary data as X'-encoded-string" were reachable
from SQL, so that one could use something like:
SELECT xencode(b) FROM a;
and obtain
X'41424300500051'

Lapo

PS: I prefer to read the ML from gmane newsgroup interface, is there
any way I can be added to the people that can post without actually
needing to receive the emails also?

- --
L a p o   L u c h i n i
l a p o @ l a p o . i t
w w w . l a p o . i t /
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iEYEARECAAYFAkMzy2sACgkQaJiCLMjyUvucQwCg3qVABfQAdoaViiDypL/kjoEi
aVEAoO8HDKElCdWbqhDG6wlC2ed9f0qW
=dFDl
-END PGP SIGNATURE-