[sqlite] Adjusting strategy for ROWIDs

2011-03-04 Thread Enrico Thierbach
Hi everyone, I just stumbled about a problem with sqlite that I am not able to solve. I hope to find the most experienced sqlite users here, maybe you know of a solution :) If I insert a record into a table with a primary key column id, Sqlite assigns a ROWID as outlined here http://www.sqlite.

Re: [sqlite] Adjusting strategy for ROWIDs

2011-03-04 Thread Enrico Thierbach
On 04.03.2011, at 22:21, Drake Wilson wrote: > Quoth Enrico Thierbach , on 2011-03-04 22:11:07 +0100: >> If I insert a record into a table with a primary key column id, >> Sqlite assigns a ROWID as outlined here >> http://www.sqlite.org/autoinc.html. However, I would like t

Re: [sqlite] Adjusting strategy for ROWIDs

2011-03-05 Thread Enrico Thierbach
On 05.03.2011, at 02:21, Simon Slavin wrote: > > On 5 Mar 2011, at 1:18am, Enrico Thierbach wrote: > >> I do have a working solution for synching my databases (with randomly >> generated ROWIDs). The problem I face >> is that I cannot get the rowid of a newly creat

Re: [sqlite] Adjusting strategy for ROWIDs

2011-03-05 Thread Enrico Thierbach
Hi list, I should have omitted the word "random" from the original post :) What was answered (but not specifically asked) is - sqlite has a pretty good PRNG. - yes, there is the birthday paradoxon. BTW, the calculation I wrote down in the other post regarding the birthday paradox was wrong. Th

Re: [sqlite] Feature request: hash function for fast indices on text and blob fields

2011-03-06 Thread Enrico Thierbach
On 06.03.2011, at 14:22, Alexey Pechnikov wrote: > Sqlite does not has ability to compress indices. There is huge > performance problem with populating a database with indexed > text or blob fields. But we can emulate indices compression > by using index on hashed field (and populate the hash fie

Re: [sqlite] jquery sqlite3

2011-03-07 Thread Enrico Thierbach
It is noteworthy, however, that this spec won't make it into the standard; so browser vendors are basically free to drop it anytime. (yea that's sad.) /Eno On 07.03.2011, at 03:56, Simon Slavin wrote: > > On 7 Mar 2011, at 2:49am, Matt Young wrote: > >> Trying to understand it. How do I spe

Re: [sqlite] jquery sqlite3

2011-03-07 Thread Enrico Thierbach
On 07.03.2011, at 23:36, Matt Young wrote: > I looked up Noah Hart and found a very nice C# inerface to the SQLIite > system. That sound's ideal, under Chrome OS so with other vendor support I > hear. So specialized blog readers can use widgets built with c#/ and get it > all, in the bowser Not

[sqlite] Timezone/DST question

2011-03-07 Thread Enrico Thierbach
Hallo list, how would you tackle this problem? I have to add a number of times into the database. They come from "real live" sources, that, for example, say: "Sunday, March 13th, 2pm", or "Sunday, April 3rd, 2pm". Here in Central Europe we switch to DST on the last weekend of March, therefore

Re: [sqlite] jquery sqlite3

2011-03-07 Thread Enrico Thierbach
On 07.03.2011, at 23:57, Simon Slavin wrote: > > On 7 Mar 2011, at 10:46pm, Enrico Thierbach wrote: > >> (which, btw, says: "Android ships with SQLite version 3.4.0") As a related >> question: how far back is sqlite 3.4.0 ? > > June 2007 > >

Re: [sqlite] Timezone/DST question

2011-03-08 Thread Enrico Thierbach
On 08.03.2011, at 14:29, Igor Tandetnik wrote: > Enrico Thierbach wrote: >> I have to add a number of times into the database. They come from "real >> live" sources, that, for example, say: "Sunday, March >> 13th, 2pm", or "Sunday, April 3rd, 2pm

Re: [sqlite] Timezone/DST question

2011-03-08 Thread Enrico Thierbach
Hi Igor, Dealing with this time zone business always makes me feel dizzy :) Your suggestion works pretty fine, in fact, see: > 1.8.7 ~ > sqlite3 > sqlite> select datetime('2011-03-08 14:00', 'utc'); > 2011-03-08 13:00:00 > sqlite> select datetime('2011-04-08 14:00', 'utc'); > 2011-04-08 12:00:0

Re: [sqlite] memory usage after VACUUM

2011-03-09 Thread Enrico Thierbach
On 09.03.2011, at 16:23, Nick Hodapp wrote: > I'm using sqlite in an iOS app, via the popular FMDB wrapper. > > My profiling tool is showing me that the app is using 2.5 MB of memory > before a VACUUM, and nearly 6MB after. The tool shows that the extra memory > was allocated by sqlite3MemMallo

Re: [sqlite] Determining deepest descendents of parent records from one table

2011-03-18 Thread Enrico Thierbach
I think you should limit yourself to one table, at least for the purpose of parent<->child relationships. I am working on a similar problem right now. (I started with sqlite, but moved to mysql for reasons outside of this problem scope.) My solution, which performs fine, is as follows: I put al

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

2011-03-20 Thread Enrico Thierbach
Hi Udon, > > But to answer your question. more fully.LabVIEW is cross platform (MAC, > Win,VXWorks & Linux). Therefore the API I provide can (and does) work under > all > those systems (and ,many users have been using it in those OSs for some time) > - > you just need the SQLite library compi

Re: [sqlite] sqlite-users Digest, Vol 39, Issue 20

2011-03-21 Thread Enrico Thierbach
Hi Udon, to come to an possibly productive end here: if you think an amd64 compilation would be useful to you (I do doubt that though :(, drop me a note and I will fire up a compiler run on one of my servers, and tar the results. /eno > > @eno > I'm sure RPMs are really cool. But previously

Re: [sqlite] Help me understand the sqlite query optimizer

2011-03-21 Thread Enrico Thierbach
Hi Simon, I just stumbled about this post. > On 21.03.2011, at 06:34, Simon Slavin wrote: > > Suppose you have a TABLE employees with ten thousand rows and no indexes, and > you execute > > SELECT id,firstname,surname FROM employees WHERE firstname='Guilherme' AND > age=46 > > The quer

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Enrico Thierbach
Is this really a bug? I at least wouldn't expect last_insert_rowid to be constant if the database gets modified. /eno On 04.04.2011, at 13:28, Alexey Pechnikov wrote: > $ sqlite3 > SQLite version 3.7.6 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> CREAT

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Enrico Thierbach
Hi Nico, this >> Is this really a bug? I at least wouldn't expect last_insert_rowid to be >> constant if the database gets modified. > was more a question for sake of my understanding. Both in the post Simon referred to > insert into one (value) values ("hello1"); > select last_insert_rowid

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Enrico Thierbach
On 04.04.2011, at 15:59, Simon Slavin wrote: > > On 4 Apr 2011, at 2:48pm, Enrico Thierbach wrote: > >> isn't last_insert_rowid defined as the ID of the last row inserted > > Yes it is. But the FTS system does what it does by maintaining extra tables, > and d

Re: [sqlite] FTS4 bug in last_insert_rowid()

2011-04-04 Thread Enrico Thierbach
On 04.04.2011, at 15:59, Simon Slavin wrote: > > On 4 Apr 2011, at 2:48pm, Enrico Thierbach wrote: > >> isn't last_insert_rowid defined as the ID of the last row inserted > > Yes it is. But the FTS system does what it does by maintaining extra tables, > and d

Re: [sqlite] Increment a row value...

2011-04-06 Thread Enrico Thierbach
On 06.04.2011, at 17:13, John D. Marinuzzi wrote: > Hello, > > > > Perhaps this is more of a SQL question, but I am curious if SQLite has some > kind of implementation for incrementing an integer within a row without > actually reading the value and then updating the record. Is that possible?

Re: [sqlite] User function calculates for every row before applying any where condition

2011-04-11 Thread Enrico Thierbach
On 11.04.2011, at 10:18, Maxim V. Shiyanovsky wrote: > Does SQlite (3.6.23.1 to be precise) perform any optimization when user > function appears in the statement? > > I defined custom function MY_FUNC(a TEXT, b TEXT) and bound it with > sqlite3_create_function. > > Suppose, we have 2 tables:

Re: [sqlite] Advice to choose an index for quad tree?

2011-05-03 Thread Enrico Thierbach
Hi, I think an R Tree is what you are after. http://www.sqlite.org/rtree.html /eno ___ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Enrico Thierbach
Hi Lynton, I don't think sqlite (or any SQL database, for that matter) is a perfect fit for a logger, because there is a certain amount of write overhead. Why do you think you would want to do this? /eno On 10.05.2011, at 10:09, Lynton Grice wrote: > Hi there, > > SQLite is a perfect fit fo

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Enrico Thierbach
On 10.05.2011, at 12:06, Stephan Beal wrote: > On Tue, May 10, 2011 at 11:52 AM, Enrico Thierbach wrote: > >> I don't think sqlite (or any SQL database, for that matter) is a perfect >> fit for a logger, because there is a certain amount of write overhead. >> Why d

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Enrico Thierbach
> > A round robin queue is fine. Every so often, to kill off old records do > > SELECT max(rowid) FROM myTable > > then in your code subtract from it however many rows you want to keep, then do > > DELETE FROM myTable WHERE rowid < firstToRetain > > It won't work perfectly but it's simple and

Re: [sqlite] Insert a structure

2011-05-16 Thread Enrico Thierbach
On 16.05.2011, at 11:08, Christoph P.U. Kukulies wrote: > Am 16.05.2011 10:51, schrieb StyveA: >> Hi all, >> >> I'm working on a code in C, and I would like to insert a structure into a >> table as BLOB type. >> >> Is-it possible to pass it entirely in one time? Or should I insert each >> param

Re: [sqlite] Insert a structure

2011-05-16 Thread Enrico Thierbach
>From my experience I would recommend you to convert your structure into some >kind text format. JSON, with the excellent and well-performing yajl library, >is usually my favorite choice here. /eno On 16.05.2011, at 11:39, StyveA wrote: > > > > Enrico Thierbach-2