On Sun, Sep 23, 2012 at 01:37:59PM +0300, Baruch Burstein scratched on the wall:
> I am curious about the usefulness of sqlite's "unique" type handling, and
> so would like to know if anyone has ever actually found any practical use
> for it/used it in some project? I am referring to the typeless handling,
> e.g. storing strings in integer columns etc., not to the non-truncating
> system e.g. storing any size number or any length string (which is
> obviously very useful in many cases).

> Has anyone ever actually taken advantage of this feature? In what case?

  Yes.  Several years ago I had a large read-only database I needed
  to fit onto a flash card.  It mostly consisted of strings that were
  anywhere from a few dozen bytes to a few hundred K.  I wrote
  something that attempted to compress the strings.  If the compressed
  block was smaller than the original string (as was usually the case
  for the longer strings) the compressed string was stored as a BLOB.
  If there was no compression savings (which was not uncommon with the
  smaller strings) the string was simply stored as the string.  With
  the addition of a VIEW and a decode function that basically did,
  "if this is a string, return it; if this is a blob, uncompress it
  and return the string", I was all set.

  I've done a number of similar things in other projects.

  Is it critical?  No.  I'm sure each of us could come up with a
  half-dozen ways to do this kind of thing in a traditional database.
  Did it make my life easier, the code simpler, and the database
  smaller and more compact?  Heck, yes.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to