Caveat: I'm not an sqllite guru

But usually the problem with rowid in databases is that it is not guaranteed to 
remain consistent and will change when the physical location of records is 
changed through internal housekeeping.  That said it is often a very good and 
efficient way of accessing data  with integrity guaranteed provided you are 
using it within a single read consistent query and not storing its value for 
reuse.

Rgds,
Rob.

From: johannes hanika [mailto:hana...@gmail.com]
Sent: 20 October 2013 08:36
To: Pascal Obry
Cc: darktable-devel
Subject: Re: [darktable-devel] problem with styles

oh. my understanding of the sqlite docs is that rowid is just an internal thing 
that we shouldn't rely on because they reserve the right to change what it does 
between versions etc?

i'm totally for an additional id in this case.. there is some sql update path 
somewhere around control_init() (control.c:690) maybe it's possible to add an 
additional column id = rowid in case there is no id col yet.

-jo

On Sun, Oct 20, 2013 at 8:23 PM, Pascal Obry 
<pas...@obry.net<mailto:pas...@obry.net>> wrote:

The problem is the following.

The styles are numbered after its rowid (table styles)

The styles items have a styleid referencing the style above.

When a style is removed the rowid are non continuous, that is:

sqlite> select rowid,* from styles;
1|red|
3|blue|
4|violet|

The rowid is style referencing the proper items.

But if the database is vacuumed, the those rowid are continuous and not
referencing the proper style:

sqlite> vacuum;
sqlite> select rowid,* from styles;
1|red|
2|blue|
3|violet|

I think it is a mistake to use the rowid as an index. In fact it is the
only cases on dt where this is done.

The proper solution would be to introduce an id into the styles table.

Not sure how to handle this migration path though.

Idea?

--
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

  gpg --keyserver keys.gnupg.net<http://keys.gnupg.net> --recv-key F949BD3B

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
darktable-devel mailing list
darktable-devel@lists.sourceforge.net<mailto:darktable-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/darktable-devel


This email is confidential and is intended for the addressee only. If you are 
not the addressee, please delete the email and do not use it in any way. Please 
note that any views or opinions presented in this email are solely those of the 
author and do not necessarily represent those of the company. NHBC reserves the 
right to monitor all email communications. The recipient should check this 
email and any attachments for the presence of viruses. The company accepts no 
liability for any damage caused by any virus transmitted by this email. NHBC, 
the National House-Building Council, is limited by guarantee in England, No 
320784. Registered address: NHBC House, Davy Avenue, Knowlhill, Milton Keynes 
MK5 8FP. NHBC is authorised by the Prudential Regulation Authority and 
regulated by the Financial Conduct Authority and Prudential Regulation 
Authority. NHBC Building Control Services Ltd, registered by guarantee in 
England with Company No. 01952969. Registered address: NHBC House, Davy Avenue, 
Knowlhill, Milton Keynes MK5 8FP. NHBC Services Ltd registered by guarantee in 
England, No 03067703. Registered address: NHBC House, Davy Avenue, Knowlhill, 
Milton Keynes MK5 8FP. If you make a claim under a Buildmark policy your 
personal details will be stored and processed in accordance with the Data 
Protection Act. Your personal details may be passed to others involved with 
your claim such as the original builder, or a consultant or remedial works 
contractor that we may employ in connection with your claim(s) and matter 
ancillary to your claim(s). Other than disclosure provided for in this 
statement, we will not pass any data about you to any other party without your 
permission unless we are required to do so by law.
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
darktable-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to