Re: [sqlite] Access violation at address 6090B662 in module 'sqlite3.dll'. Read of address DE8D6B84

2011-04-06 Thread Pavel Ivanov
any idea ? Your application have race conditions and corrupts memory. Pavel On Wed, Apr 6, 2011 at 2:36 PM, Vander Clock Stephane svandercl...@yahoo.fr wrote: hello, in heavy multithread environnmeent we receive (one time a month, so not very often), this error : Access violation at

Re: [sqlite] Request for an example code use async IO

2011-04-05 Thread Pavel Ivanov
:  - sqlite3async_run() Pavel On Tue, Apr 5, 2011 at 1:45 PM, Ricky Huang rhhu...@soe.ucsd.edu wrote: On Apr 4, 2011, at 7:10 PM, Pavel Ivanov wrote: Can someone be so kind as to provide a short example of initializing asynchronous module, opening DB for read/write, create a table, and write some data

Re: [sqlite] Build instructions for Winodws with unicode support

2011-04-04 Thread Pavel Ivanov
I can create the dll, but it does not work with BLOB data type. It works with other data types. The dll that I downloaded from the sqlite.org website works with BLOB data type. Any help would be appreciated. Any pointers on what doesn't work for you and how it works instead of intended

Re: [sqlite] Build instructions for Winodws with unicode support

2011-04-04 Thread Pavel Ivanov
, and null is being written to that column. When I build my application on linux, everything works just fine. But, on windows, it works fine the downloaded sqlite dll but not with my own dll. Pavel Ivanov-2 wrote: I can create the dll, but it does not work with BLOB data type. It works

Re: [sqlite] Request for an example code use async IO

2011-04-04 Thread Pavel Ivanov
Can someone be so kind as to provide a short example of initializing asynchronous module, opening DB for read/write, create a table, and write some data to it? There's nothing special in opening db, creating table or writing data into it while using async module. You should use the same API

Re: [sqlite] updating records in table A from joined records in table B

2011-04-01 Thread Pavel Ivanov
... that is to say, update table_a.value from table_b.value, but only on rows where table_a.key = table_b.key update table_a set value = (select table_b.value from table_b where table_b.key = table_a.key) Pavel On Fri, Apr 1, 2011 at 8:42 PM, Robert Poor rdp...@gmail.com wrote: I'd like to

Re: [sqlite] sqlite3_step() error and constraints

2011-03-31 Thread Pavel Ivanov
http://sqlite.org/c3ref/step.html . See Goofy Interface Alert section at the bottom. I believe it was changed with recent versions of SQLite. Is call to sqlite3_extended_result_codes (http://www.sqlite.org/c3ref/extended_result_codes.html) not needed anymore? Pavel On Thu, Mar 31, 2011 at

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Pavel Ivanov
Yes, but I can not affect column type ... FreePascal SQLite3 connector must be able to work with any user database. If your goal is to work with any user database created outside of your FreePascal connector then chances are that user will use the same database outside of your FreePascal

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-22 Thread Pavel Ivanov
Is there way how to store numeric values, which are out of REAL range ? SQLite has no way of storing numbers other than REAL or INTEGER. If you want the exact number to be stored your only option is to store it as TEXT (and don't work with it as a number on SQL level). Pavel On Tue, Mar 22,

Re: [sqlite] Create table if not exists and insert seed data

2011-03-22 Thread Pavel Ivanov
You can use a simple CREATE TABLE (without IF NOT EXISTS clause). If it succeeds then you populate table with data (remember to do that in the same transaction where you created the table). If CREATE TABLE fails then you don't insert your data. Pavel On Mon, Mar 21, 2011 at 6:04 PM, Erich93063

Re: [sqlite] SQLite.so dynamic library-linux

2011-03-18 Thread Pavel Ivanov
What's wrong with compiling SQLite library by yourself with all parameters you need? Why do you need cross-compiler for that? What's wrong with compiler on your linux box? Pavel On Fri, Mar 18, 2011 at 10:54 AM, Udon Shaun udon_sh...@yahoo.com wrote: Hi Peeps. I've noticed that the SQLite site

Re: [sqlite] SQLite.so dynamic library-linux

2011-03-18 Thread Pavel Ivanov
Oh, and BTW, reply to the whole list, not to me only, please. Pavel On Fri, Mar 18, 2011 at 9:41 PM, Pavel Ivanov paiva...@gmail.com wrote: I still don't understand what you do. If you don't have Linux, you don't compile on Linux and you don't test on Linux then why do you need library

Re: [sqlite] Only select most recent results takes longer

2011-03-15 Thread Pavel Ivanov
My tests show that, counter-intuitively, the second query takes between 3 and 5 times as long as the first query. This seems weird to me - any ideas why this would be? What does EXPLAIN QUERY PLAN for both queries say? And what SQLite version do you use? Also do you understand that '?'

Re: [sqlite] X most recent entries

2011-03-14 Thread Pavel Ivanov
Try this one: select * from (select * from multiturnTable order by rowid desc limit 5000) where (player1 = ? or player2 = ?) and (complete=0 or p1SubmitScore=0 or p2SubmitScore=0) Pavel On Mon, Mar 14, 2011 at 1:58 PM, Ian Hardingham i...@omroth.com wrote: Ah, sorry about this - my query is

Re: [sqlite] [sqlite-dev] Amalgamation code doesn't supoort limit on update / delete

2011-03-13 Thread Pavel Ivanov
http://lmgtfy.com/?q=SQLITE_ENABLE_UPDATE_DELETE_LIMIT+site%3Asqlite.orgl=1 If you look for description of SQLITE_ENABLE_UPDATE_DELETE_LIMIT on the resulting page you'll see that it's not a bug or oversight, it's a documented feature. Pavel On Sun, Mar 13, 2011 at 2:46 PM, Steven Hartland

Re: [sqlite] memory usage after VACUUM

2011-03-09 Thread Pavel Ivanov
Is there any sqlite function I can call, or some other technique, to reduce the memory allocated and hung-onto by sqlite, particularly during a VACUUM? Yes, execute pragma cache_size = 100 for example, or put other number of your liking into there. If closing and re-opening of the database

Re: [sqlite] Bug: rtree2 tests fail due to incorrect format string in rtree.c

2011-03-03 Thread Pavel Ivanov
 A favorite interview question is, given this line and no other  information, how big must buf_size be to never clip the output?  You can assume the default 1.6 precision (%1.6f).    snprintf( buf, buf_size, %f, v );  The answer?  At least 318 characters. This is very interesting. Jay, could

Re: [sqlite] Bug: rtree2 tests fail due to incorrect format string in rtree.c

2011-03-03 Thread Pavel Ivanov
PM, Jay A. Kreibich j...@kreibi.ch wrote: On Thu, Mar 03, 2011 at 11:06:33AM -0500, Pavel Ivanov scratched on the wall: ?A favorite interview question is, given this line and no other ?information, how big must buf_size be to never clip the output? ?You can assume the default 1.6 precision

Re: [sqlite] (How) can I test for an open transaction?

2011-03-02 Thread Pavel Ivanov
I believe sqlite3_get_autocommit is what you need: http://www.sqlite.org/c3ref/get_autocommit.html. Pavel On Wed, Mar 2, 2011 at 12:32 PM, Philip Graham Willoughby phil.willoug...@strawberrycat.com wrote: Hi all, I use SQLite in an iPhone application, and for my own convenience I have

Re: [sqlite] sqlite3_prepare_v2 and std::string using SQLite 3.7.5 - BUG or me?

2011-03-01 Thread Pavel Ivanov
Your examples suggest that actually sqlite3-bind_text is not accepting std::string, not sqlite3_prepare_v2. But how exactly it doesn't accept? You pass SQLITE_STATIC as 5th parameter there; are you sure you don't destroy or change your strings before statement is executed? Pavel On Tue, Mar 1,

Re: [sqlite] EXT :Re: long insert statement failing on iPhone

2011-03-01 Thread Pavel Ivanov
       i also took the same statement and tried to run it in our app in a method called as soon as the application launches, and it fails.  so we have something going on at a different level. I suspect that as soon as the application launches means that no parallel threads are working yet

Re: [sqlite] Re ad Lock not released..

2011-03-01 Thread Pavel Ivanov
From my debugging efforts, the issue appears to be that the process entered the sqlite library at some point in its operation, acquired a read lock, and returned from the library, but failed to release the read lock. Under what circumstances can this occur? This is a normal behavior for

Re: [sqlite] Parallel execution of queries in threads

2011-02-24 Thread Pavel Ivanov
The reason could be caching, swapping or things like that. When you execute 4 queries concurrently in different connections each of them have to create its own memory cache of database pages. Reading data into cache involves syscalls to Linux kernel for reading from disk. Although Linux has its

Re: [sqlite] [sqlite-dev] what's the wrong with my update function

2011-02-22 Thread Pavel Ivanov
There are several problems: 1) You wrote to the wrong list. sqlite-dev is for those who develop SQLite, sqlite-users is for those who develop using SQLite. 2) You didn't say what problem you have with that piece of code. 3) You didn't call sqlite3_step() after sqlite3_bind_text() to actually

Re: [sqlite] Auto-grow setting?

2011-02-22 Thread Pavel Ivanov
Is SQLITE_FCNTL_CHUNK_SIZE what you are looking for? See more information about it here: http://www.sqlite.org/c3ref/c_fcntl_chunk_size.html. Notice that this feature appeared only in recent version of SQLite, so if you have some earlier version you won't be able to control it and SQLite will

Re: [sqlite] [sqlite-dev] what's the wrong with my update function

2011-02-22 Thread Pavel Ivanov
sending , my problem is that  No update happened , I also I read about sql_step , but I couldn't understand how to apply it , they said you should run it several times Best regards On Tue, Feb 22, 2011 at 3:24 PM, Pavel Ivanov paiva...@gmail.com wrote: There are several problems: 1) You wrote

Re: [sqlite] Auto-grow setting?

2011-02-22 Thread Pavel Ivanov
Please reply to the list, not to me only. It's impossible to set chunk size to percentage of the database size, you can only set a constant value. Pavel On Tue, Feb 22, 2011 at 9:13 AM, Sven L larvpo...@hotmail.se wrote: Thanks a lot! :D What do you think of setting the chunk size to

Re: [sqlite] Auto-grow setting?

2011-02-22 Thread Pavel Ivanov
I don't know what's the best value for chunk size. I'm not even sure that it's useful to set it to any value at all. So let your test results guide you. The only thought I have is the chunk size should be a multiple of page size (don't know if SQLite's code rounds up to such multiple internally).

Re: [sqlite] oracle compatibility mode

2011-02-22 Thread Pavel Ivanov
Could you please explain what is Oracle compatibility mode? And how can anyone make an attempt to use it for SQLite if SQLite doesn't have such feature? Pavel On Tue, Feb 22, 2011 at 9:28 PM, Phil Oertel philli...@gmail.com wrote: Hi sqliters, After a recent failed attempt to use SQLite as

Re: [sqlite] process monitor: wal file access

2011-02-21 Thread Pavel Ivanov
I find especially the *-wal access attempt pretty strange as we do not have WAL enabled for our database: it is set to the default journal mode (DELETE). Is this normal behaviour? Or is this influenced by some setting I don't know of? I think when SQLite opens the database it can't trust

Re: [sqlite] apostrophes in strings...

2011-02-20 Thread Pavel Ivanov
I believe doubling the single quote inside the string literal should help. Pavel On Sun, Feb 20, 2011 at 2:23 PM, Sam Carleton scarle...@miltonstreet.com wrote: This is a bit crazy and I know the ideal way would be to not allow the apostrophy in the first place but, my focus is easy of use

Re: [sqlite] How to use sqlite and pthread together?

2011-02-19 Thread Pavel Ivanov
Nico, it looks like your don't understand what you are saying. Windows and Unix processes and threads have similar semantics, and thus roughly comparable performance envelopes. Windows processes and threads don't have similar semantics, unix processes (and threads) are not comparable to

Re: [sqlite] How to use sqlite and pthread together?

2011-02-19 Thread Pavel Ivanov
/HOWTO/Secure-Programs-HOWTO/avoid-vfork.html. Pavel On Sat, Feb 19, 2011 at 4:42 PM, Nico Williams n...@cryptonector.com wrote: On Sat, Feb 19, 2011 at 1:45 PM, Pavel Ivanov paiva...@gmail.com wrote: Nico, it looks like your don't understand what you are saying. I think you misunderstood what I

Re: [sqlite] pragma omit_readlock

2011-02-17 Thread Pavel Ivanov
I'd appreciate it if anyone could let me know if this pragma still works and how to use it if so. You can get away without pragma. Just implement your own VFS which will redirect all calls except lock-related to the standard VFS. Lock-related methods would be implemented as no-op and thus won't

Re: [sqlite] UPDATE/INSERTing 1-2k rows slower than expected

2011-02-14 Thread Pavel Ivanov
So my question is, does it maintain the other 3 parts of ACID, so that the database will never be in a corrupted state after a power loss, even though it may be missing some writes that were confirmed? Jim, I think the answer to your question is already in Max's tests: the USB drive is

Re: [sqlite] Question about having 2 db connections on same thread

2011-02-13 Thread Pavel Ivanov
I do a transaction on connection 1 using BEGIN IMMEDIATE, some rows updated, COMMIT. Then, when I attempt same sequence on connection 2, when I do first call to step to execute begin transaction and it never returns. Do you check result code from COMMIT and is it successful? My guess is you

Re: [sqlite] wal and shm files

2011-02-12 Thread Pavel Ivanov
Just wondering, are the wal and shm files suppose to stick around after the process exits? They should disappear when you call sqlite3_close() for the last handle. And if your process exits without calling sqlite3_close() then those files are supposed to stick around. Pavel

Re: [sqlite] BUG (3.7.5): identifier quotation characters get part of column names for certain statements

2011-02-10 Thread Pavel Ivanov
       select [a] from (select * from x); You'll get the following buggy output:        [a]        1 It's not buggy. Name of the column in result set is not defined unless you use as.        CREATE TABLE y([a] INT); I came across this issue as statements like the following failed with the

Re: [sqlite] SIGSEGV Error when using sqlite3_exec( )

2011-02-10 Thread Pavel Ivanov
Zaryab, There's no need to repeat your email several times.    Question1:  Can I have multiple connections opened for each thread to    the same in-memory dbase. No. Each connection to :memory: creates unique in-memory database which will be deleted when that connection is closed.    

Re: [sqlite] BUG (3.7.5): identifier quotation characters get part of column names for certain statements

2011-02-10 Thread Pavel Ivanov
x);        select a a from (select a from x); I consider this a bug. Bye. -- Reinhard Nißl -Ursprüngliche Nachricht- Von: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] Im Auftrag von Pavel Ivanov Gesendet: Donnerstag, 10. Februar 2011 13:48

Re: [sqlite] SIGSEGV Error when using sqlite3_exec( )

2011-02-10 Thread Pavel Ivanov
, Zaryab M. Munir zaryabmu...@yahoo.com wrote: Thanks,  my reply inline: Sincerely, Zaryab --- On Thu, 2/10/11, Pavel Ivanov paiva...@gmail.com wrote: From: Pavel Ivanov paiva...@gmail.com Subject: Re: [sqlite] SIGSEGV Error when using sqlite3_exec( ) To: General Discussion of SQLite Database

Re: [sqlite] sqlite async

2011-02-09 Thread Pavel Ivanov
but I am wondering if there is any (somewhat) easy way to get direct fd access and maintain asyncronicity without threads. How do you see it's possible? Even if we assume that all files were opened in async mode and only aio functions were used what would that mean? You are calling

Re: [sqlite] EXT : Speed up count(distinct col)

2011-02-07 Thread Pavel Ivanov
Mabye one of our experts can explain why distinct takes to long. Seems to me if you have an index you're just returning the values in the index, aren't you? If index is unique then you just count number of values in the index and that's it. If index is not unique then it contains many

Re: [sqlite] threads and transactions

2011-02-06 Thread Pavel Ivanov
i'm not sure at all it's practical to create an 80MB string with one giant SQL statement in it to send all that data at once. 80MB string is not too bad after all (probably even less than 1% of the whole memory). So you better do it this way. BTW, it won't be one SQL statement, it will be 40k

Re: [sqlite] threads and transactions

2011-02-05 Thread Pavel Ivanov
presuming this timeline is chronological, may i assume that step 4 is committed first in the database? You mean as a third transaction? No. and that steps 5 and 6 operate independently? No. even when threads 1 and 2 open their individual transactions, i see only ONE journal file

Re: [sqlite] threads and transactions

2011-02-05 Thread Pavel Ivanov
i understand that one commit will block all other threads from doing a commit, rollback or any atomic transaction, until it's done, but are you saying i can't even add data on another thread while one has an open transaction? There can be several simultaneous read-only transactions. But as

Re: [sqlite] SQLite3 and threading

2011-02-04 Thread Pavel Ivanov
. And it had no problems. IIRC, there were examples of such behavior on this list too, also no problems were reported. So maybe this is really old stuff. Pavel On Thu, Feb 3, 2011 at 1:59 PM, Ulrich Telle ulrich.te...@gmx.de wrote: Am 03.02.2011 15:53, schrieb Pavel Ivanov: It seems

Re: [sqlite] SQLite3 and threading

2011-02-03 Thread Pavel Ivanov
What problems did you meet when you tried to do what you want? Pavel On Thu, Feb 3, 2011 at 4:39 AM, Stefano Mtangoo mwinjili...@gmail.com wrote: Hi, I use SQLite3 with wxSQLite3 wrapper and all is fine until I wanted to shift the DB thing into the secondary thread. What I want to do is

Re: [sqlite] SQLite3 and threading

2011-02-03 Thread Pavel Ivanov
result in problems. --- So what advice do you give me in such need that are thread safe? Any other approach? On 02/03/2011 03:09 PM, Pavel Ivanov wrote: What problems did you meet when you tried to do what you want? Pavel On Thu, Feb 3, 2011 at 4:39 AM

Re: [sqlite] Attach to file in same directory

2011-02-03 Thread Pavel Ivanov
Instead use operating system commands to retrieve the full path to the first file, then construct a full path to the second file. But if a I have an arbitrary SQL script/procedure to perform, that starts with an attach statement, I don't have creation control over the path specified in

Re: [sqlite] Will opening database in ReadOnly mode result in better query time

2011-02-02 Thread Pavel Ivanov
Thanks. I understand this. But my file will be on a read-only medium. So no other connection opening for writing is not possible. SQLite doesn't know if media is read-only, or is not accessible for writing for current user, or whatever else. So sorry, locks will persist and no speed-up for

Re: [sqlite] Deleting the sqlite journal file?

2011-01-21 Thread Pavel Ivanov
       (1) Is there any API I can/should use to predictably get the name of the journal file so that I can delete it, without knowing what is should be? Suffix -journal is hardcoded and won't change in the future to keep compatibility (journals left by any previous version should be read by

Re: [sqlite] Segfault from command-line app

2011-01-14 Thread Pavel Ivanov
AFAIK, this was fixed in versions after 3.6.23. See http://www.sqlite.org/src/info/f3162063fd and http://www.mail-archive.com/sqlite-users@sqlite.org/msg51588.html. Pavel On Fri, Jan 14, 2011 at 9:48 AM, Simon Slavin slav...@bigfraud.org wrote: I've never seen this before.  In my application I

Re: [sqlite] Committing to a savepoint

2011-01-14 Thread Pavel Ivanov
There are some challenges, for example to allow arbitrary undo operations we should also log transaction boundaries since undoing to some points in between not only makes little sense, but also dangerous. But I think if implemented with those challenges solved, such implementation would help

Re: [sqlite] Committing to a savepoint

2011-01-14 Thread Pavel Ivanov
On Fri, Jan 14, 2011 at 1:31 PM, Max Vlasov max.vla...@gmail.com wrote: On Fri, Jan 14, 2011 at 8:55 PM, Pavel Ivanov paiva...@gmail.com wrote: There are some challenges, for example to allow arbitrary undo operations we should also log transaction boundaries since undoing to some points

Re: [sqlite] How SQLite manages result of a SELECT query?

2011-01-13 Thread Pavel Ivanov
When we do execQuery: 1. Does sqlite fetches complete result of query and keep it in separate memory 2. OR Does sqlite fetches result of query in chunks, when we use sqlite3_step and keep it in separate memory 3. OR Does sqlite fetches records one by one, when we use sqlite3_step Number 3

Re: [sqlite] Committing to a savepoint

2011-01-13 Thread Pavel Ivanov
Is there a way to do this today? How hard would it be to add commit to savepoint if not? It's impossible to do the thing you want in SQLite. And it won't be feasible to add that. What you really want is for database engine to allow to have two parallel writing transactions and for it to not

Re: [sqlite] how to put the database in cache without waiting the system do it by himself ?

2011-01-13 Thread Pavel Ivanov
so i guess it's because the windows cache in memory the database file ? If you launch your application again then yes it's OS disk cache. If you execute same query later in your application without stopping it and maybe even without closing connection to SQLite database then it could be SQLite's

Re: [sqlite] TRIGGER and locking

2010-12-21 Thread Pavel Ivanov
For example: the INSERT inserts a row into table and invokes registered ON INSERT (AFTER) trigger.Would the state of database lock be RESERVED (presuming there is space in cache)? Trigger is always executed inside the same transaction as the statement causing trigger to execute. So, yes the

Re: [sqlite] Strange database disk image is malformed problems

2010-12-20 Thread Pavel Ivanov
Can you tell us what is producing that log text you found ? I am developing network appliances using EZchip network processors and for implementing some backend code I recently switched to SQLite. Mmm.  Well, it could be overwriting some of your memory, or overwriting the filespace.  My bet

Re: [sqlite] Troubleshooting...

2010-12-20 Thread Pavel Ivanov
You may probably already know this but maybe I'll remind you.  The pointer returned by c_str() is only valid in the statement where it is used or possibly as long as the life of the basic_stringchar it came from. Good catch, Jeff! I thought it's so obvious that I didn't even consider that as

Re: [sqlite] Strange database disk image is malformed problems

2010-12-20 Thread Pavel Ivanov
:36 Pavel Ivanov said the following: Can you tell us what is producing that log text you found ? I am developing network appliances using EZchip network processors and for implementing some backend code I recently switched to SQLite. Mmm.  Well, it could be overwriting some of your memory

Re: [sqlite] Troubleshooting...

2010-12-18 Thread Pavel Ivanov
] On Behalf Of Pavel Ivanov Sent: Friday, December 17, 2010 4:44 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... So you can see that when I add the hard-coded data, everything looks fine in the results of the select statement, which leads me to believe

Re: [sqlite] Troubleshooting...

2010-12-17 Thread Pavel Ivanov
, john darnell john.darn...@walsworth.com wrote: -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Thursday, December 16, 2010 2:53 PM To: General Discussion of SQLite Database Subject: Re: [sqlite

Re: [sqlite] Troubleshooting...

2010-12-17 Thread Pavel Ivanov
and UTF16 output. Does SQLite3 have problems dealing with basic_strings? R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Friday, December 17, 2010 9:22 AM To: General Discussion of SQLite

Re: [sqlite] UTF-8

2010-12-16 Thread Pavel Ivanov
std::string strText = GetWindowsTitle(...); the GetWindowsTitle occupied sometime with the umlaut. so how will you do, if you want save std::string into sqlite with keeped umlaut? My bet would be that GetWindowsTitle (even if it's not GetWindowTitle from Win32 API) returns string to you in

Re: [sqlite] Troubleshooting...

2010-12-16 Thread Pavel Ivanov
Once I bind the data to the Insert statement, how can I look at the final statement to see what I have done wrong when the statement does not work? There's no way to do that. You should print what you bind yourself. For me it looks like you insert into database some UTF-8 string and then try

Re: [sqlite] SQL query on sort order

2010-12-15 Thread Pavel Ivanov
: Hello Pavel, Thanks. The substr() compares the first character only. For example, if the data is [CAT=$, CAT1$], it has to be sorted as [CAT1$, CAT=$] because when '=' and '1' are compared, '1' has to come first. Thanks for any suggestions. -Harish Pavel Ivanov-2 wrote: If you want to do

Re: [sqlite] SQL query on sort order

2010-12-14 Thread Pavel Ivanov
If you want to do that completely in SQL without using collations you can do something like this: select name, case when substr(name, 1, 1) between 'A' and 'Z' or substr(name, 1, 1) between 'a' and 'z' then upper(name) when susbtr(name, 1, 1) between '0' and '9' then '|' ||

Re: [sqlite] Low-load methods of finding previous or next row

2010-12-14 Thread Pavel Ivanov
Given that even with LIMIT 2, the entire table's data might be read into memory, what's the fastest/lightest method of finding the id of the next (or previous) record ? I believe your conclusion here is slightly wrong. SQLite reads whole table into memory and processes all rows only if it

Re: [sqlite] Low-load methods of finding previous or next row

2010-12-14 Thread Pavel Ivanov
To use OFFSET ... LIMIT ... you need to know row number, not the id of a particular row. And in this case SQLite indeed must scan all records up to a requested one. Pavel On Tue, Dec 14, 2010 at 12:35 PM, Simon Slavin slav...@bigfraud.org wrote: On 14 Dec 2010, at 5:22pm, Pavel Ivanov wrote

Re: [sqlite] new user

2010-12-13 Thread Pavel Ivanov
I couldn't understand, development environment is 32-bit version. However, production environment is 64-bit version. Do you by any chance try to use the same sqlite3 library from both environments? 64-bit applications cannot load 32-bit dlls into them. So you need to compile a 64-bit version of

Re: [sqlite] WAL index in memory - multiple connections

2010-12-10 Thread Pavel Ivanov
Given that the WAL index is mmap'ed, you're unlikely to see improvement in performance by storing it in heap memory. Reads/writes will go at main memory speeds once mapped into your address space, and under memory pressure, it will be no slower than if the heap was pushed to the swapfile.

Re: [sqlite] Optimizers :memory: mode

2010-12-10 Thread Pavel Ivanov
I'd like to know if there are differences between the optimizers in the sqlite in-memory DB and on disk DB. No, there's only one optimizer in SQLite. Is there a way to narrow down the measurement of time to see where the time is spent? How do you want to narrow it down? Maybe you want to

Re: [sqlite] WAL index in memory - multiple connections

2010-12-10 Thread Pavel Ivanov
On Fri, Dec 10, 2010 at 10:05 AM, Christian Smith csm...@thewrongchristian.org.uk wrote: On Fri, Dec 10, 2010 at 09:49:46AM -0500, Pavel Ivanov wrote: Given that the WAL index is mmap'ed, you're unlikely to see improvement in performance by storing it in heap memory. Reads/writes will go at main

Re: [sqlite] How to optimize this simple select query ?

2010-12-10 Thread Pavel Ivanov
Did you try a compound index? Given WHERE conditions wouldn't have any benefit from compound index - only first column will be used anyway. Pavel On Fri, Dec 10, 2010 at 10:11 AM, Jim Morris jmor...@bearriver.com wrote: Did you try a compound index?

Re: [sqlite] How to optimize this simple select query ?

2010-12-10 Thread Pavel Ivanov
it's sad that this simple select is not possible under sqlite3 :( This query is not so simple as you think, it requires pretty complicated advanced techniques to be executed differently than SQLite executes it. And even using those techniques you are not guaranteed to have good performance - it

Re: [sqlite] How Execute Joint Queries In Sqlite?

2010-12-07 Thread Pavel Ivanov
I Writed A FULL OUTER JOIN Query In Sqlite But I Got A Message Like Not Supported. What Should I Do To Do This You should re-think once more: do you really need a full outer join? Maybe you can change your schema so that it was more clear and didn't require full outer join for querying. Pavel

Re: [sqlite] WAL file size

2010-12-02 Thread Pavel Ivanov
'));     }     sql_exec(conn, END TRANSACTION);     sql_exec(conn, PRAGMA wal_checkpoint);     sqlite3_close(conn);     return 0; } On 29/11/2010 5:13 PM, Pavel Ivanov wrote: Well, I love sqlite, and I want to continue using it (small, fast, reliable ...). I think it is better to solve such problems inside

Re: [sqlite] Transactions while using prepare and step

2010-12-02 Thread Pavel Ivanov
Makes no difference.  Doing an UPDATE inside your SELECT violates the rule no matter how you structure your transaction.  A SELECT is a single operation and you can't do anything else until it is finished. I didn't see in OP's email any information on whether he updates the same rows or same

Re: [sqlite] Transactions while using prepare and step

2010-12-02 Thread Pavel Ivanov
Another question - What kind of impact does a limit clause have? The columns being used in the where clause are indexed. My current design is bad, I am forced to use limit to get one row at a time. Since I have an index the impact should be minimal. Please let me know if I am wrong. You

Re: [sqlite] cost of sqlite3_open

2010-11-30 Thread Pavel Ivanov
1) How expensive is a call to sqlite3_open. Does a call to sqlite3_enable_shared_cache make it cheaper? Its cost depends on the size of your schema as it gets parsed during open. Shared cache doesn't make it cheaper. It can make somewhat cheaper (in some cases) to use several connections to

Re: [sqlite] cost of sqlite3_open

2010-11-30 Thread Pavel Ivanov
1) How expensive is a call to sqlite3_open. Does a call to sqlite3_enable_shared_cache make it cheaper? Its cost depends on the size of your schema as it gets parsed during open. Isn't this contradictory with an answer by Igor made in a recent thread? It's not contradictory. I say that real

Re: [sqlite] WAL file size

2010-11-29 Thread Pavel Ivanov
Well, I love sqlite, and I want to continue using it (small, fast, reliable ...). I think it is better to solve such problems inside sqlite It's impossible. Just try to design the solution you want. Think of how SQLite should behave to make you happy, think of it with all details and don't

Re: [sqlite] WAL file size

2010-11-25 Thread Pavel Ivanov
So, if you have a large scale system, you have two choices: block during the checkpoint, or suffer from huge WAL file (and a crash if the file is too big). For a large scale system you have a third choice: use some other RDBMS which is implemented in one process and has a much better control

Re: [sqlite] UPDATE during SELECT

2010-11-23 Thread Pavel Ivanov
Could there be any other consequences like unpredictable behavior and such? Yes, it will be unpredictable and undefined behavior. I can't say exactly how SQLite will behave in such situation. What I know is it doesn't execute all select at once, it fetches row by row on each sqlite3_step call

Re: [sqlite] filling an in-memory database from a byte stream?

2010-11-22 Thread Pavel Ivanov
Would it be possible to create an in-memory database and fill it from a byte stream or a file? If your Java driver allows you to attach your own VFS (Virtual File System) then you can achieve your goal using it. Otherwise there's no way to do that. Pavel On Mon, Nov 22, 2010 at 9:42 AM,

Re: [sqlite] how can I use a larger cache ? Application Defined Page Cache. ??

2010-11-22 Thread Pavel Ivanov
I do not set anything for the application defined page cache, so what is the behavior of the default one? Default implementation of page cache uses all the size you said it to use and in some cases even more. So don't worry about that. Just remember that cache_size is not a global setting, it's

Re: [sqlite] page cache vs OS cache

2010-11-20 Thread Pavel Ivanov
I'd say the performance of a local in-process cache can be comparable with performance of OS cache only in one case: if your process is the only process in the system and no other files are read from disk. In all other (common) cases OS caches much larger set of data than is used by SQLite and

Re: [sqlite] UPDATE during SELECT

2010-11-19 Thread Pavel Ivanov
for value in SELECT main_column IN mytable:   UPDATE mytable SET other_column='foobar' WHERE main_column=value Exactly this sequence is safe. Things can go nuts in case if you have index on other_column and you do something like this: for value in SELECT main_column IN mytable WHERE

Re: [sqlite] When is corruption acceptable?

2010-11-19 Thread Pavel Ivanov
       1. When is it acceptable for sqlite to leave a corrupt database that can't be used? It's never acceptable. SQLite specifically written and tested to manager out of disk space errors appropriately without database corruption.        I've got the data moved off to the side after it

Re: [sqlite] threads and last_insert_rowid()

2010-11-16 Thread Pavel Ivanov
whom to trust? Trust Kees. Borgan's thought about keeping the lock and transaction management inside sqlite3_exec is incorrect. as for Kees Nuyt reply, did you toke int account that select last_insert_rowid() and insert query combined in single query and executed via single call of

Re: [sqlite] commit writer when other transaction is active?

2010-11-15 Thread Pavel Ivanov
Is it correct behavior of sqlite that COMMIT will not proceed unless no other transactions are present in the system? No, SQLite never behaves like that. Probably you executed in the second thread some SELECT query (besides INSERT) and it wasn't finished yet by the time of COMMIT. In this

Re: [sqlite] Database deleted from file system while other open connections exist.

2010-11-12 Thread Pavel Ivanov
However, I am surprised that it does not at least possess a list of all open handles to a given database.  If I had that, then I could close all DB connections either before the delete or after.  Are you sure that such a list does not exist? If SQLite was able to obtain such list (not in the

Re: [sqlite] Busy handler not called

2010-11-12 Thread Pavel Ivanov
int ret = sqlite3_exec(m_ppDb, query.c_str(), hwLMsqlite3TableCallback, rs, zErr); I get SQLITE_BUSY and hwLMsqlite3BusyHandler is not getting called. What query do you use? Pavel On Fri, Nov 12, 2010 at 4:51 PM, Prakash Reddy Bande praka...@altair.com wrote: Hi, I have set a busy

Re: [sqlite] SQLite latest version RPM download location

2010-11-09 Thread Pavel Ivanov
We're planning to upgrade SQLite to the latest version (atleast to v3.5.0) The latest version is 3.7.3. Can somebody point me to the RPM download link location of the same? SQLite doesn't have RPM. You can download SQLite's sources or prebuild library from here:

Re: [sqlite] Question about SQLite features.

2010-11-09 Thread Pavel Ivanov
That's I don't know SQLite have stored procedure support? No. There's only limited support of triggers, i.e. triggers don't have some full-featured programming language, they are just a set of selects, updates, deletes or inserts Pavel On Tue, Nov 9, 2010 at 2:29 AM, Tran Van Hoc

Re: [sqlite] A question about transactions

2010-11-03 Thread Pavel Ivanov
Yes. That's precisely the intended use case. Remember though that the transaction is not really committed until COMMIT statement runs: if your application crashes or machine loses power, all changes to the beginning of the transaction are rolled back, not just those since last committed

Re: [sqlite] 'no such column' error returned in a CASE statement

2010-11-02 Thread Pavel Ivanov
This works: sqlite select a,case when a='test' then 'true' else 'false' end from (sele ct 'test' as a) as errval; I guess OP meant it like this: select a,case when a='test' then 'true' else 'false' end as errval from (select 'test' as a); And to answer the question: Is this the expected

Re: [sqlite] Multilple tables with the same schema and prepare query performance

2010-10-29 Thread Pavel Ivanov
order of 10 to 100 of these tables. When doing operations on these tables, I want to avoid having to do a prepare_query every time for performance reasons. Did you measure your performance and find that prepare_query is a bottleneck? Since the tables have exactly the same schema, in theory I

<    1   2   3   4   5   6   7   8   9   10   >