RE: [sqlite] Quick question about sqlite_trace

2004-10-13 Thread Keith Herold
For every statement; great!

--Keith

-Original Message-
From: Keith Herold [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 13, 2004 11:03 AM
To: [EMAIL PROTECTED]
Subject: [sqlite] Quick question about sqlite_trace


Does sqlite_trace fire for every sql statement in a sql_exec, or just
for the whole sql_exec/sql_compile?  I.e., suppose the call to sql_exec
is:

BEGIN TRANSACTION;
INSERT INTO tblMyDestinationTable (Dogs, Cats, FoodCosts)
   SELECT * 
   FROM tblMyTable tmt
   WHERE tmt.Foo = 'bar';

SELECT last_insert_rowid();
END TRANSACTION;

So, does sqlite_trace fire for each of BEGIN, INSERT INTO, SELECT, END ,
or just once for the whole sql_exec?

I do lots of these kinds of things, and it would be nice if I could
output the sequence to as they are actually executed rather than as a
big chunk.

--Keith

**
- I'm not a professional; I just get paid to do this.

- Things I've learned about multithreaded programming:

123...   PPArrvooottieedcc ttm  ueelvvteeirrtyyhtt
rhheiianndgge  dwi hnpi rctohhg eri aslm omscitanalgt 
 iowcbh,je engceltvo ebwrah lip,co hso srci abonlt ehb
.ee^Nr waicscee snsoetd  'aotb jtehcet -slaomcea lt'il
m^Ne from two or more threads
**



Re: [sqlite] strange rounding problem

2004-10-13 Thread ben . carlyle
Donald,





Will Leshner <[EMAIL PROTECTED]>
14/10/2004 04:20 AM
Please respond to sqlite-users

 
To: [EMAIL PROTECTED]
cc: 
Subject:Re: [sqlite] strange rounding problem


>The point is that the number is in the database as '358', but by the time 
we get it back from a query it has become '357.999'. We aren't  doing any 
floating point with the number. It is (apparently) happening for us in the 
SQLite engine itself. But we depend on the number being '358' when we 
query for it and because it isn't, on some machines, our app fails.

Can you come up with a minimal test case that exhibits this behaviour? 
Ideally, it would be a series of SQL statements written into the sqlite 
shell program that results in something visibly wrong. The second best 
case would be a short (10-20 line) C program that uses the sqlite API only 
to demonstrate the problem. Perhaps other users of this list could test on 
their own machines and come up with more information.

Benjamin.



Re: [sqlite] strange rounding problem

2004-10-13 Thread Will Leshner
[EMAIL PROTECTED] wrote:

Can you come up with a minimal test case that exhibits this behaviour? 
Ideally, it would be a series of SQL statements written into the sqlite 
shell program that results in something visibly wrong. The second best 
case would be a short (10-20 line) C program that uses the sqlite API only 
to demonstrate the problem. Perhaps other users of this list could test on 
their own machines and come up with more information.
Thanks. I'll certainly try. But it is very elusive. The exact same query works fine on some machines and doesn't on others. And that's with the exact same binary executable. We even copied the executable from one machine that works to another machine that doesn't. For now we have moved back to an older version of SQLite and that seems to have fixed the problem.


RE: [sqlite] sqlite with Borland C++ 5.02

2004-10-13 Thread Pigott, Paul
Excellent.  Thanks.

-Original Message-
From: Dennis Cote [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 13, 2004 3:03 PM
To: [EMAIL PROTECTED]
Subject: Re: [sqlite] sqlite with Borland C++ 5.02


Pigott, Paul wrote:
> Is there a pre-compiled binary for that?  Or do you just convert the
> .DLL to a .LIB with a utility?

You need to generate an Borland import library for the DLL using Borland's
IMPLIB utility. The command to use depends upon which version of sqlite you
are using.

For SQLite version 2

IMPLIB -a sqlite.lib sqlite.dll

or for SQLite version 3

IMPLIB -a sqlite3.lib sqlite3.dll

This will generate the appropriate .lib file which you will need to link to
your project. You will also need to copy the DLL to your applications
doirectory or the Windows/System directory so the application can load the
DLL when needed.


Re: [sqlite] sqlite with Borland C++ 5.02

2004-10-13 Thread Dennis Cote
Pigott, Paul wrote:
> Is there a pre-compiled binary for that?  Or do you just convert the
> .DLL to a .LIB with a utility?

You need to generate an Borland import library for the DLL using Borland's
IMPLIB utility. The command to use depends upon which version of sqlite you
are using.

For SQLite version 2

IMPLIB -a sqlite.lib sqlite.dll

or for SQLite version 3

IMPLIB -a sqlite3.lib sqlite3.dll

This will generate the appropriate .lib file which you will need to link to
your project. You will also need to copy the DLL to your applications
doirectory or the Windows/System directory so the application can load the
DLL when needed.


Re: [sqlite] strange rounding problem

2004-10-13 Thread Will Leshner
Griggs, Donald wrote:
If I'm missing the (decimal) point, here, forgive me.
The point is that the number is in the database as '358', but by the time we get it back from a query it has become '357.999'. We aren't doing any floating point with the number. It is (apparently) happening for us in the SQLite engine itself. But we depend on the number being '358' when we query for it and because it isn't, on some machines, our app fails.


[sqlite] Quick question about sqlite_trace

2004-10-13 Thread Keith Herold
Does sqlite_trace fire for every sql statement in a sql_exec, or just
for the whole sql_exec/sql_compile?  I.e., suppose the call to sql_exec
is:

BEGIN TRANSACTION;
INSERT INTO tblMyDestinationTable (Dogs, Cats, FoodCosts)
   SELECT * 
   FROM tblMyTable tmt
   WHERE tmt.Foo = 'bar';

SELECT last_insert_rowid();
END TRANSACTION;

So, does sqlite_trace fire for each of BEGIN, INSERT INTO, SELECT, END ,
or just once for the whole sql_exec?

I do lots of these kinds of things, and it would be nice if I could
output the sequence to as they are actually executed rather than as a
big chunk.

--Keith

**
- I'm not a professional; I just get paid to do this.

- Things I've learned about multithreaded programming:

123...   PPArrvooottieedcc ttm  ueelvvteeirrtyyhtt
rhheiianndgge  dwi hnpi rctohhg eri aslm omscitanalgt 
 iowcbh,je engceltvo ebwrah lip,co hso srci abonlt ehb
.ee^Nr waicscee snsoetd  'aotb jtehcet -slaomcea lt'il
m^Ne from two or more threads
**



Re: [sqlite] strange rounding problem

2004-10-13 Thread Will Leshner
Will Leshner wrote:
I've tracked my rounding problem down to this line in vxprintf():
I'm sorry to say that is a false alarm. It turns out that we were being fooled by the debugger in Dev Studio. What is the case, however, is that a value is coming out of the database and at some point duing the processing of a query, a very small amount of floating-point error is being introduced. But only on some hardware configurations. The reason I keep talking about this on this list is because it still seems like this just might be a very subtle bug in SQLite. If we ever figure it out I'll report back.


Re: [sqlite] DBD::SQLite2 installation on Debian

2004-10-13 Thread Darren Duncan
At 3:56 PM +0100 10/13/04, Slava Bizyayev wrote:
I have strange results with sqlite-2.8.15. For some unclear for me
reason I can not write to database via the dbish or DBI (DBD::SQLite2).
I guess I'm doing something wrong, but I have no idea what exactly...
[EMAIL PROTECTED]:~$ dbish dbi:SQLite2:/db/test.db
DBI::Shell 11.93 using DBI 1.45
FYI, DBI 1.45 is partially experimental with known problems; DBI 1.43 
is the last known stable one.  Also, you should bring these issues up 
on a Perl list, such as dbi-users, rather than the SQLite list, as 
the issue seems not specific to SQLite itself. -- Darren Duncan


Re: [sqlite] sqlite with Borland C++ 5.02

2004-10-13 Thread nfr
Pigott, Paul wrote:
Is there a pre-compiled binary for that?  Or do you just convert the .DLL to
a .LIB with a utility?
Paul
-Original Message-
From: nfr [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 13, 2004 12:21 PM
To: [EMAIL PROTECTED]
Subject: Re: [sqlite] sqlite with Borland C++ 5.02
Pigott, Paul wrote:
 

Greetings,
I'm new to sqlite.  I'm trying to get it setup to work with the Borland
C++ 5.02 compiler.  I've keyed in the sample program at
http://www.sqlite.org/quickstart.html
  and I keep getting "unresolved
externals" for _sqlite3_open, _sqlite3_exec, _sqlite3_close and
_sqlite3_errmsg.
I've rebuilt the DEF file, using the Borland IMPDEF program, and I'm
including the DEF file in the project.
I've tried a number of different option combinations and nothing seems
to be working.
If anyone has used sqlite with the Borland C++ 5.02 compiler I would
sure appreciate any pointers you can give.  (BTW, that's the regular
compiler, not the Builder product).
TIA,
Paul

   

you probably need to link to the library sqlite.lib ?
Noël
 

There is a lib file, but I'm sure that its compatible with borland. 
Otherwise, you may compile sqlite (static lib or dll) with Borland.
Noël


RE: [sqlite] sqlite with Borland C++ 5.02

2004-10-13 Thread Pigott, Paul
Is there a pre-compiled binary for that?  Or do you just convert the .DLL to
a .LIB with a utility?

Paul

-Original Message-
From: nfr [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 13, 2004 12:21 PM
To: [EMAIL PROTECTED]
Subject: Re: [sqlite] sqlite with Borland C++ 5.02


Pigott, Paul wrote:

>Greetings,
> 
>I'm new to sqlite.  I'm trying to get it setup to work with the Borland
>C++ 5.02 compiler.  I've keyed in the sample program at
>http://www.sqlite.org/quickstart.html
>  and I keep getting "unresolved
>externals" for _sqlite3_open, _sqlite3_exec, _sqlite3_close and
>_sqlite3_errmsg.
> 
>I've rebuilt the DEF file, using the Borland IMPDEF program, and I'm
>including the DEF file in the project.
> 
>I've tried a number of different option combinations and nothing seems
>to be working.
> 
>If anyone has used sqlite with the Borland C++ 5.02 compiler I would
>sure appreciate any pointers you can give.  (BTW, that's the regular
>compiler, not the Builder product).
> 
>TIA,
> 
>Paul
>
>  
>
you probably need to link to the library sqlite.lib ?
Noël


Re: [sqlite] sqlite with Borland C++ 5.02

2004-10-13 Thread nfr
Pigott, Paul wrote:
Greetings,
I'm new to sqlite.  I'm trying to get it setup to work with the Borland
C++ 5.02 compiler.  I've keyed in the sample program at
http://www.sqlite.org/quickstart.html
  and I keep getting "unresolved
externals" for _sqlite3_open, _sqlite3_exec, _sqlite3_close and
_sqlite3_errmsg.
I've rebuilt the DEF file, using the Borland IMPDEF program, and I'm
including the DEF file in the project.
I've tried a number of different option combinations and nothing seems
to be working.
If anyone has used sqlite with the Borland C++ 5.02 compiler I would
sure appreciate any pointers you can give.  (BTW, that's the regular
compiler, not the Builder product).
TIA,
Paul
 

you probably need to link to the library sqlite.lib ?
Noël


Re: [sqlite] LIKE, BETWEEN

2004-10-13 Thread Raymond Irving

This is very strange. Common sense will tell us that a
BETWEEN call on the "a" column should use the index
"t_idx_0". I can't see why SQLite is doing a table
scan.

Is this another one of those code-optimized features
of SQLite to forget intelligent parsing and processing
in order to reduce DLL size?

__
Raymond Irving

--- Mike Ponomarenko <[EMAIL PROTECTED]> wrote:

> In sqlite3 queries using LIKE and BETWEEN do not use
> existing indices.  So for
> a schema like
> CREATE TABLE t (a integer, b char(40));
> CREATE INDEX t_idx_0 ON t(a);
> CREATE INDEX t_idx_1 ON t(b);
> queries like
> "SELECT * FROM t WHERE a BETWEEN 1 AND 20"or
> "SELECT * FROM t WHERE b LIKE 'abc%'"
> end up doing a table scan.
> 
> Just curious if there are any changes in the works
> to make queries such as above
> use available indices?
> For BETWEEN:  Integer 2, MoveGE, Next until > 20,
> etc.
> For LIKE: if one parameter is a string with a
> constant prefix, String8 'abc',
> MoveGE, Next until Function(LIKE) fails, etc.
> 
> I realize that queries can be rewritten to make them
> more efficient (SELECT *
> FROM t WHERE a >= 1 AND a <= 20), etc., but it's not
> always feasible.  I'd
> appreciate any thoughts on the matter.  Thanks!
> 



[sqlite] LIKE, BETWEEN

2004-10-13 Thread Mike Ponomarenko
In sqlite3 queries using LIKE and BETWEEN do not use existing indices.  So for
a schema like
CREATE TABLE t (a integer, b char(40));
CREATE INDEX t_idx_0 ON t(a);
CREATE INDEX t_idx_1 ON t(b);
queries like
"SELECT * FROM t WHERE a BETWEEN 1 AND 20"or
"SELECT * FROM t WHERE b LIKE 'abc%'"
end up doing a table scan.

Just curious if there are any changes in the works to make queries such as above
use available indices?
For BETWEEN:  Integer 2, MoveGE, Next until > 20, etc.
For LIKE: if one parameter is a string with a constant prefix, String8 'abc',
MoveGE, Next until Function(LIKE) fails, etc.

I realize that queries can be rewritten to make them more efficient (SELECT *
FROM t WHERE a >= 1 AND a <= 20), etc., but it's not always feasible.  I'd
appreciate any thoughts on the matter.  Thanks!