[Haskell-cafe] ANN: HDBC v2.0 now available
John Goerzen
jgoerzen at complete.org
Fri Jan 30 16:28:02 EST 2009
Hi everyone,
I'm pleased to announce that HDBC v2.0 is now available.
Simultaneously, HDBC-sqlite3, HDBC-postgresql, and HDBC-odbc v2.0 have
also been uploaded. All may be found from Hackage, or at
software.complete.org.
A guide to new features and migration can be found at:
http://software.complete.org/software/wiki/hdbc/NewIn20
A partial summary of it follows:
New Features:
* Pervasive Unicode support now part of the HDBC API and implemented
by all backend drivers. Based on utf8-string and conversions
between UTF-8 ByteStrings and Haskell Strings.
* Full support for GHC 6.10 is new. Full support for GHC 6.8 is
maintained.
* Native support for the new exception handling in GHC 6.10, with CPP
conditional compilation to continue supporting the old-style
exceptions for users of GHC 6.8 or Hugs.
* HDBC now has direct support for marshalling virtually all of the
Data.Time.* types to and from SQL database date/time types. toSql
and fromSql/safeFromSql now support conversions between Data.Time.*
types and SqlValue. Conversions between System.Time.* types were
present from the beginning and will remain. Automatic conversions
are, of course, contingent on support in database engines and HDBC
database backend drivers and may not be possible with all
databases.
* Major expansion of SqlValue to be able to carry date/time data
to/from databases in terms of Data.Time.* types.
+ The old SqlTimeDiff and SqlEpochTime types continue to be
present, but are deprecated and will be removed in a future.
toSql no longer converts anything to them. The System.Time.*
types are converted to the new Data.Time-based SqlValues. It
should be exceptionally rare that any user code would use
these types directly, but they are being retained in this
version out of an abundance of caution.
* Replace fromSql with safeFromSql, which returns Left on impossible
conversions instead of raising an exception.
+ Wrote a new fromSql that behaves just like the old one, but is
implemented in terms of safeFromSql. It converts the
safeFromSql errors to exceptions.
+ The new structure made it possible to greatly enhance many
error messages throughout the conversion process instances.
+ Removed SqlType typeclass. Re-implemented SqlValue conversions
in terms of the generic infrastructure in the convertible
package. Simplified code significantly due to this.
* Lots of additional docs.
* New skeleton test suite for HDBC itself (to be expanded upon
later).
Richer Date and Time Support
HDBC 1.x had only two ways of getting dates and times between Haskell
and a database: an epoch (an Integer representing the number of seconds
since midnight Jan 1 1970 UTC) and an Integer representing a TimeDiff
(a count of elapsed time). While this approach could represent a
precise instant in time, it was not always the most helpful. Most
notably, you might sometimes want to load date information without
time, time without date, or record what timezone the time was measured
within. HDBC can now convert all of these things with much greater
precision.
Thanks to Phil Wise for adding the first Unicode support (to
HDBC-postgresql originally) and to Alson Kemp for adding the first
advanced date/time marshalling support (also to HDBC-postgresql
originally). The experience of adding these features to a single
backend driver first made clear a good way to add them to HDBC API
as a whole.
-- John
More information about the Haskell-Cafe
mailing list