Re: [sqlite] synchronization issue: no directory sync after unlink

2012-02-23 Thread Pavel Ivanov
AFAIK, before deleting journal file SQLite writes some zeroed header into it. This kind of header means that transaction is finished. And even if after power shutdown SQLite finds this journal persisting on disk it will see the header and will understand that this journal just needs to be deleted.

Re: [sqlite] Relative path to sqlite database

2012-02-21 Thread Pavel Ivanov
Just a quick note though, when I move the .exe file to the desktop and double-click on it, it crashes, which suggests that the bin/debug location is only applicable when the application is run from within the IDE. Crash is probably because your desktop folder doesn't have db subdirectory

Re: [sqlite] Multiple threads inserting to separate databases

2012-02-19 Thread Pavel Ivanov
The stack trace you've shown is a lock for allocating new page in page cache. It's probably the lock that helps SQLite ensure that total amount of consumed memory is not greater than the limit configured. But if you work only with in-memory databases then that check is moot and with next step

Re: [sqlite] Prepare SQL for Read-Only Database with Journal File

2012-02-17 Thread Pavel Ivanov
If opening a DB read-only implies that the physical file is always opened read-only, then I understand.  But, if read-only is just something for SQLite to know that it can't modify the database, rollback would still be possible. You are right that opening database with SQLITE_OPEN_READONLY

Re: [sqlite] Difference between SQLITE_CONFIG_MULTITHREAD SQLITE_CONFIG_SERIALIZED options

2012-02-14 Thread Pavel Ivanov
When you use SQLITE_CONFIG_MULTITHREAD you can't use the same handle in different threads without some sort of synchronization. With SQLITE_CONFIG_SERIALIZED you can do that because SQLite will do synchronization for you. So there's no difference in concurrency here. If you use different handles

Re: [sqlite] Newbie stumper

2012-01-27 Thread Pavel Ivanov
select typeof(max(id)) from categories  -- returns 'null' select case max(id) when null then 1 end as NextID from categories Matching with null does not work the same as matching with other values. null means I don't know. so every value matches with it. Just the opposite - every value

Re: [sqlite] serialized thread mode and transactions

2012-01-25 Thread Pavel Ivanov
For example, if the writer thread starts a transaction, and one of the reader threads does a SELECT, would the SELECT be part of the transaction? Or are transactions per-thread on a shared connection? All transactions are per-connection. So yes, SELECT will be a part of transaction and you

Re: [sqlite] serialized thread mode and transactions

2012-01-25 Thread Pavel Ivanov
the readers share a connection. So the next question is, if a reader is in the middle of an exec and has not finalized its statement yet, how would it affect another thread that attempts a statement? Thanks! --erik On Wed, Jan 25, 2012 at 10:34 AM, Pavel Ivanov paiva...@gmail.com wrote

Re: [sqlite] Windows Thread-safe

2012-01-20 Thread Pavel Ivanov
Im observing that, if for example an SQL command in a transaction is uncorrect, the rollback does not work: the previously inserted records are not removed. If you are trying to execute an incorrect SQL statement this statement is not executed but transaction is not rolled back automatically.

Re: [sqlite] BLOB concatenation?

2012-01-20 Thread Pavel Ivanov
       Unfortunately, the string concatenation operator, when applied        to two BLOB's, results in a text string instead of a BLOB, like: SELECT quote (X'5445' || X'5354');  = 'TEST' Maybe the following? SELECT quote(cast(X'5445' || X'5354' as blob)); Pavel On Fri, Jan 20, 2012 at

Re: [sqlite] BLOB concatenation?

2012-01-20 Thread Pavel Ivanov
and wasn't changed for a long time. But keep that in mind just in case. Pavel On Fri, Jan 20, 2012 at 12:20 PM, Ivan Shmakov oneing...@gmail.com wrote: Pavel Ivanov writes: [...]   Unfortunately, the string concatenation operator, when applied to   two BLOB's, results in a text string

Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-17 Thread Pavel Ivanov
I attempted all of the above and the call stacks do not change.  That leads me to one of two conclusions: 1.  The call stacks are inaccurate 2.  There is some side effect which is causing malloc to be called inside of a procedure which should not be calling malloc. I've posted an update to

Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-13 Thread Pavel Ivanov
At this point I've exhausted my avenues of research.  Does anyone have any further ideas as to what may be going on which could cause this increase in memory management activity?  Or any suggestions of where to look next? IIRC, SQLite 3.7.9 changed its PCACHE interface and thus page cache

Re: [sqlite] suppress database is locked?

2012-01-11 Thread Pavel Ivanov
how to suppress this messages? I cant find any kind of --quite or --silent option. You can redirect stderr to /dev/null and you won't see any error messages then. Also you can redirect it to some file and analyze it later for some kinds of errors you want to process. Pavel On Wed, Jan 11,

Re: [sqlite] Named parameters and spaces.

2012-01-10 Thread Pavel Ivanov
Is there a way to use spaces in named parameters? No. Quick fix would be to replace all your spaces with underscores. Pavel On Tue, Jan 10, 2012 at 5:31 PM, Steven Michalske smichal...@gmail.com wrote: Hello, I would like to use the :nnn named parameters but have spaces in the named

Re: [sqlite] UPDATE no such column

2011-12-28 Thread Pavel Ivanov
This sucession of queries give me SQLite error no such column: tmp_ProporcionesGrupos.GRUPO UPDATE ResRdosGrupo SET  ResRdosGrupo.PROPORCION =  ( SELECT    tmp_ProporcionesGrupos.PROPORCION    FROM tmp_ProporcionesGrupos   ) WHERE  ResRdosGrupo.GRUPO = tmp_ProporcionesGrupos.GRUPO AND

Re: [sqlite] CREATE INDEX

2011-12-28 Thread Pavel Ivanov
On Wed, Dec 28, 2011 at 3:28 PM, Pete p...@mollysrevenge.com wrote: If I create an index for a column in a table with existing data in it, is the index automatically populated or do I have to use the REINDEX command? Thanks, It's automatically populated. Pavel

Re: [sqlite] Optimizing a query with range comparison.

2011-12-27 Thread Pavel Ivanov
INSERT INTO ids SELECT id FROM tableA, tableB WHERE pos BETWEEN start AND end; Try using a JOIN instead.  In fact, try both ways around: DELETE FROM ids; INSERT INTO ids SELECT tableA.id FROM tableA JOIN tableB ON pos BETWEEN start AND end; then try DELETE FROM ids; INSERT INTO ids

Re: [sqlite] library routine called out of sequence

2011-12-23 Thread Pavel Ivanov
Devil is in the details. What you described in general is okay. But I guess the exact code you have has some problems. To find them we should see the code. An just some first check: do you have a single-threaded application accessing database? Pavel On Fri, Dec 23, 2011 at 3:32 AM, Sreekumar

Re: [sqlite] library routine called out of sequence

2011-12-23 Thread Pavel Ivanov
On Fri, Dec 23, 2011 at 9:06 AM, Sreekumar TP sreekumar...@gmail.com wrote: Hi, yes, I know. I have a multithreaded app. One db conection.I will try to reproduce the problem with a simple app. However, the difference between the working and non working case is that in the working case

Re: [sqlite] sqlite3_column_text() returning partial results

2011-12-21 Thread Pavel Ivanov
On Wed, Dec 21, 2011 at 10:41 AM, Jacob A. Camp jacob.c...@mastercam.com wrote: I have a line of code that executes that line: const unsigned char * temp2 = sqlite3_column_text(state, 0); This queries the database and after the call is complete I pass this value to another function. This

Re: [sqlite] sqlite3_column_text() returning partial results

2011-12-21 Thread Pavel Ivanov
Now, this is a very good test case and explanation what happens, except... How did you check value of CString testing after iterating though the entire char array? Did you look at it in your debugger? Maybe your debugger is not capable of showing CString contents longer than 2048 symbols? The

Re: [sqlite] Strange behavior for timeouts in transactions

2011-12-19 Thread Pavel Ivanov
5. Enter the following in session 2 (demonstrates unexpected behavior):       .timeout 1       begin;       select * from my_table;       update my_table set userid=1;    - A 'database locked' error message is returned immediately.       rollback; Is this the expected behavior in

Re: [sqlite] No error when deleting a record already deleted?

2011-12-15 Thread Pavel Ivanov
On Thu, Dec 15, 2011 at 10:05 AM, Paxdo Presse pa...@mac.com wrote: It's normal not to get an error message when trying to remove or edit a record that has already been removed? Yes, it's normal. That's how SQL (in any DBMS, not only SQLite) works. Pavel

Re: [sqlite] Error: disk I/O error while creating an index

2011-12-09 Thread Pavel Ivanov
so, I can see the journal file in my work directory which I own (and in which the db file is placed). still constantly, I have a disk I/O ERROR which I don't understand. If you see journal file along your database file and each attempt to open database doesn't delete journal file it means you

Re: [sqlite] Slow View when it is used in a where clause

2011-12-02 Thread Pavel Ivanov
I have been analyzing the Query PLAN. In the query Select * FROM WordGroupView Where idWordGroup = 1; the database engine perform a scan over WordGroup table, and it is not necessary since the where clause is defined. However, using directly the query of the view change the SCAN by a SEARCH,

Re: [sqlite] Slow View when it is used in a where clause

2011-12-02 Thread Pavel Ivanov
Regards, Manuel Jesús. El 02/12/2011 15:49, Pavel Ivanov escribió: I have been analyzing the Query PLAN. In the query Select * FROM WordGroupView Where idWordGroup = 1; the database engine perform a scan over WordGroup table, and it is not necessary since the where clause is defined. However

Re: [sqlite] Error when compiling with the SQLITE_OMIT_WALL directive

2011-11-30 Thread Pavel Ivanov
This will be fixed in next version. See http://www.sqlite.org/src/info/5dbfaed8c3. Pavel On Wed, Nov 30, 2011 at 6:29 AM, Adolfo Jiménez Millán a...@zator.com wrote: Hi all: Using MS VC++ 98, I try to compile the 3.7.9 amalgamation, using the SQLITE_OMIT_WAL directive, but then I get an

Re: [sqlite] Inserting Multiple Rows in a single statement

2011-11-30 Thread Pavel Ivanov
I do have multiple insertions bounded by BEGIN-COMMIT . I am looking at possibilities of making the insertions faster. Prepare your statement in the form INSERT INTO table_name (val1, val2, ...) VALUES (?1, ?2, ...) Then for each row you want to insert you will bind necessary values, execute

Re: [sqlite] Runfile script over existing Database

2011-11-29 Thread Pavel Ivanov
On Tue, Nov 29, 2011 at 2:56 PM, Black, Michael (IS) michael.bla...@ngc.com wrote: In your words: 1. start cmd.exe 2. go to directory with sqlite3.exe 3. type test.sql | sqlite3 test.db3 (Return) Don't get confused: you should type the word type here. ;) Pavel

Re: [sqlite] Help. I change a row from one process, second process doesn't see it.

2011-11-28 Thread Pavel Ivanov
The thing is, it seems this readers don't ever see any changes in the db unless i shut them down and run them again. But connecting with the sqlite3 shell shows the changes in the db as they happen. The above two facts suggest that your readers do not close their reading transactions

Re: [sqlite] SQLITE_BUSY

2011-11-26 Thread Pavel Ivanov
While((result = sqlite3_step(stmt)) == SQLITE_BUSY) {                Usleep(_random [0s, 1s[_); } When sqlite3_step returned SQLITE_BUSY you have to call sqlite3_reset before calling sqlite3_step again. So your loop should look like this: While((result = sqlite3_step(stmt)) == SQLITE_BUSY)

Re: [sqlite] SQLITE_BUSY

2011-11-26 Thread Pavel Ivanov
On Sat, Nov 26, 2011 at 9:03 AM, Simon Slavin slav...@bigfraud.org wrote: On 26 Nov 2011, at 2:00pm, Pavel Ivanov wrote: When sqlite3_step returned SQLITE_BUSY you have to call sqlite3_reset before calling sqlite3_step again. If your statement is a SELECT returning 50 rows, and you've

Re: [sqlite] Checking for existence of in-memory tables

2011-11-24 Thread Pavel Ivanov
P.S: I know that one can simply do a CREATE TABLE IF NOT EXISTS... but I still need to know if a table exists or not. You can easily try this with the sqlite3 command line tool by omitting the database file name argument on the command line. Create a table, insert a row, check sqlite_master.

Re: [sqlite] SQLite: Database or disk full

2011-11-23 Thread Pavel Ivanov
On Wed, Nov 23, 2011 at 2:10 AM, Gaurav Vyas gav...@gmail.com wrote: There is no optimization as of now. I am just slitting the code into various independent parts. And one more thing I found, I have installed SQLite3 3.7.9 and when I am using sqlite3_open_v2 it gives error that says undefined

Re: [sqlite] Bug

2011-11-23 Thread Pavel Ivanov
On Wed, Nov 23, 2011 at 11:28 AM, Simon Slavin slav...@bigfraud.org wrote: On 23 Nov 2011, at 4:17pm, Wiktor Adamski wrote: sqlite select 1 from t order by avg(a); -- should be possible Why should this be possible ?  For an 'ORDER BY' you need a value for each row.  But aggregate functions

Re: [sqlite] Bug

2011-11-23 Thread Pavel Ivanov
On Wed, Nov 23, 2011 at 11:50 AM, Petite Abeille petite.abei...@gmail.com wrote: On Nov 23, 2011, at 5:35 PM, Pavel Ivanov wrote: But although it's completely senseless just syntactically it looks correct - should produce just one row and thus ORDER BY will be a no-op. Well

Re: [sqlite] Bug

2011-11-23 Thread Pavel Ivanov
On Wed, Nov 23, 2011 at 12:20 PM, Petite Abeille petite.abei...@gmail.com wrote: On Nov 23, 2011, at 6:05 PM, Pavel Ivanov wrote:  This query gives different and kind of unexpected result on empty table. ;) Ooops... I see what you mean... on an empty table... this returns one row

Re: [sqlite] Bug

2011-11-23 Thread Pavel Ivanov
On Wed, Nov 23, 2011 at 1:29 PM, Wiktor Adamski bardzotajneko...@interia.pl wrote: Apparently, using such a function in ORDER BY clause alone doesn't make the statement aggregate (whether it should is perhaps debatable) I suppose this may be in the standart. I'm 100% sure that this one is

Re: [sqlite] Time comparisen and CASE WHEN

2011-11-22 Thread Pavel Ivanov
I insert data in this way (for example): INSERT INTO [filed1] VALUES TIME('29-01-2011 08:00:00') Result of TIME('29-01-2011 08:00:00') is NULL. So your field1 doesn't contain anything. Maybe that's why your comparison doesn't work. Pavel On Tue, Nov 22, 2011 at 11:57 AM, Steffen Mangold

Re: [sqlite] Time comparisen and CASE WHEN

2011-11-22 Thread Pavel Ivanov
How come my sqlite can't recognize this statement?  It's not showing as completed and I don't see why. Maybe there should be semicolon after update statement (i.e. after END belonging to CASE)? Pavel On Tue, Nov 22, 2011 at 3:50 PM, Black, Michael (IS) michael.bla...@ngc.com wrote: How

Re: [sqlite] Confused by DELETE statement error

2011-11-21 Thread Pavel Ivanov
DELETE statement doesn't support ORDER BY clause and by default doesn't support LIMIT clause. So you should do the select, find the value of prty for the second row and then issue a delete adding to its WHERE clause and prty ? where you will bind that value of prty you found. Pavel On Mon, Nov

Re: [sqlite] Adobe Air - Using SQLite db, cannot UPDATE nor INSERT

2011-11-16 Thread Pavel Ivanov
// first we need to set the file class for our database (ICM.db).    var db:File = new File (C:/ICM.db); Depending on your Windows version only users with elevated privileges could be able to write into root C:\ directory. Adobe Air apparently won't ask you to elevate its privileges just to

Re: [sqlite] [sqlite-dev] sqlite3_enable_column_metada

2011-11-15 Thread Pavel Ivanov
This kind of questions should be asked on sqlite-users mailing list. Pavel On Tue, Nov 15, 2011 at 3:19 AM, Ilber Ibrahimi iibrah...@solgenia.com wrote: Hi u all, I’m new to sqlite and i want to know how can i build sqlite with the parameter SQLITE_ENABLE_COLUMN_METADATA enabled. I’m

Re: [sqlite] Quickest way to get an answer

2011-11-11 Thread Pavel Ivanov
 select count(status) from mytable where status=0;  select count(status) from mytable where status=0 limit 1; These two are identical because query always return one row thus making limit 1 a no-op.  select status from mytable where status=0 limit 1; This one will have the best performance

Re: [sqlite] JOIN vs IN

2011-11-11 Thread Pavel Ivanov
On Fri, Nov 11, 2011 at 11:58 AM, Petite Abeille petite.abei...@gmail.com wrote: It returns the same results, but it doesn't seem much faster. Is there any performance difference to be expected from using IN instead of JOIN, or does SQLite internally rewrite JOIN queries to something similar as

Re: [sqlite] JOIN vs IN

2011-11-11 Thread Pavel Ivanov
On Fri, Nov 11, 2011 at 8:06 PM, Petite Abeille petite.abei...@gmail.com wrote: No, exists in this case will change query plan significantly and performance can degrade drastically as a result. Why would that be? How would you rewrite the query using exists? The only thing I have in mind is

Re: [sqlite] Referencing subquery several times

2011-11-11 Thread Pavel Ivanov
I know this could be done more easily, but I have to keep this structure (i.e. cannot JOIN for instance). My question is, how could I avoid repeating the subqueries after the AND NOT, since they will return the same set as the previous ones? With your restriction on query structure you cannot

Re: [sqlite] select ... where [=] or [like]

2011-11-09 Thread Pavel Ivanov
On Wed, Nov 9, 2011 at 10:31 AM, hmas i...@iode-informatique.fr wrote: Thanks for your answer. foocol contains a string of numbers. The result of typeof(foocol) is text. And what's the result of hex(foocol) ? My guess is you have some extra non-printable characters in there. Hi, Here are

Re: [sqlite] INDEX Types

2011-11-09 Thread Pavel Ivanov
But I'm wondering if SQLite can deal more efficiently with a INTEGER index (64bits) VS an 8-byte TEXT column (also 64bits). I know the INTEGERs require less disk-space because SQLite can store smaller values in fewer bytes, but are there any other differences that make them more preferable as

Re: [sqlite] select ... where [=] or [like]

2011-11-08 Thread Pavel Ivanov
Thanks for your answer. foocol contains a string of numbers. The result of typeof(foocol) is text. And what's the result of hex(foocol) ? My guess is you have some extra non-printable characters in there. Pavel On Tue, Nov 8, 2011 at 12:11 PM, hmas i...@iode-informatique.fr wrote: Simon

Re: [sqlite] WAL and local UNC filenames

2011-11-08 Thread Pavel Ivanov
On Mon, Nov 7, 2011 at 5:48 PM, Jean-Christophe Deschamps j...@antichoc.net wrote: Pavel, This is not a local file. Even if you use your hostname as netname file is still retrieved through network stack. And I guess SAMBA doesn't work well with memory mapped files (in addition to all

Re: [sqlite] WAL and local UNC filenames

2011-11-07 Thread Pavel Ivanov
Does your path begin with 'file:' ? No, simply \\netname\share\path\test.db This is not a local file. Even if you use your hostname as netname file is still retrieved through network stack. And I guess SAMBA doesn't work well with memory mapped files (in addition to all problems with

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Pavel Ivanov
What is the page size? Aren't sqlite dbs portable to any platform/processor? Could it be that sqlite installed on my 64-bit machine is writing a 64-bit db, but our app and the sqlite3 lib is only 32-bit? Seems like any good file format wouldn't care about that and knows how to read/write

Re: [sqlite] Readonly error when copying to mem-based db

2011-11-07 Thread Pavel Ivanov
err = sqlite3_prepare16_v2(m_dbh, stmt.m_sql.c_str(), -1, stmt.m_stmt, NULL); err - SQLITE_ERROR If I manually set the string to PRAGMA page_size = 4096, then it works. So perhaps this code is doing it wrong. I copied an existing routine that somebody else no longer with the company wrote.

Re: [sqlite] Using sub-select to return limit

2011-11-03 Thread Pavel Ivanov
What I ultimately want to do is iterate through a table that contains the limit and use that value to select all matching values from another table, limiting the number of records selected from the group to that defined by limit. There's no way to do such thing using only SQL. You have to

Re: [sqlite] Progress callback and nested queries

2011-11-02 Thread Pavel Ivanov
I'm assuming that querying the same database using the same handle during a progress callback would be a *bad* idea.  Am I mistaken? That would deadlock on handle's internal mutex or corrupt the handle if your SQLite is compiled without multi-threading support. Pavel On Wed, Nov 2, 2011 at

Re: [sqlite] Disk I/O Error

2011-11-01 Thread Pavel Ivanov
On Mon, Oct 31, 2011 at 5:44 PM, Richard Hipp d...@sqlite.org wrote: On Mon, Oct 31, 2011 at 5:40 PM, Pavel Ivanov paiva...@gmail.com wrote: Error code 522 is SQLITE_IOERR_SHORT_READ.  It is generated here:     http://www.sqlite.org/src/artifact/07acbb3e074e?ln=3012 SQLite was trying

Re: [sqlite] Disk I/O Error

2011-10-31 Thread Pavel Ivanov
Error code 522 is SQLITE_IOERR_SHORT_READ.  It is generated here:     http://www.sqlite.org/src/artifact/07acbb3e074e?ln=3012 SQLite was trying to read N bytes and got back M byes where M0 and MN. Could it be that N bytes cannot be read atomically and operation was interrupted in the middle

Re: [sqlite] Unique id

2011-10-27 Thread Pavel Ivanov
What's wrong with the following (pseudo-code)? begin immediate x = result of (select max(j) from mytab;); ++x; for  (n=0;  nnum;  n++)     // num may be greater than or equal to zero     {     insert into mytab (j) values (x);     } commit Just don't forget to create index on j. Pavel On

Re: [sqlite] Concurrent readonly access to a large database.

2011-10-22 Thread Pavel Ivanov
Using three tables (e.g. test.sh 111 112 113), the first command takes 13m3s, the second command takes 12m45s. I am wondering if there is any magic to make the second script finish in 5 minutes by executing the query in parallel ... Try to execute pragma cache_size = 100 before executing

Re: [sqlite] Concurrent readonly access to a large database.

2011-10-22 Thread Pavel Ivanov
On Sat, Oct 22, 2011 at 6:02 PM, Bo Peng ben@gmail.com wrote: You may create multiple threads, but your hard drive only has one set of heads. I now realize this problem and is moving the data to a faster drive. However, when copying the data out, the activity monitor reports 40MB/sec

Re: [sqlite] Concurrent readonly access to a large database.

2011-10-22 Thread Pavel Ivanov
Anyway, the iostat output of my system is 2011 Oct 22 21:16:36,  load: 0.03,  disk_r:   2676 KB,  disk_w:      0 KB  UID    PID   PPID CMD              DEVICE  MAJ MIN D            BYTES    0      0      0                  ??       14   8              65536  503    732    730 sqlite3        

Re: [sqlite] triggers last_insert_rowid?

2011-10-21 Thread Pavel Ivanov
Because of the trigger's insertion into the second table, should not the second select statement return a value of 2 instead of 1 since the last insertion occurred in table t_log? http://www.sqlite.org/c3ref/last_insert_rowid.html If an INSERT occurs within a trigger or within a virtual table

Re: [sqlite] Testing SQLite in C++

2011-10-20 Thread Pavel Ivanov
Do not include sqlite3ext.h. Applications need only sqlite3.h. Pavel On Thu, Oct 20, 2011 at 11:02 AM, Arbol One arbol...@gmail.com wrote: Hey kids, I am testing SQLite in the hope that I can use it in my program, but I get this confusing error msg, Can anybody help? Error message

Re: [sqlite] Column headers include subselect alias if column is from a subselect

2011-10-18 Thread Pavel Ivanov
I would expect a column header of a for all of these queries, and all other databases I've tested with use a column header of a.  Is this a bug in SQLite? Column name in the result set is undefined unless you define alias in the query. So SQLite can name it whatever it wants. Pavel On

Re: [sqlite] internal column header not case sensitive?

2011-10-13 Thread Pavel Ivanov
This seems to be a bug.  Is there a way to submit this as a bug somewhere or is this the proper way for me to raise this to someone's attention that would be interested in fixing this?  Apologies for not understanding the bug submission process better. I'd say this is definitely a bug. And

Re: [sqlite] pragma PAGE_COUNT != pragma page_count

2011-10-13 Thread Pavel Ivanov
FYI: http://www.sqlite.org/src/info/150592b4b4. Pavel On Thu, Oct 13, 2011 at 10:34 AM, Black, Michael (IS) michael.bla...@ngc.com wrote: Or rather user UpperToLower...I just found that one... if( UpperToLower(zLeft[0])=='p' ){ Michael D. Black Senior Scientist NG Information

Re: [sqlite] Can DBI supply a more specific foreign key mismatch error?

2011-10-13 Thread Pavel Ivanov
     (foreign key mismatch) It means there is a problem with a foreign key definition in the database schema. Either an FK specifies parent columns that do not exist, or parent columns that are not a PRIMARY KEY or UNIQUE. It works on MacOSX with sqlite 3.4.0, and the exact same code fails

Re: [sqlite] DateTimeOffset in SQLite

2011-10-12 Thread Pavel Ivanov
On Wed, Oct 12, 2011 at 9:08 AM, Steffen Mangold steffen.mang...@balticsd.de wrote: Igor Tandetnik wrote: What's DateTimeOffset? Offset from what to what? What exactly are you trying to achieve? See if this helps: http://www.sqlite.org/lang_datefunc.html In C# (.Net) it is the type Timespan.

Re: [sqlite] internal column header not case sensitive?

2011-10-12 Thread Pavel Ivanov
I can confirm this with the following script: SQLite version 3.7.5 Enter .help for instructions Enter SQL statements terminated with a ; sqlite create table t (a, b); sqlite insert into t values (1, 't'); sqlite insert into t values (1, 't'); sqlite insert into t values (1, 'T'); sqlite insert

Re: [sqlite] internal column header not case sensitive?

2011-10-12 Thread Pavel Ivanov
On Wed, Oct 12, 2011 at 11:28 AM, Simon Slavin slav...@bigfraud.org wrote: However, along the way ... sqlite select a, case when b = 't' then 1 end, case when   ... b = 'T' then 1 end from t; 1|1| 1|1| 1||1 2|1| 2||1 2||1 sqlite select a, case when b = 't' then 1 end, case when   ... b

Re: [sqlite] create sqlite3_value * from scratch?

2011-10-12 Thread Pavel Ivanov
On Wed, Oct 12, 2011 at 11:12 AM, Ivan Shmakov i...@gray.siamics.net wrote:   Given some way to construct a sqlite3_value wrapping object, I   could instead rely on sqlite3_bind_value () alone, thus   eliminating the necessity of type specifiers in the interface.   Well, a hypothetical API

Re: [sqlite] SQLITE LIMIT clause

2011-10-07 Thread Pavel Ivanov
SELECT * from test WHERE PK1100 AND PK1200; SELECT * from test WHERE PK1100 LIMIT 100; Will the above queries have the same effect? Or will LIMIT behave differently, i.e. get the entire result set and then return the first 100 from it? If your PK1 has no gaps then those two queries will

Re: [sqlite] Cleaning unicode text

2011-10-03 Thread Pavel Ivanov
I've tried: replace(Name, x'f87f', '') but it doesn't seem to match the weird character. Any ideas? I guess x'f87f' will match your character only if your database is in UTF-16. For UTF-8 you probably should try x'efa1bf'. And maybe explicit conversion to text is needed. Pavel On Mon, Oct

Re: [sqlite] query performance help

2011-10-03 Thread Pavel Ivanov
As can be guessed populating table is quite slow - ~150ms for around 10k rows in IndexME. Why do you think it's slow? 6 rows per second is insanely fast. Pavel On Sun, Oct 2, 2011 at 5:49 AM, Mira Suk mira@centrum.cz wrote: Hey everyone, currently I have some temporary table

Re: [sqlite] MC/DC coverage explained wrong in the home page?

2011-09-24 Thread Pavel Ivanov
On Sat, Sep 24, 2011 at 7:35 AM, Sami Liedes slie...@cc.hut.fi wrote: On Fri, Sep 23, 2011 at 10:26:43PM -0400, Pavel Ivanov wrote:   if (A || 1) ... You can get (e) by giving test cases for A and !A, but most certainly flipping A does not independently affect the outcome as required

Re: [sqlite] MC/DC coverage explained wrong in the home page?

2011-09-23 Thread Pavel Ivanov
  if (A || 1) ... You can get (e) by giving test cases for A and !A, but most certainly flipping A does not independently affect the outcome as required by the plain reading of (f). I'm pretty sure that the latest versions of modern compilers will optimize the above if statement to the

Re: [sqlite] Newbie starting off question

2011-09-22 Thread Pavel Ivanov
What would be the best way to communicate with the DB? Would it make sense just to have one linux shared library containing the DB API ?  (I am a Linux newbie too -- so this might be a stupid question -- I am not sure ) Or perhaps one library for CGI and one for the application? Or perhaps

Re: [sqlite] c-api document suggestion

2011-09-21 Thread Pavel Ivanov
If the user supplies the length of the argument rather than using -1, bind_text expects that this length exclude the null termination, whereas prepare apparently expects it to include the null termination. Can I challenge you in that this conclusion is wrong? Everywhere in the development

Re: [sqlite] Questions about BLOB and page size

2011-09-15 Thread Pavel Ivanov
1. Does BLOB type field cause any performance issues compared to using TEXT when doing inserts/updates. In other words, if they use the same number of bytes, would there be any difference in performance? I believe it's a little weird choice as TEXT fields have some additional features that

Re: [sqlite] TransactionScope ON CONFLICT

2011-09-10 Thread Pavel Ivanov
In this example I added 10 objects to the context and I know that object #5 raises a PrimaryKey (or unique) Exception. What I read from the SQLite documentation I understand that object #6 till object #10 will be also add to the database. But this never happens. I assume you mean that you

Re: [sqlite] Error 11 - Database disk image is malformed

2011-09-08 Thread Pavel Ivanov
This query works fine: SELECT * FROM eloResultTable This query returns Error 11 - Database disk image is malformed SELECT * FROM eloResultTable ORDER BY elo DESC Any ideas? REINDEX eloResultScore; should help you. Pavel On Thu, Sep 8, 2011 at 9:22 AM, Ian Hardingham i...@omroth.com

Re: [sqlite] Totalview Debugger MemoryScape showing leak in my SQLite code?

2011-09-06 Thread Pavel Ivanov
Well, in the first code example, yes you need to free your peekText pointer. Since you passed SQLITE_STATIC for the destructor parameter to sqlite3_bind_text, you should free it before you exit the function and not before.  If you use SQLITE_TRANSIENT, you can free it immediately after the

Re: [sqlite] sqlite3_open_v2 performance degrades as number of opens increase

2011-09-02 Thread Pavel Ivanov
Does anyone know why the performance degrades this way and what can be done to resolve the problem? Do you have by any chance shared cache turned on? I believe when shared cache is used SQLite searches through all open databases to understand if the one you want to open is already opened and

Re: [sqlite] Fine tuning of Sqlite

2011-09-02 Thread Pavel Ivanov
Do you set of PRGAMAS uncompatible ? e;g: setting synchronous=true + journal_mode=off is a non sense for sqlite so engine can't deliver connections I think I now see what you want: a table saying if you have PRAGMA A set to THIS, then PRAGMA B has no effect. Personally I don't know of any

Re: [sqlite] Strategies for protecting sql queries

2011-08-29 Thread Pavel Ivanov
I know that some databases have encrypted stored procedures.  Does sqlite have something similar? SQLite doesn't have any kind of stored procedures. if someone was ambitious enough, they could just attach a debugger to my process and see the plain strings. If someone was ambitious enough

Re: [sqlite] WAL mode and Network filesystems

2011-08-26 Thread Pavel Ivanov
http://www.sqlite.org/wal.html Disadvantage #2: All processes using a database must be on the same host computer; WAL does not work over a network filesystem. So as long as all users of your database are on the same host it seems that WAL will work even if file is on NFS. But then what's the

Re: [sqlite] Shell tool locks database ? AFP access a problem ?

2011-08-24 Thread Pavel Ivanov
i saw the same behaviour with Oracle's CLI client (sqlplus) - as long as i had sqlplus opened and connected, my PHP pages couldn't insert any data. i.e. this type of problem isn't limited to sqlite3. This is completely unrelated because Oracle works differently. And if you saw this locking

Re: [sqlite] Split Function for SQLite?

2011-08-24 Thread Pavel Ivanov
Did you see the code in the link I provided?  It's a function that can be added to SQL. Note, it's not SQL. SQL doesn't support adding functions. SQL is all about SELECT/INSERT/UPDATE/DELETE + DDL commands (like CREATE TABLE). That's it. So the link you provided is a function that can be added

Re: [sqlite] EINTR and write() in os_unix.c

2011-08-19 Thread Pavel Ivanov
If that is indeed the case, the current code will cause corruption on an EINTR on such platforms because the EINTR handling does not account for a non-0 write. No, it won't cause corruption. Because SQLite uses pwrite or its alternative with calls to lseek and write. So after interruption it

Re: [sqlite] EINTR and write() in os_unix.c

2011-08-18 Thread Pavel Ivanov
If you don't want your library behavior to be changed when process receives some signals then you have to use such or some similar approach. Pavel On Thu, Aug 18, 2011 at 9:38 AM, Stephan Beal sgb...@googlemail.com wrote: Hi, sqlite3 hackers, i'm taking a look at os_unix.c:  do{ got =

Re: [sqlite] SqLite - Help

2011-08-17 Thread Pavel Ivanov
Is it possible to create Storedprocedure or Functions in Sqlite. ? No. Since i am new to Sqlite. Can u suggest some best sites or links to learn Sqlite (ofcourse i saw Sqlite.org site) Other than sqlite.org you can look at google.com. It is usually very good at finding answers on

Re: [sqlite] aggregate by break in sequence

2011-08-16 Thread Pavel Ivanov
I think it will have better performance if you do that in your programming language. But if you insist on SQL it would look like this: update table_name set IVmean = (select sum(IVsum)/sum(IVcount) from table_name t where t.Longitude = table_name.Longitude and t.Distance = table_name.Distance);

Re: [sqlite] Read only scaling optimization

2011-08-15 Thread Pavel Ivanov
-0400 From: Pavel Ivanov paiva...@gmail.com Subject: Re: [sqlite] Read only scaling optimization To: General Discussion of SQLite Database sqlite-users@sqlite.org Message-ID:       cag1a4rt+pkj2ingy0jeym6h2vfikownlnx1bqgn-9hydput...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1

Re: [sqlite] Read only scaling optimization

2011-08-12 Thread Pavel Ivanov
I have a Driver doing this pulling in 32 queries aimed at randomness and different tables, much like that would be experienced in typical usage. Best performance comes from having 2 separate programs running on 2 separate files. I'm no expert, but that suggests to me that your bottleneck is

Re: [sqlite] Slow performance

2011-08-12 Thread Pavel Ivanov
A simple select * from table query takes twice as longer time in sqlite compared to sql server express, Both use the same data structure and exactly the same code except for the connection and command objects. Everything is the same except providers and principles of how database works. I see

Re: [sqlite] SQLite + unicode

2011-08-11 Thread Pavel Ivanov
Don't use sqlite3_exec. Use sqlite3_prepare16 (which accepts wchar_t*), sqlite3_step, sqlite3_finalize. Read text from columns with sqlite3_column_text16 (which returns wchar_t*). I'd say it's not exactly this way. AFAIK, wchar_t on Linux is 32-bit, but sqlite3_column_text16 will return

Re: [sqlite] Constraint failed infos

2011-08-11 Thread Pavel Ivanov
This is a known issue and it has an open ticket: http://www.sqlite.org/src/tktview?name=23b2128201. Pavel On Wed, Aug 10, 2011 at 1:05 PM, Julien Laffaye kime...@gmail.com wrote: Hello, Is it possible to get more info when I get a constraint failed error from the C API? I am interested in

Re: [sqlite] In memory v/s tmpfs

2011-08-10 Thread Pavel Ivanov
If you have one reader and many writers, consider PRAGMA journal_mode=WAL; Richard meant one writer and many readers of course. If the other process opens the db connection as read_only, will the hot journal check be still done (during queries operations of the second process)? How is the

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