On Mon, Jul 02, 2012 at 10:13:13AM -0500, Nico Williams scratched on the wall:

> That reminds me: it'd be nice to have a bit string type, since the
> correct way to sort IPv4 CIDR blocks is as bit strings.  This is also
> a proper way to sort IPv6 blocks.  Alternatively, it'd be nice to have
> native IP address types in SQLite4, as otherwise one has to jump
> through hoops to handle IP addresses properly.


  I'd suggest something bigger, as long as we're putting a lot of
  options on the table.

  Postgres supports user-defined types on the server side.  This is now
  most of their slightly esoteric types (such as CIDR addresses) are
  supported internally.  To define a type, the server developer writes a
  server-side plugin that provides a few functions to the server.
  Required functions convert the in-memory representation of the type
  to/from strings (for SQL input/output) and also convert the in-memory
  representation to/from a bit stream for storing on disk.  I think you
  can also provide a sort function.

    http://www.postgresql.org/docs/9.0/static/xtypes.html

  The idea of using a plugin system to expand database functionality
  seems to fit well with the SQLite way of getting things done.
  Functions, collations, and virtual tables are already done in a
  similar way.  Extending that to types seems like a natural thing.

  You can, of course, use a user-defined function that just converts a
  string to a BLOB of some type.  As long as you use the encoder function
  for inputs and the decoder for all outputs, you should be good.  That
  starts to get deep into your SQL, however.  The ability to define
  native types is similar in complexity to adding user-defined
  functions.

  Just a thought.  Any opinions?

   -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