Re: [sqlite] Advices to get max performance with SQLITE and BLOBS

2009-03-16 Thread John Machin
On 16/03/2009 5:48 PM, Pierre Chatelier wrote: >> A few hundred blocks of raw data? Blocksize approx 300K bytes? >> Database >> created and dropped by the same process? 500 blocks is approx 150M >> bytes; why not keep it in a hash table in memory? If you keep it in a >> database or the file syste

[sqlite] Getting field data back from SQLite db

2009-03-16 Thread ddk
Hello, I am new on SQLite so bear with me :-) Can someone give me a simple c solution on following: I execute select telnr from contacts where name="David" I just want to get from the found record the content of field telnr back to my c program in variable c_telnr. Thanks in advance, Danny Be

[sqlite] Mozilla Firefox 3.0.7 using SQLITE 3.5.9 crash on AIX

2009-03-16 Thread Shailendra Jain
Hi, While running Mozilla Firefox 3 on AIX platform, the application crashed with below stacktrace information. sqlite3_result_value() at 0x900077bb084 minMaxFinalize() sqlite3VdbememFinalize() sqlite3VdbeExec() sqlite3Step() ExecuteStep_19mozStorageStatementFPi() Init_12nsNavHistoryEv(

[sqlite] How to Use Dot Commands from the Library

2009-03-16 Thread HG
I want to get a dump of an sqlite3 database using the sqlite3 library without adding a dependency on the sqlite3 executable. Does the sqlite3 library support execution of dot commands. The following fails for me :- -- import sqlite3 conn = sqlite3.connect('media_db.db') c = conn.cursor() c.e

Re: [sqlite] How to Use Dot Commands from the Library

2009-03-16 Thread Mihai Limbasan
You cannot do that. The dot commands are not SQL, and SQLite only understands SQL. The dot commands are provided by the shell executable. You could simply look at its source code, see how each specific command is implemented, and reimplement that functionality in your app. HG wrote: > I want to

Re: [sqlite] Getting field data back from SQLite db

2009-03-16 Thread Simon Davies
2009/3/16 : > Hello, > > I am new on SQLite so bear with me :-) > > Can someone give me a simple c solution on following: > > I execute select telnr from contacts where name="David" > > I just want to get from the found record the content of field telnr back to > my c > program in variable c_teln

[sqlite] Perl DBD Question

2009-03-16 Thread marcos rebelo
Hi all I'm a Perl programmer using SQLite I want to retry to execute every command automatically, until the DB is not locked. In C seems that I need to set the busy_handler. How do I do this with DBD in Perl? Thanks for any help Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freeh

Re: [sqlite] Perl DBD Question

2009-03-16 Thread David Westbrook
At the app level you can do something like this to check for the "database is locked(5)" error. Note the sleep and max ~1000 attempts functionality as well. my $ct = 0; while( $ct++ < 1000 ){ $dbh->do($sql, {}, @bind); if( $dbh->err == 5 ){ # If got a locked code, try again sleep 1; n

[sqlite] starting INTEGER PRIMARY KEY at 0

2009-03-16 Thread P Kishor
is there a way to have a table start the INTEGER PRIMARY KEY sequence at 0 (or some other arbitrary number)? -- Puneet Kishor ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] starting INTEGER PRIMARY KEY at 0

2009-03-16 Thread P Kishor
On Mon, Mar 16, 2009 at 8:31 AM, P Kishor wrote: > is there a way to have a table start the INTEGER PRIMARY KEY sequence > at 0 (or some other arbitrary number)? > > -- > Puneet Kishor > I should have added.. yes, I can do the following CREATE TABLE foo (a INTEGER PRIMARY KEY, b TEXT); INSERT IN

Re: [sqlite] starting INTEGER PRIMARY KEY at 0

2009-03-16 Thread John Machin
On 17/03/2009 12:33 AM, P Kishor wrote: > On Mon, Mar 16, 2009 at 8:31 AM, P Kishor wrote: >> is there a way to have a table start the INTEGER PRIMARY KEY sequence >> at 0 (or some other arbitrary number)? >> >> -- >> Puneet Kishor >> > > I should have added.. yes, I can do the following > > CRE

Re: [sqlite] datetime as integer

2009-03-16 Thread MikeW
Timothy A. Sawyer writes: > > I stand corrected on the math > > Bottom line is that different applications use different baseline values for epoch (beginning of time) > and you must know that baseline value > --Original Message-- > From: Kees Nuyt > Sender: sqlite-users-boun...@... > To

[sqlite] In-memory databases from Perl

2009-03-16 Thread Jean-Denis Muys
Hello, I am quite a newbie but I already spent a significant amount of time on Google, to no avail. I have a very small Perl program which exercises the basic SQLite3 features, and it works very well. I connect from Perl to SQLite3 through DBI, because it's a no brainer. I don't know whether the

Re: [sqlite] starting INTEGER PRIMARY KEY at 0

2009-03-16 Thread P Kishor
On Mon, Mar 16, 2009 at 8:59 AM, John Machin wrote: > On 17/03/2009 12:33 AM, P Kishor wrote: >> On Mon, Mar 16, 2009 at 8:31 AM, P Kishor wrote: >>> is there a way to have a table start the INTEGER PRIMARY KEY sequence >>> at 0 (or some other arbitrary number)? >>> >>> -- >>> Puneet Kishor >>> >

Re: [sqlite] In-memory databases from Perl

2009-03-16 Thread Jean-Denis Muys
On 3/16/09 3:03 PM, "Jean-Denis Muys" wrote: > Now I want to use an in-memory database, so I replaced my original connect > statement with the one suggested at > http://www.sqlite.org/cvstrac/wiki?p=PerlNotes : > > my $dbh = DBI->Connect("dbi:SQLite:dbname=:memory:"); > > However, this d

Re: [sqlite] datetime as integer

2009-03-16 Thread P Kishor
On Mon, Mar 16, 2009 at 9:00 AM, MikeW wrote: > Timothy A. Sawyer writes: > >> >> I stand corrected on the math >> >> Bottom line is that different applications use different baseline values for > epoch (beginning of time) >> and you must know that baseline value >> --Original Message-- >

Re: [sqlite] In-memory databases from Perl

2009-03-16 Thread P Kishor
On Mon, Mar 16, 2009 at 9:03 AM, Jean-Denis Muys wrote: > Hello, > > I am quite a newbie but I already spent a significant amount of time on > Google, to no avail. > > I have a very small Perl program which exercises the basic SQLite3 features, > and it works very well. > > I connect from Perl to

Re: [sqlite] datetime as integer

2009-03-16 Thread John Elrick
MikeW wrote: > Timothy A. Sawyer writes: > > >> I stand corrected on the math >> >> Bottom line is that different applications use different baseline values for >> > epoch (beginning of time) > >> and you must know that baseline value >> --Original Message-- >> From: Kees Nuyt >

Re: [sqlite] In-memory databases from Perl

2009-03-16 Thread Jean-Denis Muys
On 3/16/09 3:10 PM, "P Kishor" wrote: > On Mon, Mar 16, 2009 at 9:03 AM, Jean-Denis Muys wrote: >> Now I want to use an in-memory database, so I replaced my original connect >> statement with the one suggested at >> http://www.sqlite.org/cvstrac/wiki?p=PerlNotes : >> >>     my $dbh = DBI->Conn

Re: [sqlite] designing a db to hold repeating data

2009-03-16 Thread P Kishor
On Sun, Mar 15, 2009 at 8:57 PM, Rich Shepard wrote: > On Sun, 15 Mar 2009, P Kishor wrote: > >> CREATE TABLE met ( >>        met_id INTEGER PRIMARY KEY, >>        other met attributes, >>        met_grid_id INTEGER >> ); > >   Given the quantity of data you have I urge you to read Joe Celko's "SQ

Re: [sqlite] In-memory databases from Perl

2009-03-16 Thread P Kishor
On Mon, Mar 16, 2009 at 9:16 AM, Jean-Denis Muys wrote: > > On 3/16/09 3:10 PM, "P Kishor" wrote: > >> On Mon, Mar 16, 2009 at 9:03 AM, Jean-Denis Muys >> wrote: >>> Now I want to use an in-memory database, so I replaced my original connect >>> statement with the one suggested at >>> http://www

Re: [sqlite] datetime as integer

2009-03-16 Thread John Machin
On 17/03/2009 1:00 AM, MikeW wrote: > Timothy A. Sawyer writes: > [snip] >> For date calculations, SQLite prefers real values containing >> number of days since noon in Greenwich on November 24, 4714 >> B.C., using the Proleptic Gregorian calendar: > SNIP > > "noon in Greenwich on November 24,

Re: [sqlite] In-memory databases from Perl

2009-03-16 Thread Jean-Denis Muys
On 3/16/09 3:24 PM, "P Kishor" wrote: > Jean-Denis, do consider correcting the wiki so others after you are > not similarly misled. Done. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-use

[sqlite] web page data scraping to sqlite db

2009-03-16 Thread ddk
Hello, I am working on a SQLite db with equity data in it. On http://finance.yahoo.com/q?s=dow you can find the current P/E and Div & Yield fields. So I like to store in my db for name=DOW pe=12.25 and div=7.9 in a automated way. I can use wget to get the page in a file but I still needs some fu

Re: [sqlite] web page data scraping to sqlite db

2009-03-16 Thread John Machin
On 17/03/2009 1:55 AM, d...@dommel.be wrote: > Hello, > > > I am working on a SQLite db with equity data in it. > On http://finance.yahoo.com/q?s=dow you can find the current P/E and Div & > Yield > fields. So I like to store in my db for name=DOW pe=12.25 and div=7.9 in a > automated way. > >

[sqlite] Index optimization

2009-03-16 Thread Andrea Galeazzi
I red this article on wiki: http://www.sqlite.org/cvstrac/wiki?p=ScrollingCursor I've got a similar case but the difference is that I've to use LIKE operator instead of = SELECT title FROM tracks WHERE title LIKE %Mad% AND ((title=:last_title AND id>:last_id) OR ((title>:last_title)) O

Re: [sqlite] Index optimization

2009-03-16 Thread Andrea Galeazzi
d a LIKE operator on > title column? > Thanks. > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > __ NOD32 3939 (20090316) Information __ > &g

Re: [sqlite] Index optimization

2009-03-16 Thread Igor Tandetnik
"Andrea Galeazzi" wrote in message news:49be74fd.6060...@korg.it > I red this article on wiki: > http://www.sqlite.org/cvstrac/wiki?p=ScrollingCursor > I've got a similar case but the difference is that I've to use LIKE > operator instead of = > SELECT title FROM tracks >WHERE title LIKE

Re: [sqlite] Perl DBD Question

2009-03-16 Thread marcos rebelo
I'm considering... package KQI::Utils::SQLiteWrapper; use strict; use warnings; use Data::Dumper; use DBI; use Carp qw(confess); sub new { my ( $pkg, $path, $attr, $count) = @_; $pkg = ref($pkg) if ref($pkg); my %attr = ( 'RaiseError' => 1, 'AutoCommit' => 1,

[sqlite] Query help

2009-03-16 Thread Marco Bambini
Hello all, I have a table foo (id INTEGER, tid INTEGER, optype INTEGER), and I have some data into foo: id id2 optype - 1 2 10 2 2 10 3 2 10 4 2 10 5 2 10 6 2 20 7 2 10 8 2

Re: [sqlite] datetime as integer

2009-03-16 Thread MikeW
John Machin writes: > > > "noon in Greenwich on November 24, 4714 BC" - > > presumably that's the beginning of time for Creationists ... > > You presume incorrectly; it's the start of Scaliger's 7980-year "Julian" > astronomical cycle. (http://en.wikipedia.org/wiki/Julian_day#History) > > You a

Re: [sqlite] Query help

2009-03-16 Thread Igor Tandetnik
"Marco Bambini" wrote in message news:3265458b-af7b-434f-83e8-f9448bab0...@sqlabs.net > Hello all, > > I have a table foo (id INTEGER, tid INTEGER, optype INTEGER), > and I have some data into foo: > id id2 optype > - > 1 2 10 > 2 2 10 > 3 2 10 > 4 2 10 > 5 2 10 > 6 2 20 > 7 2

[sqlite] Adding a NOT NULL column fails on empty table

2009-03-16 Thread Alex Ousherovitch
Hello list, The attempts to add a NOT NULL column on an empty table ALTER TABLE tbl_name ADD COLUMN col_name blob NOT NULL fail with the following error message: Cannot add a NOT NULL column with default value NULL As I understand, many other systems allow it when the table has no reco

Re: [sqlite] Adding a NOT NULL column fails on empty table

2009-03-16 Thread Igor Tandetnik
"Alex Ousherovitch" wrote in message news:5ee1928d06817b4788b64caf1a8517b00325e...@sfo-ex-01.ad.opentv.local > The attempts to add a NOT NULL column on an empty table > > ALTER TABLE tbl_name ADD COLUMN col_name blob NOT NULL > > fail with the following error message: > > Cannot add a NOT NULL co

Re: [sqlite] Adding a NOT NULL column fails on empty table

2009-03-16 Thread Alex Ousherovitch
We want this operation to work when it can and fail when it has to. In some cases the user will specify NOT NULL and in others they won't. Of course we can drop and recreate the table but then we have to examine the request to see if the field has the NOT NULL constraint and then test to see if the

[sqlite] SQLITE : documentation and search topics

2009-03-16 Thread REPKA_Maxime_NeufBox
Hello, A main remark to SQLite developers : - Does it exist a Help file .chm for SQLite ? I am quite new user with Database and SQLite and find very hard to get information and documentation. My opinion is that it is totaly NOT intuitive on the web to find information. For comparison I am quite

Re: [sqlite] Adding a NOT NULL column fails on empty table

2009-03-16 Thread Noah Hart
>From the documentation http://sqlite.org/lang_altertable.html The ADD COLUMN syntax is used to add a new column to an existing table. ... * If a NOT NULL constraint is specified, then the column must have a default value other than NULL. Regards, Noah -Original Message- From: sqlit

Re: [sqlite] SQLITE : documentation and search topics

2009-03-16 Thread Griggs, Donald
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of REPKA_Maxime_NeufBox Sent: Monday, March 16, 2009 3:11 PM To: General Discussion of SQLite Database Subject: [sqlite] SQLITE : documentation and search topics Hello, A main re

[sqlite] Using SQLite from Elisp functions

2009-03-16 Thread Florian v. Savigny
Dear Listmates, I would like to use SQLite from within Emacs. I have rummaged through the Website, and it seems that nobody has programmed any bindings for Elisp so far, and I'm afraid I'm not smart enough to do that. The only possibility I can currently see would be starting the sqlite command

Re: [sqlite] SQLITE : Constraint question

2009-03-16 Thread Wolfgang Enzinger
> Date: Sun, 15 Mar 2009 23:17:04 -0400 > From: "Griggs, Donald" > Subject: Re: [sqlite] SQLITE : Constraint question >> BTW, is there a document that explains in more detail what operations >> the CHECK constraint is capable of? [...] > Were you looking for something beyond the documentation

Re: [sqlite] SQLITE : Constraint question

2009-03-16 Thread D. Richard Hipp
On Mar 16, 2009, at 6:02 PM, Wolfgang Enzinger wrote: > >> Were you looking for something beyond the documentation under "CREATE >> TABLE"? >> >> Column constraints: >> http://www.sqlite.org/syntaxdiagrams.html#column-constraint >> >> Table constraints: >> http://www.sqlite.org/syntaxdiagr

Re: [sqlite] SQLITE : Constraint question

2009-03-16 Thread John Machin
On 17/03/2009 9:02 AM, Wolfgang Enzinger wrote: >> Date: Sun, 15 Mar 2009 23:17:04 -0400 >> From: "Griggs, Donald" >> Subject: Re: [sqlite] SQLITE : Constraint question > >>> BTW, is there a document that explains in more detail what operations >>> the CHECK constraint is capable of? > > [...] >

[sqlite] Re trieve results of a query into a bash script, and use them to iterate

2009-03-16 Thread urschrei
I'd like to use the results of a simple select query in a bash script, and iterate through them with a 'for' loop. I have something like the following in mind: names = `sqlite3 db1.sl3 'select * from names;'` users = `sqlite3 db2.sl3 'select * from users;'` for n in names do for u in users do

Re: [sqlite] Re trieve results of a query into a bash script, and use them to iterate

2009-03-16 Thread Ken
you might want to do a search on named pipes... Also you query could then be simplified. attach database 'db2.sl3' as usr select u.* from usr.user u, names n where u.name = n.name --- On Mon, 3/16/09, urschrei wrote: > From: urschrei > Subject: [sqlite] Re trieve results of a query into

[sqlite] Getting SQLITE_BUSY within a transaction and how to handle it

2009-03-16 Thread Dennis Volodomanov
Hello all, I'm having this problem... I have one database and two threads opening it for reading/writing (in a simplistic scenario). Now, one of the threads issues (successfully) a "BEGIN IMMEDIATE TRANSACTION" and starts doing what it needs. The second thread also issues a "BEGIN IMMEDIATE TRANS

Re: [sqlite] Getting SQLITE_BUSY within a transaction and how to handle it

2009-03-16 Thread Shawn Wilsher
On Mon, Mar 16, 2009 at 10:02 PM, Dennis Volodomanov < dennis.volodoma...@conceiva.com> wrote: > Do I need the finalize the statement and re-prepare it again in the > second thread before trying to step it? Are you at least reseting the statement? I hit this once before, and reseting the stateme

Re: [sqlite] Getting SQLITE_BUSY within a transaction and how tohandle it

2009-03-16 Thread Dennis Volodomanov
> Are you at least reseting the statement? I hit this once before, and > reseting the statement fixed the issue for me. No... I'll try that, thanks! Dennis ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailma

Re: [sqlite] LEFT INNER JOIN a second database

2009-03-16 Thread Derek Developer
>And every reply, even if it is not helpful, is worthy of grateful >thanks because it is being provided free by a list member. This is why i put help in quotes. Please tell me how helpfull comments like: "Rule 1: Assume nothing. Demand proof. " "So produce believable evidence. " "Nobody is going