[sqlite] sqlite3 -has_codec in test suite

2010-09-06 Thread Martin Jenkins
Given:

> ./testfixture
% sqlite3 -has_codec
Error: wrong # args: should be "sqlite3 HANDLE FILENAME ?-vfs VFSNAME?
?-readonly BOOLEAN? ?-create BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex
BOOLEAN?"

% sqlite3 -has-codec
0

and:

src/tclsqlite.c:if( strcmp(zArg,"-has-codec")==0 ){

are the instances of

"if {[catch {sqlite3 -has_codec} r]...}"

in alter2.test, alter3.test, alter4.test and ioerr.test correct or
should they be replaced with

"if {[catch {sqlite3 -has-codec} r] || $r} {"?

Martin
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Docs patch

2010-08-05 Thread Martin Jenkins
Hi,

I sent a patch which fixes a fairly large number of typos in
the 3.7.0 HTML documentation to the list on the 25th July.

It was sent from an unsubscribed address and apart from a
message saying it would need to be moderated, it appears
to have vanished without trace.

Is this the sort  of patch that's wanted or is the moderation
period likely to take a week or more?

The patch as a context diff is about 88kb so I'm reluctant to
post it directly to the list.

Martin
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Patch to fix typos in SQLite 3.7.0 HTML documentation.

2010-07-27 Thread Martin Jenkins
Hi,

I've attached a patch which fixes a fairly large number of typos in
the current HTML documentation,
where current means http://www.sqlite.org/sqlite_docs_3_7_0.zip as of
14:40 today.

> mar...@ubuntu:~/Downloads$ ls -l sqlite_docs_3_7_0.zip
> -rw-r--r-- 1 martin martin 2919734 2010-07-25 14:40 sqlite_docs_3_7_0.zip

I haven't changed US spellings to UK spellings (eg "canceled" would be
"cancelled" here) but I
have tried to change things in the other direction where UK and US
versions of a word existed.

I haven't tried to fix up hyphenation ("reenable", "reengineer" etc)
as I suspect those agree with
US preferences even if they don't accord with UK preferences.

I tested the patch ("patch < sqlite-3.7.0-docs.patch") and it does
successfully apply the changes.

The process I used was:

1. Download and unzip sqlite_docs_3_7_0.zip
2. Check the files into a Mercurial repository
3. Run "html2text *.html | enchant -l | sort -u > errs1.txt"
4. Go through the files and correct the typos
5. Check the files into a Mercurial repository
6. Produce a patch with Mercurial
7. Test the patch
8. Submit the patch

I hope you find this patch useful and, assuming that you do, I hereby
state that:

"The author or authors of this code dedicate any and all copyright
interest in this code to the public domain.
We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors.
We intend this dedication to be an overt act of relinquishment in
perpetuity of all present and future rights to
this code under copyright law. "

Regards,
Martin Jenkins
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL Quick Review/Reference

2008-04-15 Thread Martin Jenkins
metro wrote:
> is this what everybody is looking for??
> http://booksforpeople.blogspot.com/2008/03/definitive-guide-to-sqlite-free-book.html
> there are other sources  for free ebooks
>
> Laurie
>   
It did the rounds on alt.binaries.e-book.technical last year. The 
buyer's email address had been removed from
the page footers but otherwise it looked like my legit copy, ie it 
wasn't a scan.

Martin
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL Quick Review/Reference

2008-04-15 Thread Martin Jenkins
Mike Owens wrote:
>> Mike Owens wrote:
>>  > I've been lobbying Apress to release the book in electronic form for
>>  > free. 
>>  That seems a bit extreme 
> I wasn't referring to releasing the book as an exclusive solution to
> the index problem, but rather for the community and SQLite in general.
>   
That's fair enough - sorry for the misunderstanding on my part.
> Fixing the index issue would just be a nice dividend. 
Indeed. I've not had any issues with it but I tend to remember roughly 
where things are in books.
I read quickly so I don't mind reading a few extra pages - useful as a 
refresher.
> making it a good book 
I think it's a fine book. I know one or two "occasional" posters on this 
list made some negative
comments (index issues apart) but I think they made a mistake and bought 
the wrong book... ;)

Martin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL Quick Review/Reference

2008-04-14 Thread Martin Jenkins
Mike Owens wrote:
> I've been lobbying Apress to release the book in electronic form for
> free. It's currently under consideration, but I've not heard anything
> back yet.
>   
That seems a bit extreme - how about a user generated/funded index on 
the web somewhere?
Download and print a PDF, stick it in the back of the book and...

Martin
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Capturing output from SQLlite with variables in a BASH script

2007-06-22 Thread Martin Jenkins

litenoob wrote:

Hi, I'm wondering how to write a BASH script that will capture my SQLite
output.

I can do it for a single line with something like this:

somevar=`sqlite3 dbfilename "SELECT name FROM tablename WHERE name='smith'
LIMIT 1;"`

However, if I want to do anything with multiple lines, I haven't figured out
a good way.  So far, I'm using a workaround by outputting to a file, then
reading it after I exit the SQLite commandline, but that slows down the
script significantly.

e.g.

sqlite3 dbfilename << EOF

.output temp1
select id from tablename where name = "bush";
.output temp2
select id from tablename where name = "osama";

.quit
EOF

read id1 < temp1
read id2 < temp2

What's the better way to do this without actually writing to a file?

Thanks!


How about re-writing your query to generate shell script to set shell 
(or environment?) variables and using those variables in your script? 
Could you make the SQLite output look like shell script and execute or 
source that?


Or, use Tcl? ;)

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Cache invalidation after insert statements.

2007-06-20 Thread Martin Jenkins

Joe Wilson wrote:

A non-volatile RAM drive is the way to go if you got the bucks.


16 Processor machine
~40Gb ram
EMC storage

suggests he does. ;)

I worked on a project where the end client had Sun kit of this spec, and 
they claimed the systems cost 7 figures GBP back in 2005.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Custom Aggregation Not Working

2007-06-19 Thread Martin Jenkins

wcmadness wrote:
Hey, Folks: 


I'm writing a financial application and MUST have exact math decimals (no
floats). So, I'm using Python's decimal module. 


My database is Sqlite (and my language is Python with Pysqlite); Sqlite
doesn't offer a non-floating point decimal type. But, it does have adapters
and converters to store data as a native Sqlite type (string / text) in the
database and bring it out of the database and into memory as something else
(Python Decimal, in my case). That works great, but it does NOT seem to
apply to aggregation operations. I need it to. 


Hi,

Firstly, you might get better answers on the pysqlite mailing list at 
http://lists.initd.org/mailman/listinfo/pysqlite than here.


I've not used custom types/converters etc and couldn't see anything 
wrong with your code at first glance so here are a couple of "off the 
top of my head" comments.


In your tests you insert values as hard coded strings rather than bound 
variables. From looking at the code it wasn't obvious (to me) that the 
converters/adapters for the decimal classes will be called. I think 
you've assumed pysqlite will examine the column declaration and call the 
appropriate converter/adapter regardless, but the test4.db case doesn't 
bear this out.


I put prints into the converter and it was NOT called with an insert like:

  for x in range(10):
cur.execute("insert into test(somenumber) values (0.1)")

but it WAS called when I changed the insert to:

  d=decimal.Decimal("0.1")
  for x in range(10):
cur.execute("insert into test(somenumber) values (?)", (d,))

Going in the other direction, section 4.3 of the pysqlite docs at 
http://initd.org/pub/software/pysqlite/doc/usage-guide.html warns:


"!!! Note that converter functions always get called with a string, no 
matter under which data type you sent the value to SQLite !!!"


You've defined string <-> decimal conversions, but when you execute:

cur.execute("select sum(somenumber) as total from test;")

how does your adapter get called?

sum() won't return your custom type and there's no column info that I 
can see that would cause your adapter to be called. The column names 
example implies you could force the result of sum() be adapted but sum() 
won't perform addition according to the semantics of your custom type.


HTH

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] PRAGMA cache_size = 0

2007-06-15 Thread Martin Jenkins

B V, Phanisekhar wrote:

What exactly happens when I change the cache_size (both increase and
decrease size)?



A variable is set.


It seems this term is a misnomer. What are we achieving by setting this
variable?


[...]


Will there be any memory that will be freed up when I reduce the size
of result cache?



No.


So whats there in this cache?


I'd have thought setting the cache size was (meant to be) a one-off 
operation? Changing the cache size on the fly and expecting the cache to 
be valid must be an unusual case (well, it is to me and I've not seen 
anyone else asking about it) so I reckon you'd be better off looking at 
the source code, doing a few tests of your own and reporting back.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Override LIKE

2007-05-16 Thread Martin Jenkins

Jonas Sandman wrote:

> I am using LIKE to make a simple query for filename '%path%' and it
> works well as long as I am only using ANSI characters, LIKE thinks
> 'a' and 'A' are the same. When coming up on Greek characters (i.e.)
> it doesn't work that well anymore. Suddenly LIKE is case-sensitive
> (since LIKE use some binary comparison perhaps? I duno)

Does LIKE use collation sequences? If so,

http://www.sqlite.org/capi3ref.html#sqlite3_create_collation

might help.

Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Re: Re: Order of result of a query?

2007-05-16 Thread Martin Jenkins

B V, Phanisekhar wrote:

Kennedy,
   You are using Join that's going to take time. I need the most
efficient query.


Dan's one of the SQLite developers, so presumably has a rough idea of 
what his suggested query will be doing... ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Multiple connections to the same database and CREATE TABLE command

2007-05-11 Thread Martin Jenkins

Vivien Malerba wrote:

Hi!

In a single process, I open two connections (C1 and C2) to the same
database (this is actually a corner case which could happen) and the
following sequence of operations fail:
1- on C1 execute "CREATE table actor (...)" => Ok
2- on C1 execute "SELECT * FROM actor" => Ok
3- on C2 execute "SELECT * FROM actor" => error because table "actor"
does not exist.

Is there a way to make this sequence of operations work


What SQLite version/API are you using?

ISTR this was fixed some time ago - you need to use sqlite3_prepare_v2() 
instead of sqlite3_prepare().


AIUI, pre the v2 API, connections cache a copy of the schema and aren't 
aware of changes made by other connections, so your case would result in 
a schema changed error. The caller would detect this and re-prepare and 
re-execute the statement. Since this was a common error case the _v2 API 
was created. It stores a copy of the statement's SQL and automatically 
re-prepares it if a schema change is encountered.


I don't know offhand when this was added, but I assume it was ages ago 
because it works with Python's wrapper and that uses SQLite v3.3.4.


>>> import sqlite3
>>> c1=sqlite3.Connection("c:\\fred")
>>> c2=sqlite3.Connection("c:\\fred")
>>> c1.execute("create table t(a,b,c)")

>>> c1.execute("select * from t")

>>> c1.execute("select * from t").fetchall()
[]
>>> c2.execute("select * from t").fetchall()
[]
>>> sqlite3.sqlite_version
'3.3.4'
>>>

Martin



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] May I ask why the source distribution mechanism was changed starting with 3.3.14?

2007-04-30 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

Martin Jenkins <[EMAIL PROTECTED]> wrote:

I agree, it is slightly odd for neither of them to reply.


Why is it odd?


Because you normally reply to these things, if only to say something lie 
"the pre-processed source for Windows is provided as a courtesy". ;)



We have observed the request. What more needs to be said?


Well, it appears the OP wanted something more to be said. I was just 
pointing out that you might be off-site.


Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] May I ask why the source distribution mechanism was changed starting with 3.3.14?

2007-04-30 Thread Martin Jenkins

Bennett, Patrick wrote:


I wasn't sure who maintained the binary distribution and based on the
recent list activity, I assumed someone who was responsible would've
already replied.


As fas as I know, the dev team is Dr Hipp and Dan Kennedy (apologies if 
there's someone else and I missed you) and I agree, it is slightly odd 
for neither of them to reply.


In the interim, could you find an old PC, install Linux on it and build 
the preprocessed sources locally? Another option might be to install 
something like Cygwin on one of your Windows boxes.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] May I ask why the source distribution mechanism was changed starting with 3.3.14?

2007-04-30 Thread Martin Jenkins

Bennett, Patrick wrote:

No comment at all?  That's three users asking for this now.  :(


Dr Hipp usually responds pretty quickly, but sometimes he's away on 
business. You know, supporting the paying customers... ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Recommended wrapper for Python?

2007-04-23 Thread Martin Jenkins

Gilles Ganault wrote:

At 14:40 23/04/2007 +0200, Stef Mientki wrote:
I've no experience whatsover, but if I see the list, the top one is 
the best choice, because it'll be integrated in the standard Python.


Thanks. I didn't know SQLite was part of Python 2.5.


pysqlite implements Python's DBAPI and was integrated into Python. There 
is another wrapper, APSW, which is thinner and closer to SQLite's C API. 
Choose whichever you feel most comfortable with.


If you choose pysqlite be aware that it will start transactions behind 
your back and can produce the wrong error message if you start your own 
transactions.


APSW works with Python 2.5, is usually a bit faster than pysqlite and is 
more frequently updated - it's not tied to the DBAPI.


Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Optimize a query

2007-04-17 Thread Martin Jenkins

Marco Bambini wrote:

This query on a small database sometimes takes more than 40 seconds:
select _rowid, public_id, vote_count, status, summary, component, 
date(date_modified), quickfix from reports where public = 1 AND _rowid 
IN (select distinct r._rowid from reports r, segments s where 
s.report_id = r._rowid AND r.public = 1 AND s.public = 1 AND (r.summary 
LIKE '%server%' OR s.content LIKE '%server%')) order by vote_count DESC


I'm no expert, but won't this bit

> LIKE '%server%' OR s.content LIKE '%server%')) order by vote_count

force the query to perform a full table scan regardless of the indexes?

What happens to the query speed if you (temporarily) change the LIKE 
clauses to look for a specific record?


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Looking for sqlite3_fds.h and fds.c

2007-04-13 Thread Martin Jenkins

Huian Li wrote:

I have a package which uses functions like
sqlite3_get_database_file_fd() and
sqlite3_get_journal_file_fd(). Supposedly
sqlite3_fds.h has these two functions and fds.c
defines them, but I searched both sqlite-3.3.4 and
sqlite-3.3.15, and could not find anything. Does
anyone know where I can find
sqlite3_fds.h and fds.c? Thanks.


Google can't find them so I guess they're locally generated and you're 
asking the wrong people.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Data structure

2007-04-11 Thread Martin Jenkins

Lloyd wrote:

hi Puneet and Martin,
On Wed, 2007-04-11 at 14:27 +0100, Martin Jenkins wrote:

File system cache and plenty of RAM?



It is meant to run on an end user system (eg. Pentium 4 1GB RAM). If you
mean Swap space as file system cache, it is also limited, may be 2GB.


I was just wondering what the odds were of doing a better job than the 
filing system pros, how much time/code that would take on your part and 
how much that time would cost versus speccing a bigger/faster machine.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Data structure

2007-04-11 Thread Martin Jenkins

Lloyd wrote:

Hi,
I don't know whether this is an irrelevant question in SQLite list, but
I don't see a better place to ask.

Which data structure is best to store and retrieve data very fastly?
There is a 95% chance that the searched data to be present in the data
structure. There will be 1000s of nodes in the data structure and it
will be searched millions of times. The data is not in any ordered form.


File system cache and plenty of RAM?

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Journal files not deleted.

2007-04-10 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:


www.wipro.com


Would this be Wipro, the outsourcing company?

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQL and SQLite pronounciation?

2007-04-05 Thread Martin Jenkins

Dennis Cote wrote:

P Kishor wrote:
Anyway a little digging on wikipedia found this:

/SQL/ is commonly spoken either as the names of the letters /ess-cue-el/ 


I pronounce XQP as ex queue pee so I reckon SQL should be ess queue ell, 
even if it was around twenty years before I was. Anyone who disagrees 
can send me a WAV of how they say "XQP" for my consideration. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQL and SQLite pronounciation?

2007-04-05 Thread Martin Jenkins

P Kishor wrote:


In any case, unless DRH establishes a semi-official policy, let the
pronounciation be in public domain as well... to each her own.


Well there is that Google video. You could look at that to get Dr Hipp's 
 definitive pronunciation, but ISTR even he wasn't 100% consistent. ;)


Martin



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] multiple request handling

2007-03-30 Thread Martin Jenkins

Pavan wrote:

Does SQLite handle multiple request handling ?


Yes.

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



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

2007-03-29 Thread Martin Jenkins

fangles wrote:

When I have text pasted into an sqlite string field, it is stored okay but
when I retrieve a string, it is truncated at the first CR (0D).


Hi fangles,

Did you get this sorted?

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Using the Sqlite Btree Backend directly

2007-03-29 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

Martin Jenkins <[EMAIL PROTECTED]> wrote:


Very true.  Furthermore, the B-Tree interface layer is not a part 
of the published API and as such it is subject to change without 
notice and between point releases.


I nearly said that the B-Tree interface was unpublished but didn't 
because I didn't know for sure. Even assuming that it wasn't published I 
didn't know how (un)stable it was. As reasons against using it go



the interface to the B-Tree layer has changed twice in the past 24 hours.


is as good as you'll get. ;)

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] RE: Maintaining Master-Child relationships

2007-03-29 Thread Martin Jenkins

Arora, Ajay wrote:

Can anyone please look into my query,

I've tables
 
Master ( id integer primary key,

 field1 text)

And 


Child (id integer, name text)


Might be worth looking for Celko's "Hierarchies in SQL". I've not read 
it but I've seen good reviews and Celko seems well regarded.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Difference in these indices?

2007-03-29 Thread Martin Jenkins

John Stanton wrote:
Perl would not do a good job.  You need to use the Sqlite page 
structures and they are defined in C terms.


But Tcl might. The test suite pokes about with SQLite internals.

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] CREATE INDEX performance

2007-03-27 Thread Martin Jenkins

Stephen Toney wrote:


Meta-question: this is the second time I've asked this question. The
first was about a month ago and got not a single reply. Is there
something wrong with my postings? Or is this just not an interesting
topic?


I think it just boils down to how much time people have.

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Error reporting problem

2007-03-27 Thread Martin Jenkins

Dan Kennedy wrote:


Even using the prepare_v2() interface, the database handle error-code
and error-message (the stuff returned by sqlite3_errcode() and 
sqlite3_errmsg() respectively) are not populated by sqlite3_step(). 
After sqlite3_step() reports an error you need to call either

sqlite3_reset() or sqlite3_finalize() to copy the error-code and
message from the statement to the database handle.


Thanks for clearing that up Dan. I changed Vivien's test code to show 
this - rc is set to 19 and the sqlite3_errXXX functions do return the 
"wrong/right" thing before/after the sqlite3_reset. I still think the 
docs imply something else though, but it's been one of those weeks. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Questions on views

2007-03-27 Thread Martin Jenkins

Dennis Volodomanov wrote:


[...]
The reason that such a huge amount of statements needs to be executed so
many times very quickly is that we have a tree built up based on those
statements and that tree needs to be pruned if the results of statements
are empty in real-time as the user is typing a string (a search string
basically).

> [...]

Sorry to butt in (especially without knowing your constraints) but is 
SQL the right approach to use here? Isn't this the sort of thing that 
Patricia/radix/suffix trees are used for?


NB: I've just got up and haven't had any tea to start the boot process 
yet, so I could be talking (more) nonsense (than usual). ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



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 required (contrary
to what the doc says), or maybe I got something wrong...


Hmm. I built this on Debian (had to tweak the Makefile very very 
slightly) and got the same results as you. From my reading of:


"""Goofy Interface Alert:  [...] The problem has been fixed with the 
"v2" interface. If you prepare all of your SQL statements using either 
sqlite3_prepare_v2() or sqlite3_prepare16_v2() instead of the legacy 
sqlite3_prepare() and sqlite3_prepare16(), then the more specific 
result-codes are returned directly by sqlite3_step(). The use of the 
"v2" interface is recommended."""


you should NOT have to call sqlite3_reset() after an error. Perhaps 
someone with experience of the C API could comment?


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



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, I get the
following error:
"SQL error: column name is not unique"
which is much more obvious to understand.

Any idea how I could get that error message calling sqlite3_errmsg()?


The pysqlite wrapper has a bug which reports the same error message if 
you try to nest transactions. I fixed the wrapper (locally) by adding an 
sqlite_reset(). I think there's a new API (sqlite_prepare_v2()?) which 
has the same effect. If you can't search (say) gmane then post a tiny 
code snippet and someone who uses the C API more than I do will spot the 
problem straight away.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



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 happens to show only the first line).


Use sqlite3_column_bytes[16] to convince yourself that SQLite gives 
you the complete string.


Thanks for that rather blunt reply.


What was blunt about it? You asked a question regarding odd behaviour 
that nobody else has seen without providing any context. Igor confirmed 
that SQLite didn't behave like that and suggested possible explanations 
for what you saw. If you don't like the answer, ask better questions. 
Anyway, I thought you Ozzies liked a bit of direct speaking. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Index creation on huge table will never finish.

2007-03-22 Thread Martin Jenkins

P Kishor wrote:
Mac/Unix person meself, but the Windows XP sort is pretty darn good as 
well.


I'll take a look. Last time I used it it was useless. Win9x days? these 
days (especially for a one off) I'd probably go straight to doing it in 
Python to avoid x-platform syntax issues.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Index creation on huge table will never finish.

2007-03-22 Thread Martin Jenkins

Chris Jones wrote:

realized that the unix "sort"


If I'd known you were on 'nix I'd have suggested using 'sort' and/or 
'md5sum' about 12 hours ago. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Saving binary files

2007-03-18 Thread Martin Jenkins

Dimitris P. Servis wrote:

I have to provide evidence that such an anorthodox solution is also 
feasible


If it was me I'd "investigate" the problem by doing the "right" thing in
the first place, by which time I'd know enough to knock up the "wrong" 
solution for the doubters before presenting  the "proper" solution as a 
fait accompli.



I have to compare access performance with flat binary files


If I remember correctly, there's no random access to BLOBs so all you'd
be doing is storing a chunk of data and reading the whole lot back. I
don't think that's a realistic test - the time it takes SQLite to find
the pages/data will be a tiny fraction of the time it will take to read
that data off the disk. You can't compare performance against reading
"records" out of the flat file because "they" won't let you do that. In
all it doesn't sound very scientific. ;)

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Pragma table_info(), why no fields like UNIQUE, AUTOINCREMENT

2007-03-13 Thread Martin Jenkins

Vivien Malerba wrote:

I've already sent a proposal along with a patch some time ago about
that, but nobody seemed to care, see
http://www.mail-archive.com/sqlite-users@sqlite.org/msg21285.html


Vivien, I can't see any patch attached to that post. Perhaps you should 
resubmit it? And I'll guess the odds of any patch being accepted are 
significantly improved if the patch both passes and extends the test suite.


Martin



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] notice: embedded system and locked database

2007-03-12 Thread Martin Jenkins

Jakub Ladman wrote:

Problem is, that this is pretty obscure system. Renesas SuperH SH4
CPU Heavily patched 2.4.18 kernel. (patches will be presented on
internet, but not at this time) Gentoo-embedded linux, based on
uclibc 0.9.28 and busybox . Main storage is SD flash card.



I must confess, that i do not know, how to check the nfs version. (it
is binary distributed kernel and i have not the actual .config of it)
Dmesg shows it not.


Hmm. I see your problem. 2.4.18 is quite old but if it's been patched 
about... It's possible to build the .config into the Linux kernel so 
that it appears under /proc (/proc/config.gz?) - I don't suppose they've 
done that?


Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQlite 2.8.16 -> SQLite 3

2007-03-12 Thread Martin Jenkins

Mitchell Vincent wrote:

So is a 60%ish reduction in DB size from 2.8.16 to 3.3.13 normal?


Don't know about "normal" but ISTR version 3 did bring some fairly major 
improvements in file size. Given that you have your data in both SQLite 
formats would it not be fairly easy to dump both databases to text files 
as (say) SQL and diff the text files?


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Re: Argh, this must be a very stupid question ...

2007-03-12 Thread Martin Jenkins

Stef Mientki wrote:

so it was indeed a stupid question !


No, it was a well phrased question with a simple answer.

A stupid question is when the message is "I CANT OPEN A DATABSE!!! WHY 
[EMAIL PROTECTED] IT WORK? IS IT A BUG!!!" and nothing else. ;)


mj

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] stupid man's manual to sqlite?

2007-03-08 Thread Martin Jenkins

Jakub Ladman wrote:
Thank you i will try my possibilities buying from amazon, while i am based in 
the Czech republic.
Unfortunately it is little bit expensive for me, to buy it without looking 
into it before.


I don't know if would help, but Apress sell an e-book (PDF) version for 
about half the cost of the printed version.


http://www.apress.com/ecommerce/cart.html?act=add=10130

The printed contains details of how to get a PDF version for $10US, but 
that's a bit Catch 22 here. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] notice: embedded system and locked database

2007-03-08 Thread Martin Jenkins

Jakub Ladman wrote:
Now i have discovered, that this appears only if the database file is stored 
on the nfs filesystem (posibly too slow, or something similar)


There have been many threads on this list about NFS locking being 
broken, but few reports of it actually happening. Could you post a few 
details about the OS versions and file systems in your environment for 
future reference?



I will try to togle some nfs parameters as sync/async and so...


Judging by earlier threads this may not help. :( The basic problem is 
that some NFS implementations have faulty locking, so tweaking might 
just mask the problem until later.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] import operation - primary key need to be automatically generated by SQLite (not from csv file)

2007-03-07 Thread Martin Jenkins

RohitPatel wrote:

/* SQLite 3.3.8 (Windows) used */

/* table t1 */
/* only two columns are given because other columns are irrelevant here */
create table t1 (id INTEGER PRIMARY KEY, name TEXT);

/* few sample records from csv file data.csv */
1,'name_text_1'
2,'name_text_2'
3,'name_text_3'
4,'name_text_4'

/* import statement */
.import imp3.csv t1


If your CSV files' id columns are unwanted you could delete them rather 
than edit them.  Writing a simple script to clean up your data would be 
trivial on 'nix but I see you're on Windows so how about something like:


create table t1 (id INTEGER PRIMARY KEY, name TEXT);
create table t1raw (id INTEGER, name TEXT);

.import imp3.csv t1raw

insert into t1(name) select name from t1raw;
drop table t1raw;

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Lemon example

2007-03-06 Thread Martin Jenkins

Cesar Rodas wrote:

The URL is ok, I opened here...


Works fine in .uk too

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] How fast is the sqlite connection created?

2007-03-01 Thread Martin Jenkins

Samuel R. Neff wrote:

Eric,

Sorry if this is obvious to everyone else but not to me.. what exactly is
cursor()?  I don't see it anywhere in the C API and the wrapper I'm using
(SQLite .NET) doesn't have any corresponding method.


A cursor is the thing that you use to run your queries. Eg in Python's 
wrappers you import the wrapper (library, module) Connections to the 
database and create cursors on those Connections to do the actual work.


import sqlite3
conn=sqlite3.Connection(dbname)
crsr=conn.cursor()
crsr.execute("select * trom table")
result_set=crsr.fetchone()
...
result_set=crsr.fetchall()

and so on. SQLite cursors can only move forward in the result set. AIUI 
cursors in some older/bigger databases can move in either direction.


FWIW it looks like calling cursor() takes ~1.9us on my machine with 
Python2.5, sqlite3, disk file with schema of "create table t(a,b,c)".


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] How fast is the sqlite connection created?

2007-02-28 Thread Martin Jenkins

Samuel R. Neff wrote:

One last set of performance numbers for opening a connection.  :-)


All points on the curve. ;)


So the impact of open/closing connections on a real-world db really is huge.


You're right, that's a huge difference. Good bit of benchmarking there.


These tests with triggers is very different from tests without--are triggers
completely parsed and compiled every time a connection is opened?


I don't know. I'd assume that triggers were part of the "schema" and 
would be parsed when (or shortly after) a connection is opened.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Crosscompiled sqlite was: developer mailing list

2007-02-28 Thread Martin Jenkins

Jakub Ladman wrote:

But there is not tcl library at the time and when I tried to build sqlite 
without -DNO_TCL it failed.


I think you will have fewer problems building Tcl than you did building 
SQLite because the automake code will be more up to date. You'v ebuilt 
SQLite so you're an expert now. ;)


I can test it on the sh4 cpu for the community, of course, if you think it 
will be usefull.


I'd certainly try it if I was in your position. Getting Tcl built might 
take you half a day or a day, but if you do that and and can test SQLite 
then you'll get the benefit of years of testing in half an hour. If you 
test the library and it passes, you can draw a line at the interface and 
build on a solid foundation. If you don't test and you get odd bugs a 
month down the line you'll never know if it's a porting problem or a bug 
in your code or...


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Crosscompiled sqlite was: developer mailing list

2007-02-27 Thread Martin Jenkins

Jakub Ladman wrote:

Problem is, that i do not know tcl. I know only that it exist.
Jakub


That's OK, it's just another target (make test) in the Makefile. You 
don't need to know any Tcl, you just have to install the source code and 
know where you've installed it.


make test builds a program (called testfixture) which drives the sqlite 
library you've just built from tiny Tcl programs. Dr Hipp has written 
lots of these programs over the years. You might have to tweak the tool 
chain but as you've already built the library you should be OK. The test 
suite has over 20,000 tests in it, so it's well worth getting it going 
on a port to a new platform.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Crosscompiled sqlite was: developer mailing list

2007-02-27 Thread Martin Jenkins

Jakub Ladman wrote:

And what should i do with this?

SQLite version 3.3.13
Enter ".help" for instructions
sqlite> create table tbl1(one varchar(10), two smallint);
SQL error: database is locked
sqlite>


What was the command line? Can you get Tcl running on your machine? As 
you've effectively made a effectively new port it would be a good idea 
to try and get the tests working - they should pinpoint any areas which 
aren't working. A list of failing tests should make it easier to track 
the problem down than a "database locked" from the shell.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] developers mailing list

2007-02-26 Thread Martin Jenkins

Jakub Ladman wrote:

but after correction of this i get:

libsqlite3.a   -lpthread
libsqlite3.a(os_unix.o): In function `sqlite3UnixDlopen':
os_unix.c:(.text+0x848): undefined reference to `dlopen'
libsqlite3.a(os_unix.o): In function `sqlite3UnixDlsym':
os_unix.c:(.text+0x85c): undefined reference to `dlsym'
libsqlite3.a(os_unix.o): In function `sqlite3UnixDlclose':
os_unix.c:(.text+0x870): undefined reference to `dlclose'
collect2: ld returned 1 exit status
make: *** [sqlite3] Error 1
[EMAIL PROTECTED] ~/src/sqlite-3.3.13 $   


You're nearly there. The compile has completed, and it's failed at the 
link stage. You need to add "-ldl" to the end of the recipe so the 
linker can find dlopen et al.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] How fast is the sqlite connection created?

2007-02-26 Thread Martin Jenkins

Samuel R. Neff wrote:

Thank you for the testing and information.


;)


When I have time to run some tests using our actual schema (120+ tables,
several hundred indexes) I'll post back here in case others are interested
in our results.  From your tests it looks like more complex schemas probably
take more time to parse (as would be expected) so a real-world schema might
take longer than a test schema.


Please do, the more info the merrier. I wasn't sure if anyone would find 
it useful but thought I'd seed the list for future reference.


The schema was pretty trivial - all tables looked like

"tXXX(a INT, b INT, c FLOAT, d TEXT)"

and to add the indexes I just added a UNIQUE constraint to a, b & d. It 
would be good to have some results from a real database.


Best Regards,

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] How fast is the sqlite connection created?

2007-02-26 Thread Martin Jenkins

Martin Jenkins wrote:

So the difference in connect times between a database with 1 table and 
10 tables is ...


It appears that adding indexes (and triggers?) increases the time at 
about the same rate as adding tables. That is a connect/first select to 
a database with 1 table and 3 indexes takes about as long it does to a 
database with 4 tables.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] How fast is the sqlite connection created?

2007-02-26 Thread Martin Jenkins

Peter van Dijk wrote:
every time you open an sqlite database file, the sqlite library has to 
parse all table structures. It is much better to keep your 
connection/handle open for longer periods of time.


On my XP box it takes about 220us to connect to an SQLite database from 
Python, whether there is 1 table or 1000.


A "connect" here is "C=sqlite3.Connection('tmp.db'); C.close()"

   0.121: To create 1 tables with 1000 rows each
   0.223: To connect 1000 times (222us per connect)

   0.651: To create 10 tables with 1000 rows each
   0.236: To connect 1000 times (234us per connect)

   5.776: To create 100 tables with 1000 rows each
   0.224: To connect 1000 times (223us per connect)

  58.393: To create 1000 tables with 1000 rows each
   0.219: To connect 1000 times (218us per connect)

I guess the parsing is delayed until necessary because what takes the 
time is, say, the first select:


A "connect" here is "C=sqlite3.Connection('tmp.db'); C.execute('select a 
from t0 limit 1'); C.close()"


   0.119: To create 1 tables with 1000 rows each
   1.008: To connect 1000 times (1007us per connect)

   0.638: To create 10 tables with 1000 rows each
   1.264: To connect 1000 times (1263us per connect)

   5.801: To create 100 tables with 1000 rows each
   4.193: To connect 1000 times (4192us per connect)

  58.419: To create 1000 tables with 1000 rows each
  32.468: To connect 1000 times (32466us per connect)

So the difference in connect times between a database with 1 table and 
10 tables is about 25%, fairly trivial 250us. With 100 tables connect 
time is 3ms, worse by a factor of 4 but still not bad. With 1000 tables 
the 33ms connect time becomes significant, but I would imagine that 1000 
table databases must be pretty unusual.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] The best way to delete a column ?

2007-02-26 Thread Martin Jenkins

Stef Mientki wrote:

I just read it's not possible to delete a column in an existing table.
Now what would be the best way to remove the column indirect
(from Delphi code),


I've never needed to do this so the following are just hints.

The special table "sqlite_master" contains the SQL that was used to 
create the table in the first place. You can erad it like any other table.


Just copying a table won't recreate any indexes, constraints, triggers 
etc which exist on that table.


You can create a table from the result of a select.

As a first attempt I'd do something like:

start transaction
get the table schema and that of any triggers etc
alter the schema to lose the unwanted column (in Delphi)
drop the triggers, indexes etc
rename the table you want to change
create new table with the new structure
copy the data from old table to new table
recreate the new triggers, indexes etc
end transaction
drop the old table
vacuum the database

NB: I haven't tried or tested the above. ;)

Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Sqlite3 in MAC Os

2007-02-26 Thread Martin Jenkins

Kirrthana M wrote:

Im developing an application using sqlite3 in MAC OS,I just wanted to
know wheather sqlite3 can be used in MAC OS.


I don't use Mac, but I *think* SQLite is bundled with later versions.


If so can the same sqlite3 library and the executable used in windows
can be used in MAC OS or a different version has to be used.


Pretty unlikely I'd have thought, unless your Mac is x86 based and MacOS 
has a Windows emulation layer. You'll probably have to build from source 
unless you can find a site with pre-built binaries.


As I said, I don't use Mac so the above is TTBOMK.

Martin



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Using same database with multiple processes

2007-02-25 Thread Martin Jenkins

Thomas Dybdahl Ahle wrote:

Hi, I'm running a project using pysqlite for database support. It's
awsome.
Now I have a user who produces this warning: "Warning: You can only
execute one statement at a time."


Hard to say without knowing the value of sql in

cur.execute(sql)


pysqlite's execute method can only execute a single query. Use 
executescript to executing multiple queries.



I'm wondering if it can have something to do with multiple processes
using the same database?


Don't think so.


I can't reproduce it my self, but then I haven't got a dural core
processor.


I'm running a dual CPU machine and with Python2.5 and sqlite3 (basically 
what you have but newer) I get:



PythonWin 2.5 (r25:51908, ... v.1310 32 bit (Intel)] on win32.
Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' 
for further copyright information.

>>> import sqlite3
>>> C=sqlite3.Connection(":memory:")
>>> c=C.cursor()
>>> c.execute("begin; create table t(a); end")
Traceback (most recent call last):
  File "", line 1, in 
Warning: You can only execute one statement at a time.

>>> c.executescript("begin; create table t(a); end")
Traceback (most recent call last):
  File "", line 1, in 
ProgrammingError: you did not provide a complete SQL statement

>>> c.executescript("begin; create table t(a); end;")


BTW, there is a pysqlite list (this one is for the SQLite, the 
underlying C library) but it's a bit quiet.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] developers mailing list

2007-02-25 Thread Martin Jenkins

Jakub Ladman wrote:

You want "make -f Makefile.linux-gcc"

This

> make Makefile.linux-gcc

Will try to build "Makefile.linux-gcc" from a file called "Makefile"

Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] How fast is the sqlite connection created?

2007-02-25 Thread Martin Jenkins

Alex Cheng wrote:

Hi,

I want to know how many time is spent when create a sqlite connection. 

> Is it effeciency? My application creates a connection and close it
> when access DB everytime, is it OK?




Going by your sig, here are the times for Python 2.5 running under XP 
SP2 on a 1.6GHZ dual Athlon.



import timeit

t=timeit.Timer("C=sqlite3.Connection(':memory:')", "import sqlite3") 
print "%d us per connection" % (t.timeit(1) * 100/1)

90 us per connection


t=timeit.Timer("C=sqlite3.Connection('diskfile')", "import sqlite3") 
print "%d us per connection" % (t.timeit(1) * 100/1)

265 us per connection




The C times will be faster, but not by much.

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-25 Thread Martin Jenkins

RB Smissaert wrote:

OK, I understand better now. This though doesn't seem quite right to
me:

0, //sqlite3_libversion,

It looks sqlite3_libversion should be a string.


No, this is a list of function pointers. C has no notion of the *name* 
of the function, only its address. Functions are called by writing that 
address with a following "()". If you used a string containing the name 
of the function you end up trying to execute ASCII text. This is never 
going to work, though it is the basis of the buffer overflow technique 
that our friends the virus writers use. :(



Would it matter that I make it 0, rather than say ""? If it should be
an empty string then how would I do that in C?


You're confusing 0 the string terminator with 0 the NULL pointer. "" is 
an empty string but it has an address and at that address is a 0 which 
(as defined by the C standard) terminates the string. 0 in a pointer 
context tells the compiler to generate a special (NULL) pointer which 
cannot be dereferenced. The C standard defines that 0 in source code 
means NULL pointer but the implementation value is not defined. That is, 
a NULL pointer may or may not be numerically 0 in the binary object but 
usually is.


It matters because Dr Hipp has set it up that way. Wherever it is that 
these functions are dispatched, there will be a NULL pointer check. If 
the pointer is NULL then no attempt is made to run the function. As I 
said above, "" has an address so it will pass the not NULL test and an 
attempt will be made to execute whatever that string pointer points at 
(0 followed by ???) and...crash.


The real trouble with this is that execution might proceed for a while 
or even end up at a random but legitimate location within the program 
code, meaning the crash occurs some time later and far away from the 
actual bug location. M$ have something called DEP in XP which is meant 
to prevent this kind of thing, but it needs a reasonably up to date CPU.


We might be in danger of getting coughed  soon. ;)

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:


Due to me not knowing C I hadn't realized that this structure had to be left
intact. 


It's not a C thing as such, it's the way Dr Hipp has designed it. It's 
an interface - the third entry in the list always does the same thing 
but the function that actually runs to do that thing can be changed, 
possibly at runtime. You can disable entries by setting them to 0 (if 
the infrastructure knows about it) but if you swap list entries around 
(or delete them) things will break. That's where the VB DLL instructions 
fell down.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:

Will give that a try and see if it gives any less warnings.


OK, but as Dennis suggested and Dr Hipp has confirmed this isn't the way 
to go. I was assuming the VB thing was a bit of a hack and didn't really 
read enough of the C code.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:

How would I do this:
compile with -DSQLITE_OMIT_LOAD_EXTENSION=1 to leave it out.


Remember that link tab I said about earlier?

There's a C/C++ tab next to  it with a Preprocessor definitions edit 
box. I think what you want is to put ",SQLITE_OMIT_LOAD_EXTENSION=1" at 
the end of the line and rebuild your DLL. I can't say for sure because I 
don't actually use VC6++ much - I bought a 2nd hand copy a couple of 
years ago so I could compile Python/wxPython but they've moved on now.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:

Microsoft Visual C++ 6 Enterprise edition.


Hmm. I'm using VC6++ Pro. I wonder if it's safe to assume the compilers 
are the same and the difference is that I don't have the Enterprisey 
middleware gubbins.



I think it is the latest before .net came in.


Dunno. I kind of lost interest in M$ around then . ;)

I'll grab the 3.3.13 code and see what happens with that. Given that 
nobody's rung me up to go for a pint yet I'll have a look at the 
TannerTech mods too, but I won't be adding to his "Sole Donation" 
because he says he lifted most of it from another site. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:

Thanks, that is very helpful and reassuring as well.
Will see if I can figure out then what is causing this one:
warning C4028, as you say that could be a typo.


I've just built 3.3.12 source with VC6 and didn't see that error. I 
changed the warning level to 4 and got 500 warnings (signed/unsigned 
mismatch, oddities in M$ headers, unreferenced parameter NotUsed ;)) but 
not a C4028 in sight. VC6 is pretty old now - what version are you 
using? And which sqlite source are you building?


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:

Did you make the alterations to make the dll VB compatible?


I don't think Dennis was building the VB version. The lines that Todd 
says you have to comment out - did you comment them out or replace them 
with a 0?


I haven't analysed the code fully but I'm a bit suspicious about that // 
mod.


Firstly, comments in loadext.c says  new functions have to go at the end 
of the list to maintain backwards compatibility, so it sounds like the 
order is significant and 2) when sqlite3_global_recover was deprecated 
it was replaced with 0 rather than being removed completely, which also 
suggests that the order is significant.


On that basis I'd expect to see the line

 ...
 sqlite3_changes,
 ...

replaced with

 ...
 0, // sqlite3_changes,
 ...

and not

 ...
 // sqlite3_changes,
 ...

I can't comment on why Todd chose to remove those lines.

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite - how to protect the data

2007-02-24 Thread Martin Jenkins

mxs wrote:

I had to google around to find out what is wxWidgets
...
I decided I'd like to try Python and SQLite


Check out wxPython too.

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] sqlite ebuild - my problem, i have half year ago, is still here.

2007-02-24 Thread Martin Jenkins

Jakub Ladman wrote:

Hi Friends
Please help me
I need crosscompile sqlite for my sh4 cpu based linux system, but configure 
script (any version of sqlite i have tryed, even the actual one from sqlite 
homepage) fails if crosscompilation is selected.

Crosscompiler works good in other cases.
Thank you very much.


The autoconf stuff is unsupported and from recent comments hereabouts is 
likely to stay that way. I started to look at it last year but didn't 
get too far and didn't get anywhere near looking at cross-compilation. 
There are some autoconf tools which might help - autoreconf comes to 
mind but if they don't help I think you're going to be on your own 
unless you can find someone who knows autoconf reasonably well and 
persuade them to fix it up a bit.


There's a Linux Makefile in the source tree - I believe that it's used 
to build the binaries on the website - have you tried hacking that to 
see if it will work on your system?


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:

When compiling this source code I get 265 warning, which doesn't really
worry me that much as it all seems to be working fine, but in general what
kind of warning should be taken seriously?


This has come up the list before. Dr Hipp assigns a lot more weight to 
his tests passing than the complete absence of compiler warnings. This 
may sound cavalier but many of these warnings are in fact pretty benign. 
If you have a comprehensive test suite (as SQLite does) you can assume 
that these warnings *are* benign. One widely accepted reason for not 
"fixing" them is that most of the fixes (usually casts to similar type) 
just clutter up your source code and mask the intentions of the author.



I only have 8 different types of warnings:


I won't go through them in huge detail because it's hard to say what the 
problem is without seeing the specific source lines, but generally 
compilers play safe and it's up to the author to know what he's doing. 
It can be a bit scary when you compile someone else's code for the first 
time - you see a load of warnings and think what a load of [EMAIL PROTECTED] but most 
of the time it's just the compiler being picky. As I said above, if you 
have a decent test suite you can relax a lot.



warning C4018: '!=' : signed/unsigned mismatch


This is usually benign. Say you have an variable in which you store the 
unsigned return value from a library function. You know the value is 
always +ve so you make the variable unsigned. The compiler doesn't know 
the number will always be +ve but it knows signed/unsigned mismatch is a 
common source of bugs so it reports a warning. A cast would fix the 
warning but might suggest to the reader that the author wanted to force 
some kind of conversion. Or it might not.



warning C4028: formal parameter 1 different from declaration


Without seeing the code, it's hard to say, but I'd expect this to be an 
error or a typo. Whether it matters is something else - it could be the 
signed/unsigned issue above.



warning C4047: 'initializing' : '__int64 (__cdecl *)(struct Mem *)' differs
in levels of indirection from 'char *(__cdecl *)(const char *,char *)'


Hard to say without seeing the code. Indirection in C can be quite 
tricky and is a common source of bugs, but I'd be surprised to see 
anything like that in SQLite.



warning C4090: 'function' : different 'const' qualifiers


This is common when using string library functions. They're declared 
const because, say, strlen won't alter your data and your pointers are 
not declared const because they do. Sometimes an error but usually ok.



warning C4113: '__int64 (__cdecl *)(struct Mem *)' differs in parameter
lists from 'void *(__cdecl *)(struct sqlite3 *,void (__cdecl *)(void *,int
,const char *,const char *,__int64 ),void *)'
warning C4133: 'initializing' : incompatible types - from '__int64 (__cdecl
*)(struct sqlite3_stmt *,int )' to 'double (__cdecl *)(struct sqlite3_stmt
*,int )'


Hard to say without seeing the code, but it looks related to the 
indirection warning above.



warning C4244: '+=' : conversion from '__int64 ' to 'int ', possible loss of
data
warning C4761: integral size mismatch in argument; conversion supplied


Common warnings where the compiler has converted between say 16/32 bit 
ints and 32/64 bit longs. It's OK in one direction but it may not be OK 
in the other, so the compiler warns and it's up to you to check. If the 
int/long variable only holds small numbers it's not significant but the 
compiler can't tell what numbers will be stored and so it's back to you.


This explanation is brief and fairly rushed so may it not be completely 
rigorous in places but I hope it helps a bit.


Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:


Now what do I do make it compile a dll called SQLite3VB.dll?


I think it defaults to the project name, but have a look at the Link tab 
in the Project|Settings dialog (Alt-F7) - there's an edit box titled 
"Output file name" which might do what you want.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:

Thanks, will have a look at that.
Do you know from experience that it will compile OK with VC6++?


I'm pretty sure I've compiled it with VC6++. I've been compiling on 
Debian and Solaris machines recently and have sort of lost track of 
building stuff on Windows. I tried upgrading to the current MS compilers 
but there seemed to be so many things that I didn't know I wanted that I 
think I gave up.


I'm having the same problems with installing the software for my phone. 
Been at it a couple of hours and so far it's changed my default email 
application, my default image viewer and my MP3 player and I still can't 
access the information I wanted off my phone. First and last Windows 
Smartphone I'll buy. It's "Smart" as in "Sting" rather than "Clever".


I'm going for a cup of tea and then I'll have a look and see if I can 
find some  VC6 project files for you. If I do I'll mail them straight to 
you rather than clutter up the list. If they work I suppose they could 
be uploaded somewhere.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling with VC++

2007-02-24 Thread Martin Jenkins

RB Smissaert wrote:

Could anybody pass me step by step instructions to compile the source with
MS VC++ ? I don't code or compile in C at all and only code in VB/VBA.


There a some instructions at:

http://www.sqlite.org/cvstrac/wiki?p=HowToCompile


and a zip file - sqlite-source-3_3_13.zip - containing preprocessed 
source for Windows users at:


http://www.sqlite.org/download.html

I don't know if that latter file contains the headers you want as I 
mostly work on Linux.


This is a bit of an FAQ so you might want to take a look through the 
mailing list archives. There's one at news.gmane.org.


Shout again if this didn't help. ;)

Martin



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] BLOB question

2007-02-23 Thread Martin Jenkins

Cesar Rodas wrote:

   while ( (n=fread(buff,Buffsize,1,file)) > 0)
   {
   if (i>0)
   *value = realloc(*value, (i+1) * Buffsize);
   memcpy(*value + (i * Buffsize), buff,  Buffsize);
   *len += n;
   i++;
   }


An afterthought, why don't you just stat the file and malloc the right 
sized buffer from the outset? Much easier.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] about default file permission of SQLite database file

2007-02-23 Thread Martin Jenkins

Joe Wilson wrote:

I can never remember the umask number's effect without 
experimentation


DESCRIPTION
   umask sets the umask to mask & 0777.

The  umask  is used by open(2) to set initial file permissions on a
newly-created file.  Specifically, permissions in the umask are turned
off from the mode argument to open(2) (so, for example, the common umask
default value of 022 results in new files being created with permissions
0666 & ~022 = 0644 = rw-r--r-- in the usual case where the  mode  is
specified as 0666).

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] BLOB question

2007-02-23 Thread Martin Jenkins

Cesar Rodas wrote:

> #define uchar unsigned char *

suggests it's a char but is in fact a pointer to a char so the signature 
of LoadFileContent is actually


int LoadFileContent(unsigned char **path, unsigned char ***value, ...

and that triggers my "three levels of indirection is usually an error" 
alarm. You want


> #define uchar unsigned char /* no asterisk here */

or even better

typedef unsigned char uchar;

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Nested Parens Stack Overflow

2007-02-22 Thread Martin Jenkins

Matt Froncek wrote:

Martin,

Thank you for looking into this. The SQLite3.exe I tested with was 3.1.3.
And yes the SQL statement works fine as it. If you add one more nested OR to
the SQL statement then it stops working. I don't get a stack overflow like I
do in the ODBC driver I was testing with but it errors with a syntax error
about the "=".

Change the last to lines to:
  Customer.FullName = 'Okami' OR (
  Customer.FullName = 'Okami2' OR (
  Customer.FullName = 'Quickspice, Inc.')


OK, if I add another line I do get an error with sqlite3 v3.3.11

> SQL error near line 46: parser stack overflow

I think you said that you generate the queries? If so, do you have to 
nest so many nested ORs? I'm no SQL expert but


... AND  ( Customer.FullName in (
 'Amazon.com.ksdc, Inc. - Campbellsville',
 'Amazon.com.ksdc, Inc. - Coffeyville',
 'Amazon.com.ksdc, Inc. - Fernley',
 'Arizona Select',
 'ATW - Cobb Dist.',
 'SunOpta Food Distribution Group',
 'Callaway Consumer Products, LLC',
 'Cedarlane Natural Foods',
 'City Glatt, Inc.',
 'Columbus Distributing, Inc.',
 'Cost Plus World Markets-West',
 'DeKalb Farmers Market',
 'DPI-Midwest',
 'DPI-Northwest',
 'DPI-Rocky Mountain',
 'DPI-West',
 'Exel Pak',
 'Falcon Trading Co.',
 'Foodguys',
 'Foodology',
 'Gourmet Awards - Milwaukee',
 'Kehe Foods',
 'Marc Popcorn Company',
 'Marukai Markets',
 'Matsukas Food Company',
 'McCain Foods USA, Inc.',
 'Okami',
 'Okami2',
 'Quickspice, Inc.'))
  )

appears to do the same job and a quick test suggests that it does. I 
don't what limits (if any) there would be with this approach but I 
suspect Dr Hipp would rather you fix your SQL generator than have to 
"fix" his parser. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Precision of dates stores as Julian "real"

2007-02-21 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

Guess you can't please everybody :-)  Right now we have some
documentation in the source tree and some on the wiki, which
I suppose is guaranteed to please nobody.


So make the wiki available for download. ;)

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite db lock problem

2007-02-20 Thread Martin Jenkins

Christian Smith wrote:

> SQLite has been known to be problematic using NFS drives, mainly due
> to flaky NFS locking implementations.

I'm not sure it's fair to say SQLite is "problematic". It's susceptible 
to NFS locking problems in certain situations, but so is any other app 
which assumes that advertised behaviour has been implemented correctly.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Search all collumns with LIKE at once

2007-02-19 Thread Martin Jenkins

fangles wrote:

PK? I'm sorry but I am not familiar with that term..


Sorry, in  this example a Primary Key is a column (eg an integer) which 
uniquely specifies a row in a table.


In the example above you:

select all columns from the rows which have a PK in the set
 (
   select the PK from all rows where the columns joined together 
matches your search text

 )

BTW, I don't know how well this performs compared to the FTS extensions.

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Search all collumns with LIKE at once

2007-02-18 Thread Martin Jenkins

fangles wrote:

I'm currently searching through all columns in a table to see if any match
the search text and the query is rather cumbersome. Is there a way to use a
loop to go through all available columns by some means? Maybe a loop by
querying the schema?


If you had a PK on that table and used a view to concatenate the columns

create view v as select pk, first||...||deleted as cols from addr;

you could reduce the select to

select * from addr where pk = (select pk from v where cols like srch);

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Search all collumns with LIKE at once

2007-02-18 Thread Martin Jenkins

fangles wrote:

I'm currently searching through all columns in a table to see if any match
the search text and the query is rather cumbersome. Is there a way to use a
loop to go through all available columns by some means? Maybe a loop by
querying the schema?

SELECT * FROM addresses WHERE title LIKE '% + searchtext + %'
OR first LIKE '%  + searchtext + "%'
OR middle LIKE '% + searchtext + "%'
OR last LIKE '%   + searchtext + "%'
OR street LIKE '% + searchtext + "%'
OR suburb LIKE '% + searchtext + "%'
OR city LIKE '%   + searchtext + "%'
OR postcode LIKE '%   + searchtext + "%'
OR state LIKE '%  + searchtext + "%'
OR country LIKE '%+ searchtext + "%'
OR work LIKE '%   + searchtext + "%'
OR home LIKE '%   + searchtext + "%'
OR mobile LIKE '% + searchtext + "%'
OR company LIKE '%+ searchtext + "%'
OR misc1 LIKE '%  + searchtext + "%'
OR misc2 LIKE '%  + searchtext + "%'
OR email LIKE '%  + searchtext + "%'
OR note LIKE '%   + searchtext + "%'
OR category LIKE '%   + searchtext + "%'
OR displayas LIKE '%  + searchtext + "%'
OR firstentry LIKE '% + searchtext + "%'
OR lastedit LIKE '%   + searchtext + "%'
OR deleted LIKE '%+ searchtext + "%' ORDER BY displayas

This is a big one!!


Could you not join all the columns and search that?

select * from addresses where first||middle...deleted like searchtext;

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Month string from yyyy-mm-dd

2007-02-18 Thread Martin Jenkins

RB Smissaert wrote:

Analyzing the lookup table knocks the time down from 0.36 to 0.31 secs,
something I didn't expect.


That shows the importance of testing. I ported the SQLite benchmarks to 
Python and was surprised to see some of the tests taking minutes to run 
versus a few (or a few tens of) seconds for the SQLite shell reading SQL 
from a file or the same wrapper executing the statements individually.


For a 100k line bulk insert (e.g., restoring from a .dump to a disk 
file) that could mean a slow down from about 25 seconds to over 5500 
seconds, or 92 minutes...


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Month string from yyyy-mm-dd

2007-02-18 Thread Martin Jenkins

RB Smissaert wrote:

Yes, it looks it isn't there.


I guess it isn't really SQLite's place to know how to spell this month's 
name in your locale. It's a presentation issue at the end of the day and 
a lookup table is a nice easy solution.



to update the table and 25000 records takes about a third of a second

> ...

Will see if doing it with a substr function is any faster.
Would that work on integer numbers?


Dunno, but 80,000 updates a second seems quite good to me. How often do 
you need to run this? Premature/excessive optimisation and all that. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Month string from yyyy-mm-dd

2007-02-18 Thread Martin Jenkins

RB Smissaert wrote:

Is it possible with the date-time functions to get the month as a string, so
January etc. from the date in the format -mm-dd?


Doesn't look like it. Nothing in the wiki and I couldn't see anything in 
the source either. I suppose you could use a big case statement if you 
wanted to avoid joining with a month table.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-15 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

Martin Jenkins <[EMAIL PROTECTED]> wrote:

Raised as ticket http://www.sqlite.org/cvstrac/tktview?tn=2232



Thanks.  Bug reports are always welcomed.

But this problem was fixed yesterday.  When you see problems in
SQLite, especially problems that have been discussed on this
mailing list, it is useful to visit the timeline to see if they
have been fixed already.


Noted, my bad. There weren't any comments on the list so I assumed I was 
talking to myself. Warnock applies. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-15 Thread Martin Jenkins

Raised as ticket http://www.sqlite.org/cvstrac/tktview?tn=2232

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Difference between sqlite and sqlite3

2007-02-15 Thread Martin Jenkins

Dan Kennedy wrote:

On Thu, 2007-02-15 at 11:49 +0100, Pavan wrote:

Can anyone tell me what is the difference between sqlite and sqlite3.


Also:

"SQLite - an embedded database library"

"sqlite3 - a shell to allow command line access to SQLite"

Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Storing contacts list for each user

2007-02-15 Thread Martin Jenkins

Pavan wrote:

The idea is that at any point of time user1 should not access user2
details and vice-versa.


SQLite doesn't have a concept of access control so if you want to stop 
user1 from seeing user2's data then you'll either have to use a database 
that does provide access control or , as you suggest, provide a separate 
file for each user and control access via OS permissions. In  that case 
you needn't worry too much about normalising the data and you might even 
find that an SQL database is overkill.



Does it make sense conceptually and is it feasible technically ?
Only you can answer the former ;) If you need that access control and 
want to use SQLite then I guess separate files is as good as you'll get. 
You could provide your own access control mechanism to a single file but 
that'll be more work.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Storing contacts list for each user

2007-02-15 Thread Martin Jenkins

Pavan wrote:

Should i create different tables for each user, so hat at any point
of time only one users data will be accessed ? Should i store all the
information in one table and then acess it ?


The word you want is "normalisation" and you could have a look at, say,

http://www.devshed.com/c/a/MySQL/An-Introduction-to-Database-Normalization/

The URL suggests it's for MySQL but it's pretty generic stuff.

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-14 Thread Martin Jenkins

Martin Jenkins wrote:

I haven't tested the other versions of Tcl yet.


I have now. s/a/RDRW/ makes corrupt2.test work with  Tcl 8.4.9, 8.4.12, 
8.4.14 and 8.5a5 on recent versions of Debian/Ubuntu on sparc64 and x86.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-14 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

I get the same problem on OS-X.  But it appears to be a bug
in the older version of TCL you have installed, not in SQLite
itself.  Nothing to worry about.  Thanks for reporting it, though.


I was trying to make a test case to report the Tcl bug and noticed that 
(in 8.5a5 at least) they added some extra file mode tests. After looking 
at those tests I now think this is a bug in the SQLite test suite.


ISTM opening files in corrupt2-1.x with an 'a' flag writes all changes 
to the end, which is what I'm seeing. 'a' for append. I think the files 
should be opened with a 'RDWR' flag instead. Making that changes means 
the tests pass under Tcl 8.5a5 but I haven't tested the other versions 
of Tcl yet. I don't know why the test passed under Tcl8.4.9 either.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

> in the older version of TCL you have installed, not in SQLite

Hmm. It's definitely a Tcl bug, but I'm not convinced about it being in 
the older Tcl that I have - the SPARC machine that fails corrupt2.test 
has a newer version than the PC that passes.


[later]

I built tcl8.4.14 and tcl8.5a5 on both machines and the corrupt2.test 
fails identically under both versions. There were some new failures in 
8.5a5; a couple of printf.test tests fail because of a minor formatting 
mismatch and a tclsqlite.test fails because of a new error message.


I built tcl8.4.9 from source on both machines and all tests pass on both.

So, the failure is a regression in Tcl sometime between 8.4.9 and 
8.4.14. I'm going to wimp out and file a bug report rather than spend 
any more time pinning down the exact version.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

I get the same problem on OS-X.  But it appears to be a bug
in the older version of TCL you have installed, not in SQLite
It's definitely a bug in Tcl. I'll post the log for posterity and get a 
newer version.


[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "Hello SQLite" >  fred
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "Hello SQLite" >> fred
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "Hello SQLite" >> fred
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "Hello SQLite" >> fred
[EMAIL PROTECTED]:~/dev/sqlite/bld$ cat fred
Hello SQLite
Hello SQLite
Hello SQLite
Hello SQLite
[EMAIL PROTECTED]:~/dev/sqlite/bld$ cat tcl.test
source ../test/tester.tcl

do_test test_tcl {
 set f [open fred a]
 seek $f 8 start
 puts $f blah
 close $f
} {}
[EMAIL PROTECTED]:~/dev/sqlite/bld$ ./testfixture tcl.test
test_tcl... Ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ cat fred
Hello SQLite
Hello SQLite
Hello SQLite
Hello SQLite
blah

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

Martin Jenkins wrote:

corrupt2 tests fail on Solaris 9/Ultra5/csw tools
Test file is not actually corrupted (ie altered at all AFAICS)
Exact same failure on a fresh Debian 3.1r4 install too. All other tests 
passed OK.


[EMAIL PROTECTED]:~/dev/sqlite/bld$ uname -a
Linux ultra5b 2.4.27-3-sparc64 #1 Thu Sep 14 07:31:38 UTC 2006 sparc64 
GNU/Linux

[EMAIL PROTECTED]:~/dev/sqlite/bld$ ./testfixture ../test/corrupt2.test
corrupt2-1.1... Ok
corrupt2-1.2...
Expected: [1 {file is encrypted or is not a database}]
Got: [0 {table abc abc 2 {CREATE TABLE abc(a, b, c)}}]
corrupt2-1.3...
Expected: [1 {file is encrypted or is not a database}]
Got: [0 {table abc abc 2 {CREATE TABLE abc(a, b, c)}}]
corrupt2-1.4...
Expected: [1 {database disk image is malformed}]
Got: [0 {table abc abc 2 {CREATE TABLE abc(a, b, c)}}]
corrupt2-1.5...
Expected: [1 {database disk image is malformed}]
Got: [0 {table abc abc 2 {CREATE TABLE abc(a, b, c)}}]
Thread-specific data deallocated properly
4 errors out of 6 tests
Failures on these tests: corrupt2-1.2 corrupt2-1.3 corrupt2-1.4 corrupt2-1.5

The corruption tests do appear to work (where v3.2.1 does does not), so 
as I said earlier it appears the test harness is not actually corrupting 
the file. I checked the file contents (with a hex viewer) on S9 but 
didn't try manually corrupting it.


[EMAIL PROTECTED]:~/dev/sqlite/bld$ sqlite3 -version
3.2.1
[EMAIL PROTECTED]:~/dev/sqlite/bld$ ./sqlite3 -version
3.3.13

NB I don't exactly replicate the real tests below.

[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | sqlite3 
corrupt.db

ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | ./sqlite3 
corrupt.db

ok

[EMAIL PROTECTED]:~/dev/sqlite/bld$ cp test.db corrupt.db ; dd if=/dev/random 
of=corrupt.db bs=1 count=4 skip=8

4+0 records in
4+0 records out
4 bytes transferred in 0.001219 seconds (3281 bytes/sec)
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | sqlite3 
corrupt.db

ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | ./sqlite3 
corrupt.db

SQL error near line 1: file is encrypted or is not a database

[EMAIL PROTECTED]:~/dev/sqlite/bld$ cp test.db corrupt.db ; dd if=/dev/random 
of=corrupt.db bs=1 count=4 skip=100

4+0 records in
4+0 records out
4 bytes transferred in 0.001105 seconds (3620 bytes/sec)
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | sqlite3 
corrupt.db

ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | ./sqlite3 
corrupt.db

SQL error near line 1: file is encrypted or is not a database

[EMAIL PROTECTED]:~/dev/sqlite/bld$ cp test.db corrupt.db ; dd if=/dev/random 
of=corrupt.db bs=1 count=4 skip=200

4+0 records in
4+0 records out
4 bytes transferred in 0.001141 seconds (3506 bytes/sec)
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | sqlite3 
corrupt.db

ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | ./sqlite3 
corrupt.db

SQL error near line 1: file is encrypted or is not a database

Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

Martin Jenkins wrote:

Build fails on Solaris 9/Ultra5/csw tools
   Can't find 'ar' so substitutes and attempts to fun 'false'
   TMP FIX: AR=gar ../configure...
Forgot - fdatasync is in librt so most of the executables need $(TLIBS)  
added to the end of their recipe.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

Build fails on Solaris 9/Ultra5/csw tools
   Can't find 'ar' so substitutes and attempts to fun 'false'
   TMP FIX: AR=gar ../configure...

corrupt2 tests fail on Solaris 9/Ultra5/csw tools
Test file is not actually corrupted (ie altered at all AFAICS)

Not sure how many people (outside of Sun) are using sqlite3 on S9, but 
I'd fired the box up for something else so I thought I'd give it a go. 
The first is obviously down to the age and unmaintained status of the 
autoconf stuff, but the second...  :-/


Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Running out of disk space.

2007-02-09 Thread Martin Jenkins

Jeffrey Rennie wrote:

Debugging the code:

winWrite returns SQLITE_FULL, which propagates back up the stack to
vdbeaux.c, line 1270, in function sqlite3VdbeHalt(Vdbe *p):

  }else if( rc!=SQLITE_OK ){
 p->rc = rc;
 sqlite3RollbackAll(db);

Which is good, it's putting the SQLITE_FULL return code into p->rc and
rolling everything back.  Good.

But then the function returns SQLITE_OK on line 1337, so sqlite_step 
returns

SQLITE_DONE.

So indeed, when a COMMIT TRANSACTION fails because there isn't enough 
disk

space, sqlite_step returns SQLITE_DONE.

Is there a bug filed for this?  Has it been fixed in more recent 
releases?
I had an instance once where I filled a disk up and thought I'd lost 
some data, but because the testsuite has a disk full test I assumed it 
was a problem on my part. I can't remember if it was repeatable but I 
know I didn't look into it as the disk getting full in the first place 
was caused by a bug in my code.  ISTR one of the tests is skipped (or is 
it only in the full test?) because it takes ages to fill the disk up.  
Have/can you  run the suite on your "full" disk?


Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] x000 line queries - only for benchmarks?

2007-02-08 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

There is no problem running queries of whatever
length, so I could do benchmarks fine, it is just
that VBA has a problem with array elements holding
over 1823 characters.
  
OIC. Sorry, just pulled an all-nighter and misread your message. I don't 
do VB/VBA so wasn't sure what the problem was.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] x000 line queries - only for benchmarks?

2007-02-08 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

In my (commercial) app I regularly have queries with over 1000 characters.
Not over 1000 lines though.
As VBA (not sure now about VB6) has a problem with
array elements having over 1823 characters I had
to truncate my SQL logging routine.
  
Under 2k? That seems a bit restrictive. No benchmarking for you then, 
because the 25k line queries in the SQLite benchmark are nearly 2 meg. I 
guess they're unusual but even the (more typical?) 100 liners can get up 
to about 6-8k.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



  1   2   3   >