[sqlite] BLOB handle expires when unrelated table is UPDATED!?

2010-01-18 Thread a1rex
According to the documentation athttp://www.sqlite.org/c3ref/blob_open.html “ If the row that a BLOB handle points to is modified by an UPDATE, DELETE, or by ON CONFLICT side-effects then the BLOB handle is marked as "expired". This is true if any column of the row is changed, even a column

[sqlite] Incremental i/o - Is anyone using ‘sq lite3_blob_write’?

2010-01-19 Thread a1rex
I have to admit my confusion with incremental i/o functions. I am not sure that problem, which I encountered, is due to internal bug in my program, I hit a Sqlite bug or Sqlite behaves properly. I would greatly appreciate any comments! First, the incremental i/o looked as a God’s sent gift

Re: [sqlite] Need help understanding the basic of C++/sqlite

2010-01-19 Thread a1rex
1. Complete c program for beginners is here: http://manishtech.wordpress.com/2009/03/30/sqlite-with-c/ 2. sqlite3_exec with callback is an obsolete concept from sqlite2 Use sqlite3_prepare_v2 with sqlite3_step as it is linear, more effective and giving more control approach. I hope it

Re: [sqlite] Incremental i/o - Is anyone using ???sqlite3_blob_write????

2010-01-19 Thread a1rex
lob_write On Tue, Jan 19, 2010 at 07:14:11AM -0800, a1rex scratched on the wall: > So, I coded accordingly. I thought that I could keep the same handle to the > blob forever as long > as I do not touch the row where my blob is located. At least that is my > understanding of

Re: [sqlite] Incremental i/o - Is anyone using ???sqlite3_blob_write????

2010-01-19 Thread a1rex
>Look at the source for sqlite3_blob_open(). From stepping through the code I have learned that blob read/write fails and returns SQLITE_ABORT because in the blob handle structure structIncrblob { int flags; /* Copy of "flags" passed to qlite3_blob_open() */ int nByte;

[sqlite] UTF-8 and UTF-16

2010-01-31 Thread a1rex
I am planning to store text in a database which has to accommodate a few international languages. In this case I have to use UTF-16LE encoding for my TEXT fields. I know that once an encoding has been set for a database, it cannot be changed. Do BLOBS are effected? I guess I cannot mix

Re: [sqlite] UTF-8 and UTF-16

2010-01-31 Thread a1rex
[sqlite] UTF-8 and UTF-16 a1rex wrote: > I am planning to store text in a database which has to accommodate a few > international languages. > In this case I have to use UTF-16LE encoding for my TEXT fields. Perhaps there are some external reasons, but there's nothing in SQLite that w

[sqlite] Shocked by long updates of the text database, 1000 speed improvement after small modification to the code.

2010-02-03 Thread a1rex
I just encountered very curious case in Sqlite. I have very simple data base with only one table and one index: "CREATE TABLE IF NOT EXISTS notes(id INTEGER PRIMARY KEY, note TEXT)"; My updates to the simple text database were very slow. Extremely slow! I changed my code and achieved 1000

Re: [sqlite] UTF-8 and UTF-16

2010-02-03 Thread a1rex
>From: Jens Miltner >Sent: Wed, February 3, 2010 9:46:06 AM >Just another thought to consider: depending on the amount of non-ASCII >(or non-roman) string data stored in your database, in may be more >efficient to use UTF-8 encoding rather than UTF-16 encoding: >UTF-8 takes up

Re: [sqlite] Shocked by long updates of the text database, 1000 speed improvement after small modification to the code.

2010-02-03 Thread a1rex
>- Original Message >From: Pavel Ivanov >To: General Discussion of SQLite Database >Sent: Wed, February 3, 2010 11:37:17 AM >Just first thought came to my mind: are you sure that 2 versions of >code mentioned do the same thing? In particular

Re: [sqlite] Shocked by long updates of the text database, 1000 speed improvement after small modification to the code.

2010-02-03 Thread a1rex
Thank you kindly for all your suggestions! >If you want SQLite to support all ACID properties you cannot change >anything to speed up updates. Making sure that I do not loose a character was my primary objective. > If you are doing bulk updates, and are in a position to re-run the > data

[sqlite] When incremental write is committed to the hard drive?

2010-02-03 Thread a1rex
I use UPDATE for text columns in the table and any changes are committed to the hard drive right away (well, after about 120 ms). This can be verified by using external tool. I use SQLite Manager to 'see' the changes. I use also

Re: [sqlite] When incremental write is committed to the hard drive?

2010-02-04 Thread a1rex
Pavel, Thank you very much for your email. I greatly appreciate your knowledge on the internal workings of Sqlite and your kindness to share it. >All incremental writing is committed (and thus is written to disk) >when blob handle is closed. And even when you close the handle >transaction is

Re: [sqlite] When incremental write is committed to the hard drive?

2010-02-04 Thread a1rex
Thank you very much for your advice! >to check that transaction >wasn't committed yet you can connect to the database with external >command while application is working and try to update or insert >something. If it fails with message "The database file is locked" then >application didn't

Re: [sqlite] When incremental write is committed to the hard drive?

2010-02-04 Thread a1rex
Pavel, Thank you so much for your help. Your knowledge is worth more than gold. You were absolutely right regarding not closed blob handle! (for prepare I use only sqlite3_prepare_v2) I found out that I had one blob handle opened in the unrelated table in the same database. This handle was

[sqlite] 1 reader 1 writer but sqlite3_step fails wit h “database is locked” error in both processes

2010-02-14 Thread a1rex
Process A updates data base table in the tight loop. Nothing special: loop sql = "UPDATE table SET blob=:blob WHERE id=?"; rc = sqlite3_prepare_v2(…) rc = sqlite3_bind_int(…) sqlite3_bind_blob(…) rc = sqlite3_step(…) rc = sqlite3_reset(…) rc = sqlite3_finalize(…); Process B just reads

Re: [sqlite] 1 reader 1 writer but sqlite3_step fails wit h “database is locked” error in both processes

2010-02-14 Thread a1rex
locked” error in both processes a1rex wrote: > I thought that I can have 1 writer and many readers You thought incorrectly. You can have one writer OR many readers. Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite

Re: [sqlite] 1 reader 1 writer but sqlite3_step fails wit h “database is locked” error in both processes

2010-02-14 Thread a1rex
cesses a1rex wrote: > I thought that I can have 1 writer and many readers You thought incorrectly. You can have one writer OR many readers. Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bi

Re: [sqlite] 1 reader 1 writer but sqlite3_step fails wit h “database is locked” error in both processes

2010-02-15 Thread a1rex
Sent: Sun, February 14, 2010 2:54:35 PM Subject: Re: [sqlite] 1 reader 1 writer but sqlite3_step fails with “database is locked” error in both processes a1rex wrote: > I thought that I can have 1 writer and many readers You thought incorrectly. You can have one writer OR many re

[sqlite] Memory usage – one data base versus tw o smaller ones

2010-02-17 Thread a1rex
For some reasons it is more convenient for the project to have a few smaller databases with unrelated data than one containing everything. My only concern is RAM memory. How much burden/memory overhead an additional database would introduce? Thank you for your input, Samuel

Re: [sqlite] One data base versus two smaller ones

2010-02-19 Thread a1rex
Thank you very much for your help! Since my typical record is less than 100 bytes I guess that I can use Page Size = 512 bytes without degradation of database performance.This would conserve memory. How vital is default number of pages for database performance? Can I drastically drop the

Re: [sqlite] One data base versus two smaller ones

2010-02-19 Thread a1rex
Thank you for putting me on the right track! Now I know how to attack the issue. Also this pragmas may help me: PRAGMA default_cache_size = Number-of-pages; PRAGMA cache_size = Number-of-pages; PRAGMA page_size = bytes; PRAGMA max_page_count = N; Regards, Samuel - Original Message

Re: [sqlite] Interrupt first sqlite3_step in FTS3 query

2010-02-19 Thread a1rex
- Original Message From: Simon dbern...@noos.fr >However, it seems that some process (that can take >several tens of seconds) in the first >sqlite3_step does not test for >interrupt (resulting in simultaneous uninterrupted >concurrent threads...) According to

Re: [sqlite] Interrupt first sqlite3_step in FTS3 query

2010-02-19 Thread a1rex
Simon, I am very surprise that your SQLite operation can take so long. Is it a very complicated search? Multiple writes? >I have a text field that launches a full text search query at every key press. Can you rearrange your algorithm? How many records do you search? Do you have to search on

Re: [sqlite] Problem with SQLite in BCB 4

2010-03-06 Thread a1rex
You cannot push_back(NULL) null pointer. Fix is below: if(result == SQLITE_ROW) { vector values; for(int col = 0; col < cols; col++) {

Re: [sqlite] Crash after add column

2010-03-07 Thread a1rex
>I try to ADD a column by run the querry "ALTER TABLE x >ADD y NUMERIC" from my application, I can't use the data base any more. Try this: "ALTER TABLE main.x ADD y NUMERIC" and verify by external tool that column x has been added.

Re: [sqlite] Crash after add column

2010-03-07 Thread a1rex
- Original Message >From: VasiliyF4 >After I try to ADD a column by run the querry "ALTER TABLE x >ADD y NUMERIC" from my application, I can't use the data base any more. If I >try to get or save any data at my DB it cause crash of the application. Of course your

Re: [sqlite] Problem with SQLite in BCB 4

2010-03-07 Thread a1rex
Well, sorry to hear that. I tested the function: vector CSGDb::query(char* query, sqlite3 *database) { sqlite3_stmt *statement; vector results; if(sqlite3_prepare_v2(database, query, -1, , 0) == SQLITE_OK) { int cols =

Re: [sqlite] Problem with SQLite in BCB 4

2010-03-08 Thread a1rex
Chimerian, I compiled and tested the tutorial example (which you pointed out) with VC++ on XP Pro. Example is fine, except with the problem of not checking for NULL pointer, which I fixed for you. DB is created and values are stored and retrieved. No problem with SQLite or STL. I do not

Re: [sqlite] Problem with SQLite in BCB 4

2010-03-08 Thread a1rex
>> 2010/3/6 Chimerian : >> values.push_back((char*)sqlite3_column_text(statement, col)); >> // HERE IS ERROR ! >From: Simon Davies >What error? >I can not see why THIS line should provoke any error; This line will produce a runtime error when sqlite3_column_text(statement,

Re: [sqlite] Problem with SQLite in BCB 4

2010-03-08 Thread a1rex
- Original Message >From: Simon Davies >The return from sqlite3_column_text is not valid after subsequent calls to any >of >sqlite3_step/sqlite3_reset/sqlite3_finalize. Yes. What about void *p = sqlite3_column_blob()? >From my tests it looks

Re: [sqlite] Problem with SQLite in BCB 4

2010-03-09 Thread a1rex
Thank you very much for your clarification! This is what I suspected. Regards, Samuel - Original Message From: Igor Tandetnik <itandet...@mvps.org> a1rex wrote: > What about void *p = sqlite3_column_blob()? > From my tests it looks that pointer p survives sqli

Re: [sqlite] How can I query a sqlite3_stmt to find outif ithas been run through the sqlite3_prepare_v2 function?

2010-03-09 Thread a1rex
>- Original Message >From: P Kishor >To the veterans on the list, it is very clear that no one had a "how >stupid are you" attitude I totally agree, and I am new here. I prefer to get any answer - since I will learn from it - than no answer at all. >Even if a

Re: [sqlite] why SQLITE_BUSY when read the database

2010-03-10 Thread a1rex
>Do The words mean that while one process is writing the database other >processes could not read the database at the same time? In short:: YES __ Be smarter than spam. See how smart SpamGuard is at giving junk email the

Re: [sqlite] why SQLITE_BUSY when read the database

2010-03-10 Thread a1rex
>Do The words mean that while one process is writing the database other >processes could not read the database at the same time? The reader fails since it cannot obtain SHARED lock required for reading. It cannot obtain that lock since the writer already managed to obtain PENDING or EXCLUSIVE

Re: [sqlite] Question about binding

2010-03-24 Thread a1rex
* :VVV * @VVV * $VVV Are above bindings the same? (Just different prefix to VVV)? Thank you, Samuel From: Pavel Ivanov To: General Discussion of SQLite Database Sent: Wed, March 24, 2010 2:16:34 PM

Re: [sqlite] Behaviour of tables with same name

2010-05-07 Thread a1rex
Since we are at this topic let me ask the question: Are the table names case insensitive? From: Andy Gibbs To: sqlite-users@sqlite.org Sent: Fri, May 7, 2010 8:00:44 AM Subject: Re: [sqlite] Behaviour of tables with same name > I

Re: [sqlite] API not responding correctly for vc++

2010-05-13 Thread a1rex
I hope that you know that sprintf(sql, "SELECT count(*) FROM table1;"); is not a going to give you count(*) FROM table1. Where is your real query? From: Prajeed chathuar To: sqlite-users@sqlite.org Sent: Thu, May 13, 2010