Re: [sqlite] sqlite performance, locking & threading

2006-12-27 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Emerson Clarke wrote: | modified the api to ensure that each thread was given its own sqlite3 * | structure. I would assume that the actual indexing is the expensive part since it involves a lot of I/O (SQLite page size is 1KB). Why don't you do

[sqlite] Re: multiple selects in a single prepare

2006-12-27 Thread A. Pagaltzis
* chetana bhargav <[EMAIL PROTECTED]> [2006-12-28 06:00]: > Just wanted to know can we have multiple quries in a single > prepare statement seperated by semicolons.Something like, > > Select count(*) from tbl where name="foo";select count(*) from tbl1 where > name = "bar" Just how is that

[sqlite] Re: multiple selects in a single prepare

2006-12-27 Thread Igor Tandetnik
chetana bhargav wrote: Just wanted to know can we have multiple quries in a single prepare statement seperated by semicolons.Something like, Select count(*) from tbl where name="foo";select count(*) from tbl1 where name = "bar" sqlite3_prepare will parse a single statement, and return a

[sqlite] multiple selects in a single prepare

2006-12-27 Thread chetana bhargav
Hi, Just wanted to know can we have multiple quries in a single prepare statement seperated by semicolons.Something like, Select count(*) from tbl where name="foo";select count(*) from tbl1 where name = "bar" ... Chetana. __ Do You Yahoo!?

[sqlite] SQLite is amazing

2006-12-27 Thread Doug
I am once again experiencing one of those moments of awe at how incredible SQLite is. I was about to write some custom functions for some complex date manipulation but I find it's already there. The speed, robustness, professionalism in this product is fantastic. Thank you Dr. Richard Hipp!

[sqlite] sqlite performance, locking & threading

2006-12-27 Thread Emerson Clarke
I am developing a multithreaded C++ library which uses sqlite as an embedded database alongside the mysql client as a simple sql api. Both databases share a common interface which supports statements, prepared statements, recordsets, records, and transactions. As part of some research and

Re: [sqlite] Re: Re: Tokenizing in a trigger

2006-12-27 Thread Joe Wilson
--- Igor Tandetnik <[EMAIL PROTECTED]> wrote: > Joe Wilson wrote: > > Can you get a valid sqlite3* database connection from a function's > > sqlite3_context* without relying on the user data when registering > > the function? > > Not in a documented way, as far as I can tell. What's wrong with

[sqlite] Re: Re: Tokenizing in a trigger

2006-12-27 Thread Igor Tandetnik
Joe Wilson wrote: Can you get a valid sqlite3* database connection from a function's sqlite3_context* without relying on the user data when registering the function? Not in a documented way, as far as I can tell. What's wrong with relying on user data? Igor Tandetnik

Re: [sqlite] Re: Tokenizing in a trigger

2006-12-27 Thread Joe Wilson
Can you get a valid sqlite3* database connection from a function's sqlite3_context* without relying on the user data when registering the function? --- Igor Tandetnik <[EMAIL PROTECTED]> wrote: > A trigger can call a custom function, which can do pretty much anything, > including executing one

[sqlite] Re: Tokenizing in a trigger

2006-12-27 Thread Igor Tandetnik
Ron Stevens wrote: Is there any way to get a trigger to insert a variable number of rows based on a single row being updated? A trigger can call a custom function, which can do pretty much anything, including executing one or more SQL statements. Igor Tandetnik

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Casadonte
On Wed, 27 Dec 2006, Joe Wilson wrote: > Here's the problem - the DBD::SQLite author explicitly removes the > table prefix in > > http://search.cpan.org/src/MSERGEANT/DBD-SQLite-1.13/dbdimp.c > > See "drop table name from field name" below... Thanks, Joe! -- Regards, joe Joe Casadonte

[sqlite] Tokenizing in a trigger

2006-12-27 Thread Ron Stevens
Hi all, I have two tables: CREATE TABLE data (id INTEGER PRIMARY KEY, data TEXT); CREATE TABLE tokens (token TEXT, data INTEGER); Where tokens contains a list of each data row broken down into multiple tokens (split on semicolons). I want to create a trigger that on updates to data will remove

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Wilson
> --- Joe Casadonte <[EMAIL PROTECTED]> wrote: > > At least insofar as the pragmas change in the sqlite engine itself. > > But neither method has an effect on the output of the Perl code. He > > has his own FullCol/ShortCol variables in select.c where he figures > > out what to return. These are

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Wilson
--- Joe Casadonte <[EMAIL PROTECTED]> wrote: > At least insofar as the pragmas change in the sqlite engine itself. > But neither method has an effect on the output of the Perl code. He > has his own FullCol/ShortCol variables in select.c where he figures > out what to return. These are set via

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Clay Dowling
sqlite3_column_name would be favorite, assuming that the DBD provider uses the prepared statements API (which it should be doing). Clay Dowling Joe Casadonte said: > On Wed, 27 Dec 2006, Clay Dowling wrote: > >> If you use the SQLite API rather than shelling to the SQLite command >> line utility

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Casadonte
On Wed, 27 Dec 2006, Joe Wilson wrote: > my $dbh = DBI->connect($db); > ... > $dbh->do('PRAGMA full_column_names=1'); > $dbh->do('PRAGMA short_column_names=0'); Yeah, I eventually figured that out. This works as well: my $dbh = DBI->connect($db); ... my($sth) =

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Wilson
my $dbh = DBI->connect($db); ... $dbh->do('PRAGMA full_column_names=1'); $dbh->do('PRAGMA short_column_names=0'); The aliases in SQLite have always been finicky. Instead of using aliases, just use the table names throughout, as in SELECT Edition.*, Publisher.Name FROM Edition,

Re: [sqlite] Re: UPDATE multiple fields

2006-12-27 Thread bartsmissaert
Actually it is even better as I can combine all the UPDATE statements both from the inner and the outer loop and run only one UPDATE, so it is more than the number of fields times as fast, although not quite i times c times as fast. Thanks again! RBS > Thanks, that was very helpful. In fact it

Re: [sqlite] Re: UPDATE multiple fields

2006-12-27 Thread bartsmissaert
Thanks, that was very helpful. In fact it looks it as many times faster as the number of fields to be done, so in my particular case 5 times faster! Maybe somebody who knows the inner workings of SQLite could explain why this is. Will see if I can apply this to some other places in my app. RBS

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Casadonte
On Wed, 27 Dec 2006, Joe Wilson wrote: > Search for these pragmas in the perl module. There might be a method > wrapping them. If there isn't, just execute these pragmas just after > opening the database. Can't figure out how to execute them via Perl (yet). Interestingly, they only half work in

[sqlite] Re: UPDATE multiple fields

2006-12-27 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: What would the query construction be in SQLite to update multiple fields? I have tried all sort of syntaxes, but sofar no success yet. I now have to do it in a loop, but that is a bit slow: For i = 2 To lMaxEntryCount For c = 1 To UBound(arrFields) strUPDATE =

[sqlite] UPDATE multiple fields

2006-12-27 Thread bartsmissaert
What would the query construction be in SQLite to update multiple fields? I have tried all sort of syntaxes, but sofar no success yet. I now have to do it in a loop, but that is a bit slow: For i = 2 To lMaxEntryCount For c = 1 To UBound(arrFields) strUPDATE = arrFields2(c) & "_E" & i strSQL =

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Wilson
The pragmas would help... sqlite> PRAGMA short_column_names = 0; sqlite> PRAGMA full_column_names = 1; sqlite> select t1.*, t2.* from t1, t2; t1.a|t2.a 4|5 --- Joe Wilson <[EMAIL PROTECTED]> wrote: > Search for these pragmas in the perl module. There might be a method > wrapping them.

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Wilson
Search for these pragmas in the perl module. There might be a method wrapping them. If there isn't, just execute these pragmas just after opening the database. sqlite> select E.*, t2.* from t1 E, t2; E.a|t2.a 4|5 --- Joe Casadonte <[EMAIL PROTECTED]> wrote: > When querying multiple tables

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Casadonte
On Wed, 27 Dec 2006, Clay Dowling wrote: > If you use the SQLite API rather than shelling to the SQLite command > line utility you may get more satisfactory results. The API between > 2.x and 3.x is quite different, but the column headers are readily > available. I actually need this capability

Re: [sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Clay Dowling
If you use the SQLite API rather than shelling to the SQLite command line utility you may get more satisfactory results. The API between 2.x and 3.x is quite different, but the column headers are readily available. Clay Dowling Joe Casadonte said: > > When querying multiple tables I was

[sqlite] Change in behavior from 2.x to 3.x

2006-12-27 Thread Joe Casadonte
When querying multiple tables I was relying on SQLite to return the column names with the table name/designator prepended to it. The following works in 2.x but not in 3.x: SQLite version 2.8.17 Enter ".help" for instructions sqlite> .header on sqlite> SELECT E.*, P.Name FROM Edition AS E,