[sqlite] open an open sqlite database !!!

2007-03-26 Thread mniknezhad
i use dlls to connect to sqlite db(in asp.net). i have a problem: when the database file (sample.db) is opened with a windows application (and in use - not closed), i can not open that database with a web application. in other words : how can i open an opened database with a web application?

Re: [sqlite] Store and retreive 0D0A (CRLF) in string field

2007-03-26 Thread Martin Jenkins
fangles wrote: SQLite doesn't truncate anything. Whatever you put in you get out. If you see a truncation, it is either done by whatever wrapper you use on top of SQLite, or simply an artifact of the way you inspect the data (e.g. you look at the string in a debugger, and the debugger just

RE: [sqlite] open an open sqlite database !!!

2007-03-26 Thread Samuel R. Neff
If you're using ASP.NET I'd suggest using the ADO.NET wrapper available here: http://sqlite.phxsoftware.com/ It's an excellent implementation of ADO.NET for SQLite and would be far less trouble than using sqlite directly from .NET code. HTH, Sam ---

Re: [sqlite] Store and retreive 0D0A (CRLF) in string field

2007-03-26 Thread P Kishor
On 3/25/07, fangles <[EMAIL PROTECTED]> wrote: SQLite doesn't truncate anything. Whatever you put in you get out. If you see a truncation, it is either done by whatever wrapper you use on top of SQLite, or simply an artifact of the way you inspect the data (e.g. you look at the string in a

[sqlite] Error reporting problem

2007-03-26 Thread Vivien Malerba
Hi! I've got an error reporting problem when trying to insert a row which breaks a UNIQUE constraint in a table in a C program, I get the following error with sqlite3_errmsg(): "SQL logic error or missing database" If I fire the sqlite3 program and run the same SQL query, I get the following

Re: [sqlite] How does SQLite store data?

2007-03-26 Thread Dennis Cote
John Stanton wrote: It does not have fixed length columns except for the ones which hold integer and real numbers and boolean values. Actually, integers are stored in a variable length format as well. It takes less space to store smaller integer values than it does to store large values.

Re: [sqlite] How does SQLite store data?

2007-03-26 Thread P Kishor
On 3/26/07, Dennis Cote <[EMAIL PROTECTED]> wrote: John Stanton wrote: > It does not have fixed length columns except for the ones which hold > integer and real numbers and boolean values. > Actually, integers are stored in a variable length format as well. It takes less space to store smaller

Re: [sqlite] Error reporting problem

2007-03-26 Thread Martin Jenkins
Vivien Malerba wrote: Hi! I've got an error reporting problem when trying to insert a row which breaks a UNIQUE constraint in a table in a C program, I get the following error with sqlite3_errmsg(): "SQL logic error or missing database" If I fire the sqlite3 program and run the same SQL query,

[sqlite] PRAGMA locking_mode = EXCLUSIVE

2007-03-26 Thread Joe Wilson
What operations/work patterns will benefit most from PRAGMA locking_mode = EXCLUSIVE? Can you roughly quantify the speedups in such cases? TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV.

Re: [sqlite] Questions on views

2007-03-26 Thread Dennis Cote
Dennis Volodomanov wrote: Is doing a SELECT EXISTS (...) faster than a SELECT COUNT (... LIMIT 1) or would it be the same (I would expect them to be the same, but that's only my guess)? I would expect them to be very nearly the same. Any difference would only be apparent if you repeat them

Re: [sqlite] How does SQLite store data?

2007-03-26 Thread Dennis Cote
P Kishor wrote: interesting. As far as _I_ know, the first implementation of varint! No, this idea has been around for a long time. It was used for ISDN addressing for example. I'm sure it is probably in Knuth somewhere. It is still a very good idea though. is it reasonable to assume

Re: [sqlite] sqlite and bcc32

2007-03-26 Thread Nuno Lucas
On 3/25/07, stripe <[EMAIL PROTECTED]> wrote: using sqlite version 3.3.13. ... extern "C" { #include } ... doesn't help :( Well, that seems like a compiler problem, not a SQLite related one. For some reason the compiler is treating the SQLite header file as C++ code, when it should be

Re: [sqlite] Store and retreive 0D0A (CRLF) in string field

2007-03-26 Thread John Stanton
P Kishor wrote: On 3/25/07, fangles <[EMAIL PROTECTED]> wrote: SQLite doesn't truncate anything. Whatever you put in you get out. If you see a truncation, it is either done by whatever wrapper you use on top of SQLite, or simply an artifact of the way you inspect the data (e.g. you look at

Re: [sqlite] Error reporting problem

2007-03-26 Thread Vivien Malerba
On 3/26/07, Martin Jenkins <[EMAIL PROTECTED]> wrote: Vivien Malerba wrote: > Hi! > > I've got an error reporting problem when trying to insert a row which > breaks a UNIQUE constraint in a table in a C program, I get the > following error with sqlite3_errmsg(): > "SQL logic error or missing

Re: [sqlite] Any way to do this faster?

2007-03-26 Thread Dennis Cote
RB Smissaert wrote: Simplified I have the following situation: 2 tables, tableA and tableB both with an integer field, called ID, holding unique integer numbers in tableA and non-unique integer numbers in tableB. Both tables have an index on this field and for tableA this is an INTEGER PRIMARY

[sqlite] One big database or various smaller ones?

2007-03-26 Thread Alberto Simões
Hi I have a database with three tables (bigrams, trigrams and tetragrams). Basically, they are: TABLE( A, B, Count) IDX(A,B) IDX(B) TABLE( A, B, C, Count) IDX(A,B,C) IDX(B) IDX(C) TABLE( A, B, C, D, Count) IDX (A,B,C,D) IDX(B) IDX(C) IDX(D) Now, this database is quickly getting

Re: [sqlite] Any way to do this faster?

2007-03-26 Thread bartsmissaert
Thanks Dennis, will try that when I get chance (at work now) and will report back about the difference it made. RBS > RB Smissaert wrote: >> Simplified I have the following situation: >> >> 2 tables, tableA and tableB both with an integer field, called ID, >> holding >> unique integer numbers in

RE: [sqlite] Any way to do this faster?

2007-03-26 Thread Arora, Ajay
I'm not sure if SQLite support this syntax, but try following statement, Delete from tableB b Where not exist ( select 'x' from tableA a where a.id = b.id ) -Original Message- From: Dennis Cote [mailto:[EMAIL PROTECTED] Sent: 26 March 2007 16:12

Re: [sqlite] Questions on views

2007-03-26 Thread Joe Wilson
--- Dennis Cote <[EMAIL PROTECTED]> wrote: > Dennis Volodomanov wrote: > > Is doing a SELECT EXISTS (...) faster than a SELECT COUNT (... LIMIT 1) > > or would it be the same (I would expect them to be the same, but that's > > only my guess)? > > > I would expect them to be very nearly the

Re: [sqlite] One big database or various smaller ones?

2007-03-26 Thread Joe Wilson
--- Alberto Simões <[EMAIL PROTECTED]> wrote: > I have a database with three tables (bigrams, trigrams and > tetragrams). Basically, they are: >TABLE( A, B, Count) IDX(A,B) IDX(B) >TABLE( A, B, C, Count) IDX(A,B,C) IDX(B) IDX(C) >TABLE( A, B, C, D, Count) IDX (A,B,C,D) IDX(B)

RE: [sqlite] Any way to do this faster?

2007-03-26 Thread bartsmissaert
Thanks, will try that and report back. RBS > I'm not sure if SQLite support this syntax, but try following statement, > > Delete from tableB b > Where not exist ( select 'x' > from tableA a > where a.id = b.id ) > > -Original Message- > From: Dennis

Re: [sqlite] One big database or various smaller ones?

2007-03-26 Thread Eduardo Morras
At 17:22 26/03/2007, you wrote: >Hi > >I have a database with three tables (bigrams, trigrams and >tetragrams). Basically, they are: > TABLE( A, B, Count) IDX(A,B) IDX(B) > TABLE( A, B, C, Count) IDX(A,B,C) IDX(B) IDX(C) > TABLE( A, B, C, D, Count) IDX (A,B,C,D) IDX(B) IDX(C) IDX(D) >

Re: [sqlite] Any way to do this faster?

2007-03-26 Thread Brian Johnson
Another way of saying what Dennis said (I had to read his reply twice before I understood it): your query: for every record in TableB it returns ALL the records in tableA and then looks through them Dennis's query: for every record in TableB it checks tableA directly for the existence of that ID

Re: [sqlite] Any way to do this faster?

2007-03-26 Thread bartsmissaert
> also, as Dennis said .. unless you have > some other reason for that index on > Table B, get rid of it. I will need an index on that field later, but I could drop it prior to the delete and create a new one after. Thinking about it I am not sure in any case of the value of an index after

Re: [sqlite] One big database or various smaller ones?

2007-03-26 Thread Alberto Simões
On 3/26/07, Eduardo Morras <[EMAIL PROTECTED]> wrote: At 17:22 26/03/2007, you wrote: >Hi > >I have a database with three tables (bigrams, trigrams and >tetragrams). Basically, they are: > TABLE( A, B, Count) IDX(A,B) IDX(B) > TABLE( A, B, C, Count) IDX(A,B,C) IDX(B) IDX(C) > TABLE( A,

[sqlite] round and storage class

2007-03-26 Thread Iulian Musat
Hello everybody ! First of all I have to say that I'm a fairly new user of SQLite, so be kind :-) The problem is with the "round" function: the result have a decimal point even if the second argument is zero (the default): sqlite> select round(1.234); 1.0 sqlite> select round(1.234,0); 1.0

Re: [sqlite] How does SQLite store data?

2007-03-26 Thread rhurst2
Dennis Cote <[EMAIL PROTECTED]> wrote: > John Stanton wrote: > > It does not have fixed length columns except for the ones which hold > > integer and real numbers and boolean values. > > > Actually, integers are stored in a variable length format as well. It > takes less space to store

Re: [sqlite] Any way to do this faster?

2007-03-26 Thread Dennis Cote
Brian Johnson wrote: Another way of saying what Dennis said (I had to read his reply twice before I understood it): Point taken. :-) I often think I'm being too wordy in my replies, but when I try to make my statements more succinct they seem to be confusing. I guess I just don't have

Re: [sqlite] How does SQLite store data?

2007-03-26 Thread drh
<[EMAIL PROTECTED]> wrote: > > I am not aware of a BOOLEAN type. > The types defined in the website are: NULL, INTEGER, REAL, TEXT and BLOB. > Is BOOLEAN a hidden type? > BOOLEAN is not a different type. What Dennis meant was that integer values 0 and 1 are stored more efficiently in the new

Re: [sqlite] Any way to do this faster?

2007-03-26 Thread Dennis Cote
[EMAIL PROTECTED] wrote: I will need an index on that field later, but I could drop it prior to the delete and create a new one after. Don't do that. If you need the index, then leave it as is. Thinking about it I am not sure in any case of the value of an index after deletes on a table.

Re: [sqlite] round and storage class

2007-03-26 Thread Dennis Cote
Iulian Musat wrote: Hello everybody ! First of all I have to say that I'm a fairly new user of SQLite, so be kind :-) The problem is with the "round" function: the result have a decimal point even if the second argument is zero (the default): sqlite> select round(1.234); 1.0 sqlite> select

Re: [sqlite] One big database or various smaller ones?

2007-03-26 Thread Joe Wilson
--- Alberto Simões <[EMAIL PROTECTED]> wrote: > The tables are related but they are already being created in parallel > (three tables). I was joining them just because it was easier to move. > But given the new, erm, big size, I think I'll maintain them split. > > Joe Wilson idea of attaching the

Re: [sqlite] Index creation

2007-03-26 Thread Joe Wilson
--- Joe Wilson <[EMAIL PROTECTED]> wrote: > > improved dramatically. So I attempted the creation of the index off hours on > > the production system, and after 4 hours no index. I can't detect any > > activity at all. The journal file and the .db file just sit at the same size > > for 4 hours.

RE: [sqlite] Any way to do this faster?

2007-03-26 Thread RB Smissaert
Had a good look at this now and doing: delete from tableB where not exists (select id from tableA where tableA.id = tableB.id) Is indeed quite a bit faster than doing: delete from tableB where id not in (select tableA.id from tableA) In my case about 3 times as fast. Looking at the query plan

Re: [sqlite] One big database or various smaller ones?

2007-03-26 Thread Alberto Simões
On 3/26/07, Joe Wilson <[EMAIL PROTECTED]> wrote: --- Alberto Simões <[EMAIL PROTECTED]> wrote: > The tables are related but they are already being created in parallel > (three tables). I was joining them just because it was easier to move. > But given the new, erm, big size, I think I'll

[sqlite] Issue with trailing blanks

2007-03-26 Thread Joel Cochran
Howdy all, I am new to SQLite, so I hope this isn't too much of a newbie question, but I searched the Internet, the archives, and the help docs and could not find any mention of this. I am populating an SQLite database from a legacy IBM AS/400 database. The 400 stores all character fields with

Re: [sqlite] Issue with trailing blanks

2007-03-26 Thread P Kishor
On 3/26/07, Joel Cochran <[EMAIL PROTECTED]> wrote: Howdy all, I am new to SQLite, so I hope this isn't too much of a newbie question, but I searched the Internet, the archives, and the help docs and could not find any mention of this. I am populating an SQLite database from a legacy IBM

Re: [sqlite] Issue with trailing blanks

2007-03-26 Thread Joel Cochran
Hi Puneet, I probably shouldn't have said that they 'ignore' the blanks, but they are capable of treating them as white space for text matching purposes. I can't speak for Oracle, but I'm pretty sure MySQL and SqlServer (and I know for sure DB2) all allow you to search on 'A' and they will

Re: [sqlite] Issue with trailing blanks

2007-03-26 Thread Teg
Hello Joel, Why not strip the spaces before insertion? C Monday, March 26, 2007, 4:36:02 PM, you wrote: JC> Howdy all, JC> I am new to SQLite, so I hope this isn't too much of a newbie question, but JC> I searched the Internet, the archives, and the help docs and could not find JC> any

RE: [sqlite] Issue with trailing blanks

2007-03-26 Thread James Dennett
> From: Joel Cochran [mailto:[EMAIL PROTECTED] > > Hi Puneet, > > I probably shouldn't have said that they 'ignore' the blanks, but they are > capable of treating them as white space for text matching purposes. I > can't > speak for Oracle, but I'm pretty sure MySQL and SqlServer (and I know

Re: [sqlite] Issue with trailing blanks

2007-03-26 Thread Dennis Cote
Joel Cochran wrote: I do think more and more that the solution for me is to trim the trailing blanks before INSERTing them into SQLite. That will be your best solution, and it will make your database files smaller too since sqlite won't be storing the trailing spaces. Dennis Cote

RE: [sqlite] Questions on views

2007-03-26 Thread Dennis Volodomanov
Yes, after timing both I found that SELECT EXISTS is actually a tiny bit faster, which does matter when multiplied by thousands of executions in a row. Unfortunately, I still cannot get it as fast as I want - it takes approximately 1500-2000 ms per approximately 2000-3000 executions. Is there any

Re: [sqlite] Error reporting problem

2007-03-26 Thread Martin Jenkins
Vivien Malerba wrote: Here is a sample test case, just uncompress, run "make" and "./test". Here is what I get using SQLite 3.3.13 (On Linux): SQL error (step): SQL logic error or missing database SQL error (step): column name is not unique It shows that calling sqlite3_reset() seems to be

RE: [sqlite] Questions on views

2007-03-26 Thread Joe Wilson
--- Dennis Volodomanov <[EMAIL PROTECTED]> wrote: > Yes, after timing both I found that SELECT EXISTS is actually a tiny bit > faster, which does matter when multiplied by thousands of executions in > a row. > > Unfortunately, I still cannot get it as fast as I want - it takes > approximately

RE: [sqlite] Questions on views

2007-03-26 Thread Dennis Volodomanov
Thanks for the reply! I'm not really trying to blame SQLite here, as I know there're limits on just how fast it can prepare a statement, execute it and give me the results - and it's fast, I'm just looking for ways to make it faster. The reason that such a huge amount of statements needs to be

RE: [sqlite] Questions on views

2007-03-26 Thread Dennis Volodomanov
Oops - that last sentence I wrote actually doesn't make sense :) I know what prepared statements are as I'm using them (doh!). I might have a problem that I need to add more WHERE conditions to those "basic" statements, which wouldn't work probably with storing them, as I can't possible know all

Re: [sqlite] PRAGMA locking_mode = EXCLUSIVE

2007-03-26 Thread drh
elease its EXCLUSIVE lock after its does its first write until you either close the connection or you do "PRAGMA locking_mode=NORMAL". There are various optimizations that can occur when this is the case. There is a plot of runtime of CVSHEAD versus version 3.3.13 at http://www.s

Re: [sqlite] PRAGMA locking_mode = EXCLUSIVE

2007-03-26 Thread Joe Wilson
ons > that can occur when this is the case. > > There is a plot of runtime of CVSHEAD versus version 3.3.13 > at > >http://www.sqlite.org/relspeed-20070326-ephemeral.gif > > (As the name implies, this GIF will ephemeral. Do not expect it > to be there for more than a few

[sqlite] Running multiple DDL statements in a batch (via JDBC)

2007-03-26 Thread Steven E. Harris
I'm using the "pure" SQLite JDBC driver¹ and trying to bootstrap my database schema by running a batch of DDL statements. I read in the entire DDL script from a file, collect it into a string, and feed that string into either java.sql.Statement.executeUpdate() or java.sql.Statement.executeBatch().

RE: [sqlite] Questions on views

2007-03-26 Thread Joe Wilson
Assuming you're running on multi-core machines, spread the work over a few threads/connections. --- Dennis Volodomanov <[EMAIL PROTECTED]> wrote: > Oops - that last sentence I wrote actually doesn't make sense :) I know > what prepared statements are as I'm using them (doh!). I might have a >

RE: [sqlite] Questions on views

2007-03-26 Thread Dennis Volodomanov
Yes, threading is one option I'm testing and timing as well. > -Original Message- > From: Joe Wilson [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 27, 2007 12:29 PM > To: sqlite-users@sqlite.org > Subject: RE: [sqlite] Questions on views > > Assuming you're running on multi-core

Re: [sqlite] Running multiple DDL statements in a batch (via JDBC)

2007-03-26 Thread drh
"Steven E. Harris" <[EMAIL PROTECTED]> wrote: > > Does SQLite normally execute more than one statement provided in a SQL > string? The sqlite3_prepare()/sqlite3_step() API only executes a single statement. The sqlite3_prepare() routine returns a pointer to the next statement if you give it a

[sqlite] Re: Running multiple DDL statements in a batch (via JDBC)

2007-03-26 Thread Steven E. Harris
[EMAIL PROTECTED] writes: > The sqlite3_prepare()/sqlite3_step() API only executes a single > statement. The sqlite3_prepare() routine returns a pointer to > the next statement if you give it a list of statements. I see. It looks like the JDBC driver punts on using the pzTail parameter¹: ,

Re: [sqlite] Running multiple DDL statements in a batch (via JDBC)

2007-03-26 Thread Joe Wilson
AFAIK The behavior you're looking for is not well defined by the JDBC API: http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#addBatch(java.lang.String) Perhaps some JDBC drivers implement the behavior you expect,

[sqlite] RE: open an open sqlite database !!!

2007-03-26 Thread mniknezhad
i use framework v1.1 (2003) not framework v2 Samuel R. Neff wrote: > > > If you're using ASP.NET I'd suggest using the ADO.NET wrapper available > here: http://sqlite.phxsoftware.com/ > > It's an excellent implementation of ADO.NET for SQLite and would be far > less > trouble than using

Re: [sqlite] Error reporting problem

2007-03-26 Thread Dan Kennedy
On Mon, 2007-03-26 at 17:08 +0200, Vivien Malerba wrote: > On 3/26/07, Martin Jenkins <[EMAIL PROTECTED]> wrote: > > Vivien Malerba wrote: > > > Hi! > > > > > > I've got an error reporting problem when trying to insert a row which > > > breaks a UNIQUE constraint in a table in a C program, I get