Re: [sqlite] FTS index size

2008-07-24 Thread Jiri Hajek
> So, indeed, there's room for improvement! Thanks for looking into it, I'm interested in your results. That said, I still believe that the best way would be to make the current FTS implementation independent of the VIRTUAL TABLE structure, but be able to accept more general structures, namely

Re: [sqlite] FTS index size

2008-07-23 Thread Jiri Hajek
> Again, you've given a relatively broad description of what you're > trying to do. I could make up a bunch of stuff and answer my own > question, but you'd probably rather than I considered the problem > _you_ are having. Ok, I'll try to be as specific as possible. The main table I have is (the

Re: [sqlite] FTS index size

2008-07-22 Thread Jiri Hajek
> It's hard to say - you might want to describe your tables and the join > by simply including the SQL itself, rather than a loose description of > it. It may be that there's a simple change which will clear things > up. Ok, what exactly I mean is a table containing tracks in an audio library,

[sqlite] FTS index size

2008-07-18 Thread Jiri Hajek
Hello, from what I have read about FTS3, it stores the original data as well as the index needed for fast full-text access. Therefore, in several posts here it was recommended to use two tables joined one-to-one in case it's needed to store both text data and some other, possibly numeric data.

[sqlite] Assertion failed - checkActiveVdbeCnt()

2008-04-10 Thread Jiri Hajek
Hi, one of our users have recently reported a failed assertion in checkActiveVdbeCnt(), i.e. on: assert( cnt==db->activeVdbeCnt ); Could any SQLite expert direct me to where should I search for source of this problem, please? Can it be a bug in SQLite? Or in our incorrect usage? In such a case,

Re: [sqlite] Possible UNICODE LIKE, upper(), lower() function solution

2008-01-04 Thread Jiri Hajek
Nice! I can imagine that this could be also used e.g. in FTS3, particularly unaccent() function could make searching for international users better. Thans for sharing your code, Jiri - To unsubscribe, send email to

Re: [sqlite] SQLite is in Android

2007-12-05 Thread Jiri Hajek
> http://www.sqlite.org/famous.html Btw, you write there: > There are unconfirmed reports on the internet that Apple also uses SQLite in > the iPhone and in the iPod touch. I'm pretty sure that SQLite is used there, I browsed my phone and saw several instances of SQLite there, I'd say that

[sqlite] FTS Usage

2007-11-29 Thread Jiri Hajek
Hello, I'm considering usage of FTS, but from the documentation it's a little unclear to me what's the recommended way of using it, particularly in the following scenario: Let's say that I already have some database structure containing several tables with mixes type of data (some string fields

[sqlite] TryEnterCriticalSection compilation

2007-10-04 Thread Jiri Hajek
Hi, I read the past thread on TryEnterCriticalSection() compilation. I wonder whether it couldn't be included in SQLite sources as follows: BOOL (WINAPI *TryEnterCriticalSection)( LPCRITICAL_SECTION lpCriticalSection ); SQLITE_API int sqlite3_mutex_try(sqlite3_mutex *p){ if

[sqlite] Threads in 3.5.0

2007-10-04 Thread Jiri Hajek
Hello, I was glad to read in http://sqlite.org/34to35.html document that: Restrictions on the use of the same database connection by multiple threads have been dropped. It is now safe for multiple threads to use the same database connection at the same time. I'd like if someone could clarify

[sqlite] SQL logic error or missing

2007-08-31 Thread Jiri Hajek
Hi, Some time ago I asked here about a strange and very rare SQLite DB problem that puzzles me, but unfortunatelly I got no answer. I'll try to describe it again and hopefully someone will be able to comment it... Very rarely (I have just 5 debug logs from all our beta testers) executing

[sqlite] Unknown SQLITE_ERROR problem

2007-08-15 Thread Jiri Hajek
Hi, Rarely (I have 4 debug logs from all our beta testers) executing 'COMMIT' statement returns SQLITE_ERROR + 'SQL logic error or missing database'. Analysis of the debug logs and source codes doesn't show any problem, there simply begins a transaction, some SQL statements are executed and

Re: [sqlite] Threading issues in SQLite

2007-08-11 Thread Jiri Hajek
After several experiments and tests, I ended up using one SQLite connection in several threads. This certainly doesn't currently work in SQLite natively, but if you properly use some locking mechanism (CriticalSections in my case), it works fine. Jiri

[sqlite] VACUUM problems

2007-08-03 Thread Jiri Hajek
Hello, I recently got some debug logs from my users that indicate problems with VACUUM command. The error message is: SQL logic error or missing database (1). This is using the latest SQLite (3.4.1) Windows DLL. I tried to rule out my coding mistakes, at the moment of the problem there is only

Re: [sqlite] Re: Unicode collation

2007-06-28 Thread Jiri Hajek
After reading some more it seems language and country tags alone aren't enough. Inside the same country, the same language and even the same culture, different orderings can be used depending on the ordering objective. As an example, there can be a specific order used in phone lists and other for

Re: [sqlite] Unicode collation

2007-06-28 Thread Jiri Hajek
My idea is to implement the UCA collation in SQLite (with the usual OMIT_* #ifdef's), using the DUCET table as base, and if people need the tailoring part for localized sorting, have it be optional by having a "sqlite_collation_data" table with the needed locale data included on the database.

Re: [sqlite] Unicode collation

2007-06-27 Thread Jiri Hajek
> Actually, reading one of the links you posted > (http://blogs.msdn.com/michkap/archive/2005/05/04/414520.aspx - > everybody please read it before continuing in discussion), I got (what > I think is a great) idea: Let's include version information about > collation algorithm we are using. So,

Re: [sqlite] Unicode collation

2007-06-27 Thread Jiri Hajek
After thinking a bit, it occurs to me that there's a compromise for the Unicode case that might be workable. The algorithm for collation is pretty stable, it's just the locale data that's the problem. If SQLite understands the algorithm, then locale data can go into special tables in the

Re: [sqlite] Re: Unicode collation

2007-06-27 Thread Jiri Hajek
Right now sqlite database files are portable across systems as-is. You're proposing they should need to be explicitly prepared for transport? Remember, the risk is silent data corruption. This is not a trivial matter. Well, I do understand that Unicode standard is quite a complicated thing,

Re: [sqlite] Re: Unicode collation

2007-06-27 Thread Jiri Hajek
Unfortunately, Unicode specifies no such thing. There is no such thing as _the_ Unicode collation, if only because collation rules depend on locale. Yes, what I mean is to define how individual locales are identified in SQLite, like that already suggested 'en_AU', 'tr_TR', etc.

Re: [sqlite] Unicode collation

2007-06-27 Thread Jiri Hajek
A moments reflection convinces me that this is not a good idea as stated. But perhaps it can be the seed for a idea that will actually work. Is there some way of adding customizations to the database file itself, or perhaps to a separate file in a standard place the SQLite always knows to look,

Re: [sqlite] Unicode collation

2007-06-25 Thread Jiri Hajek
So the choices seem to be: (1) Databases that corrupt if you move across platforms. (2) A 10MB database engine (3) Leave things as they are I prefer to go with (3) Yes, based on the facts I agree that (3) is the best way to go - a developer can decide whether to use Windows methods only,

Re: [sqlite] Unicode collation

2007-06-25 Thread Jiri Hajek
Ok, drh, could you share your thoughts about this. Could something like this, i.e. some kind of recommendation be created, so that all applications are consistent in Unicode support? Thanks, Jiri - To unsubscribe, send

Re: [sqlite] Unicode collation

2007-06-23 Thread Jiri Hajek
The reason is as you've surmised. Not all systems have full unicode support (I'm not sure, but if I had to guess, I would say very few systems do). Including an implementation with SQLite would bloat the library to at least several times it's current size. I know really well only Windows where

[sqlite] Unicode collation

2007-06-22 Thread Jiri Hajek
Hello, I wonder whether there are any plans to include internally proper Unicode comparisons? Don't get me wrong, I think that it's great that SQLite supports custom collations, there's absolutely no problem to handle it in internally for my database, but problem is that if I define UNICODE

Re: [sqlite] Equal distribution from random rows

2007-05-30 Thread Jiri Hajek
Is there a way I can modify my query to attain a much more equal distribution? It doesn't have to be perfect, but right now it is too noticiably weighted. What about this: SELECT * FROM Table LIMIT 1 OFFSET round((CAST(random(*) as float)/(9223372036854775807)+1)/2*(SELECT COUNT(*) FROM

[sqlite] Database disk image is malformed (11)

2007-05-23 Thread Jiri Hajek
Hello, bug reports from our users indicate that SQLite ocassionaly (or rather rarely) returns 'database disk image is malformed (11)' error. However, there doesn't seem to be any good reason for this behaviour, everything else seems to be fine. I have searched some older posts here and one user

Re: [sqlite] Re: Problem with Unicode surrogates

2007-05-22 Thread Jiri Hajek
Ok, I reviewed the sources (utf.c) and I'd say that it's still incorrect. Actually, it doesn't test for surrogates at all, the problem I was experiencing was caused by the fact that SQLite reads unallocated memory when there's an unpaired surrogate present as the last character of string - see

Re: [sqlite] Re: Problem with Unicode surrogates

2007-05-17 Thread Jiri Hajek
> Re. that 0xE000 character, should I submit a bugreport somewhere? You already did. Thanks. http://www.sqlite.org/cvstrac/chngview?cn=4017 Ok, I reviewed the sources (utf.c) and I'd say that it's still incorrect. Actually, it doesn't test for surrogates at all, the problem I was

Re: [sqlite] Re: Problem with Unicode surrogates

2007-05-17 Thread Jiri Hajek
The Unicode standard is beside the point. There is lots of code that does not handle charsets and encodings correctly, which can open vulnerabilities to metacharacter injection. (Examples of this class of problem are SQL injection, XSS and format string exploits.) I can't agree. SQLite itself

Re: [sqlite] One more SQLite threading question

2007-05-17 Thread Jiri Hajek
This almost immediately raises "library routine called out of sequence". It occurs as soon as the processing of A and B overlap, that means A is preparing statement #2 while B is still executing #1. Have you tried using Mutex or some other way to prevevent really simultaneous calling of SQLite

Re: [sqlite] Problem with Unicode surrogates

2007-05-16 Thread Jiri Hajek
> What I would propose is to be more robust in handling such incorrect Unicode > strings, so that application can e.g. insert really any string, not only > those that comply Unicode standards. > Doing this can potentially lead to security exploits in programs that use SQLite. If you want to

[sqlite] One more SQLite threading question

2007-05-14 Thread Jiri Hajek
Hello, I have tried to search all the documentation about threading in SQLite, but I'm still somewhat confused. It's often suggested to create a pool of sqlite3 structures, but what if I would like to have only only sqlite3 connection and serialize all the DB operations to one thread (name it

[sqlite] Problem with Unicode surrogates

2007-05-12 Thread Jiri Hajek
Hello, what I describe below probably can't be called a SQLite bug, but in my opinion it could be fixed in SQLite anyway. The problem happens on Windows platform when using Sqlite3_Prepare16(), i.e. function accepting Unicode strings in UTF-16 encoding. When I for example perform a query:

RE: [sqlite] Problems with multiple threads?

2006-06-07 Thread Jiri Hajek
> If it is inconvenient to rollback and retry the entire transaction, then start the transaction initially with BEGIN EXCLUSIVE. > This will acquire the reserved lock immediately (instead of waiting to the first write occurs) and so you will either get an > SQLITE_BUSY right away (when it is a

RE: [sqlite] Problems with multiple threads?

2006-06-07 Thread Jiri Hajek
Thanks for an additional explanation, I used sqlite3_get_autocommit() for debugging and it helped me to find out that it really was my fault. There was an incorrect processing after COMMIT returned SQLITE_BUSY. So sorry for this. However, right after fixing this, I found another problem. It

[sqlite] Problems with multiple threads?

2006-06-06 Thread Jiri Hajek
Hello, I'm trying to use SQLite in an application where it's needed to work with one database in mutliple threads. Based on all the info I read in SQLite documentation I create a new database connection for every new thread created. Each thread does some SELECTs, INSERTs or UPDATEs, but there